Skip to content

Commit 8e61cf2

Browse files
committed
Remove mentions to RPC
1 parent 6ef2b0b commit 8e61cf2

File tree

4 files changed

+12
-17
lines changed

4 files changed

+12
-17
lines changed

cmd/gcp/main.go

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,11 @@ var (
5353
notAfterStart timestampFlag
5454
notAfterLimit timestampFlag
5555

56-
httpEndpoint = flag.String("http_endpoint", "localhost:6962", "Endpoint for HTTP (host:port).")
57-
tlsCert = flag.String("tls_certificate", "", "Path to server TLS certificate.")
58-
tlsKey = flag.String("tls_key", "", "Path to server TLS private key.")
59-
metricsEndpoint = flag.String("metrics_endpoint", "", "Endpoint for serving metrics; if left empty, metrics will be visible on --http_endpoint.")
60-
// TODO(phboneff): delete / rename
61-
rpcDeadline = flag.Duration("rpc_deadline", time.Second*10, "Deadline for backend RPC requests.")
56+
httpEndpoint = flag.String("http_endpoint", "localhost:6962", "Endpoint for HTTP (host:port).")
57+
tlsCert = flag.String("tls_certificate", "", "Path to server TLS certificate.")
58+
tlsKey = flag.String("tls_key", "", "Path to server TLS private key.")
59+
metricsEndpoint = flag.String("metrics_endpoint", "", "Endpoint for serving metrics; if left empty, metrics will be visible on --http_endpoint.")
60+
tesseraDeadline = flag.Duration("tessera_deadline", time.Second*10, "Deadline for backend RPC requests.")
6261
maskInternalErrors = flag.Bool("mask_internal_errors", false, "Don't return error strings with Internal Server Error HTTP responses.")
6362
tracing = flag.Bool("tracing", false, "If true opencensus Stackdriver tracing will be enabled. See https://opencensus.io/.")
6463
tracingProjectID = flag.String("tracing_project_id", "", "project ID to pass to stackdriver. Can be empty for GCP, consult docs for other platforms.")
@@ -113,7 +112,7 @@ func main() {
113112
// client.
114113
opts := sctfe.InstanceOptions{
115114
Validated: vCfg,
116-
Deadline: *rpcDeadline,
115+
Deadline: *tesseraDeadline,
117116
MetricFactory: prometheus.MetricFactory{},
118117
RequestLog: new(sctfe.DefaultRequestLog),
119118
MaskInternalErrors: *maskInternalErrors,

handlers.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -127,9 +127,8 @@ func (a AppHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
127127
}
128128
}
129129

130-
// Many/most of the handlers forward the request on to the Log RPC server; impose a deadline
131-
// on this onward request.
132-
ctx, cancel := context.WithDeadline(logCtx, getRPCDeadlineTime(a.Info))
130+
// impose a deadline on this onward request.
131+
ctx, cancel := context.WithDeadline(logCtx, getDeadlineTime(a.Info))
133132
defer cancel()
134133

135134
var err error
@@ -414,8 +413,8 @@ func getRoots(_ context.Context, li *logInfo, w http.ResponseWriter, _ *http.Req
414413
return http.StatusOK, nil
415414
}
416415

417-
// getRPCDeadlineTime calculates the future time an RPC should expire based on our config
418-
func getRPCDeadlineTime(li *logInfo) time.Time {
416+
// getDeadlineTime calculates the future time an RPC should expire based on our config
417+
func getDeadlineTime(li *logInfo) time.Time {
419418
return li.TimeSource.Now().Add(li.instanceOpts.Deadline)
420419
}
421420

handlers_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@ import (
3535
"github.com/google/go-cmp/cmp"
3636
"github.com/google/go-cmp/cmp/cmpopts"
3737
"github.com/google/trillian/monitoring"
38-
"github.com/transparency-dev/trillian-tessera/ctonly"
3938
"github.com/transparency-dev/static-ct/mockstorage"
4039
"github.com/transparency-dev/static-ct/testdata"
40+
"github.com/transparency-dev/trillian-tessera/ctonly"
4141
"google.golang.org/grpc/codes"
4242
"google.golang.org/grpc/status"
4343
"google.golang.org/protobuf/proto"
@@ -532,7 +532,7 @@ func (d dlMatcher) Matches(x interface{}) bool {
532532

533533
deadlineTime, ok := ctx.Deadline()
534534
if !ok {
535-
return false // we never make RPC calls without a deadline set
535+
return false // we never make calls without a deadline set
536536
}
537537

538538
return deadlineTime == fakeDeadlineTime

instance.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,6 @@ type InstanceOptions struct {
3939
Deadline time.Duration
4040
// MetricFactory allows creating metrics.
4141
MetricFactory monitoring.MetricFactory
42-
// ErrorMapper converts an error from an RPC request to an HTTP status, plus
43-
// a boolean to indicate whether the conversion succeeded.
44-
ErrorMapper func(error) (int, bool)
4542
// RequestLog provides structured logging of CTFE requests.
4643
RequestLog RequestLog
4744
MaskInternalErrors bool

0 commit comments

Comments
 (0)