Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type EndpointClient ¶
type EndpointClient struct {
// contains filtered or unexported fields
}
EndpointClient is a client for a Dispatch endpoint.
Note that this is not the same as dispatch.Client, which is a client for the Dispatch API. The client here is used by a Dispatch server to interact with the functions provided by a Dispatch endpoint.
func NewEndpointClient ¶
func NewEndpointClient(endpointUrl string, opts ...EndpointClientOption) (*EndpointClient, error)
NewEndpointClient creates an EndpointClient.
func (*EndpointClient) Run ¶
func (c *EndpointClient) Run(ctx context.Context, req dispatchproto.Request) (dispatchproto.Response, error)
Run sends a RunRequest and returns a RunResponse.
type EndpointClientOption ¶
type EndpointClientOption func(*EndpointClient)
EndpointClientOption configures an EndpointClient.
func ClientOptions ¶
func ClientOptions(opts ...connect.ClientOption) EndpointClientOption
ClientOptions adds options for the underlying connect (gRPC) client.
func HTTPClient ¶
func HTTPClient(client connect.HTTPClient) EndpointClientOption
HTTPClient sets the HTTP client to use when making requests to the endpoint.
By default http.DefaultClient is used.
func RequestHeaders ¶
func RequestHeaders(header http.Header) EndpointClientOption
RequestHeaders sets headers on the request to the endpoint.
func SigningKey ¶
func SigningKey(signingKey ed25519.PrivateKey) EndpointClientOption
SigningKey sets the signing key to use when signing requests bound for the endpoint.
By default the EndpointClient does not sign requests to the endpoint.
type Handler ¶
type Handler interface {
Handle(ctx context.Context, header http.Header, calls []dispatchproto.Call) ([]dispatchproto.ID, error)
}
Handler handles requests to a Dispatch API server.
func HandlerFunc ¶
func HandlerFunc(fn func(context.Context, http.Header, []dispatchproto.Call) ([]dispatchproto.ID, error)) Handler
HandlerFunc creates a Handler from a function.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server is a Dispatch API server.
func New ¶
func New(handler Handler, opts ...connect.HandlerOption) (*Server, error)
New creates a Server.