Skip to content

Commit

Permalink
Clean up some options documentation.
Browse files Browse the repository at this point in the history
  • Loading branch information
creachadair committed Sep 12, 2021
1 parent 419b34b commit d02d64d
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions opts.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@ import (

// ServerOptions control the behaviour of a server created by NewServer.
// A nil *ServerOptions provides sensible defaults.
// It is safe to share server options among multiple server instances.
type ServerOptions struct {
// If not nil, send debug logs here.
// If not nil, send debug text logs here.
Logger *log.Logger

// If not nil, the methods of this value are called to log each request
Expand All @@ -38,16 +39,16 @@ type ServerOptions struct {
// along to the given assigner.
DisableBuiltin bool

// Allows up to the specified number of goroutines to execute concurrently
// in request handlers. A value less than 1 uses runtime.NumCPU(). Note
// that this setting does not constrain order of issue.
// Allows up to the specified number of goroutines to execute in parallel in
// request handlers. A value less than 1 uses runtime.NumCPU(). Note that
// this setting does not constrain order of issue.
Concurrency int

// If set, this function is called with the method name and encoded request
// parameters received from the client, before they are delivered to the
// handler. Its return value replaces the context and argument values. This
// allows the server to decode context metadata sent by the client.
// If unset, ctx and params are used as given.
// If unset, context and parameters are used as given.
DecodeContext func(context.Context, string, json.RawMessage) (context.Context, json.RawMessage, error)

// If set, this function is called with the context and client request
Expand All @@ -62,7 +63,8 @@ type ServerOptions struct {
Metrics *metrics.M

// If nonzero this value as the server start time; otherwise, use the
// current time when Start is called.
// current time when Start is called. All servers created from the same
// options will share the same start time if one is set.
StartTime time.Time
}

Expand Down Expand Up @@ -162,8 +164,8 @@ type ClientOptions struct {
// The function receives the client and the response that was cancelled.
// The hook can obtain the ID and error value from rsp.
//
// Note that the hook does not receive the client context, which has already
// ended by the time the hook is called.
// Note that the hook does not receive the request context, which has
// already ended by the time the hook is called.
OnCancel func(cli *Client, rsp *Response)
}

Expand Down

0 comments on commit d02d64d

Please sign in to comment.