Documentation ¶
Overview ¶
Package endpoints contains all request handler functions for Splice. Individual handlers are separated into their own files for readability.
Index ¶
- func ProcessRequest(ctx context.Context, w http.ResponseWriter, r *http.Request, ...) models.Response
- func ProcessResult(w http.ResponseWriter, r *http.Request) *models.Response
- type AttendedRequestHandler
- type Client
- func (c *Client) Close() error
- func (c *Client) CommitTx() error
- func (c *Client) Find(ctx context.Context, reqID string) (server.StatusCode, error)
- func (c *Client) FindOrphans(ctx context.Context, olderThan time.Duration, kind string) ([]*datastore.Key, []models.Request, error)
- func (c *Client) RollbackTx() error
- func (c *Client) Save(ctx context.Context) (server.StatusCode, error)
- func (c *Client) StartTx(ctx context.Context) error
- type ResultHandler
- type UnattendedRequestHandler
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ProcessRequest ¶
func ProcessRequest(ctx context.Context, w http.ResponseWriter, r *http.Request, checks []basic.Validator) models.Response
ProcessRequest takes a models.Request that is provided by the client, and validates it. A response is provided using models.Response.
func ProcessResult ¶
ProcessResult requires a models.Status with a ClientID and a RequestID. It retrieves the current status of the request and provides a response to the client. If the request is ready to be returned, it finalizes the request and returns the join data as part of the response. If a request has become orphaned, it will release the request so that another splice joiner can claim it. Errors are returned in the context of models.Response.
Types ¶
type AttendedRequestHandler ¶
type AttendedRequestHandler struct{}
AttendedRequestHandler implements http.Handler for user interactive joins.
func (AttendedRequestHandler) ServeHTTP ¶
func (ah AttendedRequestHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
type Client ¶
type Client struct { Keys []*datastore.Key Req *models.Request // contains filtered or unexported fields }
Client is a datastore client that includes transaction relevant metadata.
func (*Client) CommitTx ¶
CommitTx finalizes and commits an existing transaction to the datastore. It must be called after StartTx. Other datastore actions such as Save and Find must take place prior to calling CommitTx.
func (*Client) Find ¶
Find searches for a previously committed request using the Request ID. Not Found is returned as a status code with a nil error.
func (*Client) FindOrphans ¶
func (c *Client) FindOrphans(ctx context.Context, olderThan time.Duration, kind string) ([]*datastore.Key, []models.Request, error)
FindOrphans searches for requests that need to be cleaned up or were never processed.
func (*Client) RollbackTx ¶
RollbackTx rolls back an in-flight transaction. It is typically used to ensure transaction cleanups when a processing error has occurred during processing.
func (*Client) Save ¶
Save commits a request to the datastore. An int identifying the status is always returned to be passed to the Splice client.
type ResultHandler ¶
ResultHandler is a custom http handler that services domain join result status queries coming in from splice clients.
func (ResultHandler) ServeHTTP ¶
func (rh ResultHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP implements http.Handler and handles errors returned from ResultHandler.
type UnattendedRequestHandler ¶
type UnattendedRequestHandler struct{}
UnattendedRequestHandler implements http.Handler for unattended joins.
func (UnattendedRequestHandler) ServeHTTP ¶
func (uh UnattendedRequestHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)