Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Authenticator ¶
type Authenticator interface {
// Redirect to configured authentication provider.
Login(w http.ResponseWriter, r *http.Request)
// Clear any logout state.
Logout(w http.ResponseWriter, r *http.Request)
// Handle a callback from authentication provider.
Auth(w http.ResponseWriter, r *http.Request)
// Called by the authentication handler to authenticate a request. If a
// user was authenticated, a new context will be returned that contains
// a UserToken.
AuthenticateHTTPRequest(w http.ResponseWriter, r *http.Request) context.Context
// Called by the authentication handler to authenticate a request. If a
// user was authenticated, a new context will be returned that contains
// a BasicAuthToken.
AuthenticateGRPCRequest(ctx context.Context) context.Context
// Returns the UserToken extracted from any authorization headers
// present in the request. This does not guarantee the user has been
// registered -- it only indicates they were authenticated using some
// auth provider.
//
// To check if a user is registered, use UserDB!
GetUserToken(ctx context.Context) (UserToken, error)
// Returns the BasicAuthToken extracted from any user/password set on
// the RPC request. This does not guarantee the user has been
// registered -- it only indicates they were authenticated using the
// BASIC auth provider.
//
// To check if a user or group registered, use UserDB!
GetBasicAuthToken(ctx context.Context) (BasicAuthToken, error)
// FillUser may be used to construct an initial tables.User object. It
// is filled based on information from the authenticator's JWT.
FillUser(ctx context.Context, user *tables.User) error
}
type BasicAuthToken ¶
An interface representing the user info gleaned from http basic auth, which is often set for GRPC requests.
type Blobstore ¶
type Blobstore interface {
BlobExists(ctx context.Context, blobName string) (bool, error)
ReadBlob(ctx context.Context, blobName string) ([]byte, error)
WriteBlob(ctx context.Context, blobName string, data []byte) (int, error)
DeleteBlob(ctx context.Context, blobName string) error
}
A Blobstore must allow for reading, writing, and deleting blobs. Implementations should return "os"-compatible package type errors, for example, if a file does not exist on Read, the blobstore should return an "os.ErrNotExist" error.
type Cache ¶
type Cache interface {
// Normal cache-like operations.
Contains(ctx context.Context, key string) (bool, error)
Get(ctx context.Context, key string) ([]byte, error)
Set(ctx context.Context, key string, data []byte) error
Delete(ctx context.Context, key string) error
// Low level interface used for seeking and stream-writing.
Reader(ctx context.Context, key string, offset, length int64) (io.Reader, error)
Writer(ctx context.Context, key string) (io.WriteCloser, error)
// Begin garbage collection and any other necessary background tasks.
Start() error
// Stop garbage collection etc.
Stop() error
}
Similar to a blobstore, a cache allows for reading and writing data, but additionally it is responsible for deleting data that is past TTL to keep to a manageable size.
type InvocationDB ¶
type InvocationDB interface {
// Invocations API
InsertOrUpdateInvocation(ctx context.Context, in *tables.Invocation) error
LookupInvocation(ctx context.Context, invocationID string) (*tables.Invocation, error)
LookupExpiredInvocations(ctx context.Context, cutoffTime time.Time, limit int) ([]*tables.Invocation, error)
DeleteInvocation(ctx context.Context, invocationID string) error
}
type InvocationSearchService ¶
type InvocationSearchService interface {
IndexInvocation(ctx context.Context, invocation *inpb.Invocation) error
QueryInvocations(ctx context.Context, req *inpb.SearchInvocationRequest) (*inpb.SearchInvocationResponse, error)
}
Allows searching invocations.
type InvocationStatService ¶
type InvocationStatService interface {
GetInvocationStat(ctx context.Context, req *inpb.GetInvocationStatRequest) (*inpb.GetInvocationStatResponse, error)
}
Allows aggregating invocation statistics.
type SplashPrinter ¶
type SplashPrinter interface {
PrintSplashScreen(port, grpcPort int)
}
type UserDB ¶
type UserDB interface {
// User API
InsertUser(ctx context.Context, u *tables.User) error
// GetUser will return the registered user's information or
// an error if no registered user was found. It requires that a
// valid authenticator is present in the environment and will return
// a UserToken given the provided context.
GetUser(ctx context.Context) (*tables.User, error)
DeleteUser(ctx context.Context, userID string) error
// Creates the DEFAULT group, for on-prem usage where there is only
// one group and all users are implicitly a part of it.
CreateDefaultGroup(ctx context.Context) error
// Groups API
InsertOrUpdateGroup(ctx context.Context, g *tables.Group) error
GetBasicAuthGroup(ctx context.Context) (*tables.Group, error)
DeleteGroup(ctx context.Context, groupID string) error
}
Click to show internal directories.
Click to hide internal directories.