Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Backend ¶
type Backend struct { // BackendID is a string that uniquely identifies a specific backend instance. BackendID string `json:"id,omitempty"` // BackendUser is the email address of the account the backend agent uses to authenticate. BackendUser string `json:"backendUser,omitempty"` // EndUser is the email address of the end user for whom requests should be // routed to this backend. To include all users use the literal string 'allUsers'. EndUser string `json:"endUser,omitempty"` // PathPrefixes are the list of path prefixes for which requests should // be routed to this backend. PathPrefixes []string `json:"pathPrefixes,omitempty"` // LastUsed encodes the timestamp for the last request that was received // for the backend. This is an output-only field and is automatically // populated based on the recorded requests. LastUsed string `json:"lastUsed,omitempty"` }
Backend represents a backend server that is allowed to process requests.
type Request ¶
type Request struct { BackendID string RequestID string User string Contents []byte StartTime time.Time Completed bool }
Request represents an end-user request that we forward.
func NewRequest ¶
NewRequest converts the given request information to our internal representation.
type Store ¶
type Store interface { // WriteRequest writes the given request to the Store. WriteRequest(ctx context.Context, r *Request) error // ReadRequest reads the specified request from the Store. ReadRequest(ctx context.Context, backendID, requestID string) (*Request, error) // ListPendingRequests returns the list of request IDs for the given backend // that do not yet have a stored response. ListPendingRequests(ctx context.Context, backendID string) ([]string, error) // WriteResponse writes the given response to the Store. WriteResponse(ctx context.Context, r *Response) error // ReadResponse reads from the Store the response to the specified request. // // If there is no response yet, then the returned value is nil. ReadResponse(ctx context.Context, backendID, requestID string) (*Response, error) // DeleteOldRequests deletes from the Store any backend records older than some threshold. DeleteOldBackends(ctx context.Context) error // DeleteOldRequests deletes from the Store any requests older than some threshold. DeleteOldRequests(ctx context.Context) error // AddBackend adds the definition of the backend to the store AddBackend(ctx context.Context, backend *Backend) error // ListBackends lists all of the backends. ListBackends(ctx context.Context) ([]*Backend, error) // DeleteBackend deletes the given backend. DeleteBackend(ctx context.Context, backendID string) error // LookupBackend looks up the backend for the given user and path. LookupBackend(ctx context.Context, endUser, path string) (string, error) // IsBackendUserAllowed checks whether the given user can act as the specified backend. IsBackendUserAllowed(ctx context.Context, backendUser, backendID string) (bool, error) }
Store defines the interface for reading and writing our internal metadata about requests, responses, and backends.
Click to show internal directories.
Click to hide internal directories.