Documentation
¶
Index ¶
- Constants
- Variables
- func RegisterTyped[I any, O any](r *Registry, provider string, d Definition, ...) error
- func ValidateSourceInvalidation(sourceID, key string) error
- type AuditFunc
- type Authorizer
- type Config
- type Definition
- type Executor
- type Handler
- type Invocation
- type Prepared
- type Progress
- type ProviderBatch
- type ProviderEnabled
- type Registration
- type Registry
- func (r *Registry) Freeze()
- func (r *Registry) Owns(provider, id string, version uint) bool
- func (r *Registry) RegisterBatch(provider string, batch []Registration) error
- func (r *Registry) RegisterBatches(batches []ProviderBatch) error
- func (r *Registry) Snapshot(enabled ...ProviderEnabled) []Definition
- type Request
- type Result
- type SafeError
- type SessionAuthorizer
- type StatusRequest
- type Submission
Constants ¶
const ( MaxInputBytes = 64 << 10 MaxOutputBytes = 64 << 10 MaxJSONDepth = 16 DefaultTimeout = 30 * time.Second MaxTimeout = 15 * time.Minute )
Variables ¶
var ( ErrAuthorizationLost = errors.New("admin session authorization lost") ErrOperationForbidden = errors.New("operation forbidden") )
var ErrBusy = &SafeError{Code: "unavailable", Message: "operation capacity exhausted", Retryable: true}
var ErrConflict = &SafeError{Code: "idempotency_conflict", Message: "idempotency key was used with different input"}
var ErrInvalidSourceInvalidation = errors.New("invalid admin UI source invalidation")
var ErrInvalidationUnsupported = errors.New("operation source invalidation is not supported")
var ErrProgressUnsupported = errors.New("operation progress is not supported")
Functions ¶
func RegisterTyped ¶
func ValidateSourceInvalidation ¶
ValidateSourceInvalidation performs the deterministic validation handlers must run before committing a mutation that will emit an invalidation.
Types ¶
type Authorizer ¶
type Authorizer struct {
Sessions interface {
RevalidateSession(context.Context, string) (*auth.IdentityAuthentication, error)
}
Registry *auth.Registry
}
func (Authorizer) AuthorizeOperation ¶
func (a Authorizer) AuthorizeOperation(ctx context.Context, session, permission string) (*auth.IdentityAuthentication, error)
type Definition ¶
type Executor ¶
type Executor struct {
// contains filtered or unexported fields
}
func NewExecutor ¶
func NewExecutor(c Config, r *Registry, repo storage.OperationRepository, a SessionAuthorizer) (*Executor, error)
func (*Executor) DroppedAudits ¶
DroppedAudits reports overload in the bounded non-authoritative audit queue.
func (*Executor) Status ¶
func (e *Executor) Status(ctx context.Context, q StatusRequest) (*storage.OperationRecord, error)
type Handler ¶
type Handler func(context.Context, Invocation) (json.RawMessage, error)
type Invocation ¶
type Invocation struct {
ExecutionID, PrincipalID, SessionID, OperationID string
MutationID string
Version uint
Input json.RawMessage
// contains filtered or unexported fields
}
func (Invocation) InvalidateSource ¶
func (i Invocation) InvalidateSource(sourceID, key string) error
InvalidateSource publishes a trusted-provider source invalidation. The provider is fixed by the operation registration and cannot be supplied by a handler.
func (Invocation) ReportProgress ¶
func (i Invocation) ReportProgress(ctx context.Context, progress Progress) error
type ProviderBatch ¶
type ProviderBatch struct {
Provider string
Registrations []Registration
}
type ProviderEnabled ¶
type Registration ¶
type Registration struct {
Definition Definition
Handler Handler
}
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
func NewRegistry ¶
func (*Registry) Owns ¶
Owns reports whether the exact operation ID and version belong to provider. Provider identity is trusted registry metadata and is never inferred from ID.
func (*Registry) RegisterBatch ¶
func (r *Registry) RegisterBatch(provider string, batch []Registration) error
func (*Registry) RegisterBatches ¶
func (r *Registry) RegisterBatches(batches []ProviderBatch) error
func (*Registry) Snapshot ¶
func (r *Registry) Snapshot(enabled ...ProviderEnabled) []Definition
type Result ¶
type Result struct {
Record *storage.OperationRecord
Replayed bool
AuthorizationLost bool
Err error
}
type SessionAuthorizer ¶
type StatusRequest ¶
type Submission ¶
type Submission struct {
// contains filtered or unexported fields
}
func (*Submission) Done ¶
func (s *Submission) Done() <-chan Result
func (*Submission) Progress ¶
func (s *Submission) Progress() <-chan storage.OperationProgress
func (*Submission) Record ¶
func (s *Submission) Record() *storage.OperationRecord
func (*Submission) Replayed ¶
func (s *Submission) Replayed() bool
func (*Submission) Start ¶
func (s *Submission) Start()