Documentation
¶
Overview ¶
Package proofobservations persists the backend-owned Proof observation ledger.
Index ¶
- Variables
- func StateStrings() []string
- type Budget
- type Job
- type JobReference
- type MaintenanceScope
- type Policy
- type Repository
- func (*Repository) Activity(ctx context.Context, db postgres.DBTX) (proofevidence.ActivitySnapshot, error)
- func (*Repository) Budget(ctx context.Context, db postgres.DBTX, policy *Policy, ...) (Budget, error)
- func (*Repository) Cancel(ctx context.Context, db postgres.DBTX, org, job slug.Slug) error
- func (*Repository) CancelObsolete(ctx context.Context, db postgres.DBTX, orgID int32, environmentID int64) ([]JobReference, error)
- func (*Repository) Create(ctx context.Context, db postgres.DBTX, policy *Policy, ...) (*Job, error)
- func (*Repository) DeleteExpired(ctx context.Context, db postgres.DBTX, orgID int32, environmentID int64) ([]JobReference, error)
- func (*Repository) DisablePolicy(ctx context.Context, db postgres.DBTX, orgID int32, environmentID int64) error
- func (*Repository) Expire(ctx context.Context, db postgres.DBTX, orgID int32, environmentID int64) ([]JobReference, error)
- func (*Repository) Find(ctx context.Context, db postgres.DBTX, org, job slug.Slug) (*Job, error)
- func (*Repository) FindScoped(ctx context.Context, db postgres.DBTX, scope Scope, job slug.Slug) (*Job, error)
- func (*Repository) FindSlugByDigest(ctx context.Context, db postgres.DBTX, org slug.Slug, digest string) (slug.Slug, error)
- func (*Repository) Finish(ctx context.Context, db postgres.DBTX, job *Job, result proofevidence.Result, ...) (bool, error)
- func (*Repository) FinishInterrupted(ctx context.Context, db postgres.DBTX, job *Job) (bool, error)
- func (*Repository) IsActive(ctx context.Context, db postgres.DBTX, job *Job) (bool, error)
- func (*Repository) ListMaintenanceScopes(ctx context.Context, db postgres.DBTX, after MaintenanceScope) ([]MaintenanceScope, error)
- func (*Repository) LockMaintenanceScope(ctx context.Context, db postgres.DBTX, scope Scope) (*MaintenanceScope, error)
- func (*Repository) LockPolicy(ctx context.Context, db postgres.DBTX, scope Scope) (*Policy, error)
- func (*Repository) LockPolicyForCleanup(ctx context.Context, db postgres.DBTX, scope Scope) (*Policy, error)
- func (*Repository) MaintenanceHealth(ctx context.Context, db postgres.DBTX) (model.ProofMaintenanceHealth, error)
- func (*Repository) PurgeSnapshots(ctx context.Context, db postgres.DBTX, orgID int32, environmentID int64) ([]JobReference, error)
- func (*Repository) SavePolicy(ctx context.Context, db postgres.DBTX, scope Scope, ...) (*Policy, error)
- func (*Repository) Start(ctx context.Context, db postgres.DBTX, job *Job) (bool, error)
- type Scope
- type State
Constants ¶
This section is empty.
Variables ¶
var ErrNotFound = xerror.NotFound(xerror.Pipeline).Detail("Proof observation was not found")
Functions ¶
func StateStrings ¶
func StateStrings() []string
StateStrings returns a slice of all String values of the enum
Types ¶
type Job ¶
type Job struct {
CancellationRequested bool
Slug slug.Slug
State State
RequestDigest string
Request proofevidence.Request
Authorization proofevidence.Authorization
TargetCiphertext, SnapshotCiphertext []byte
Deadline, StartedAt time.Time
Result proofevidence.Result
}
type JobReference ¶
JobReference identifies a retention mutation without returning protected payloads.
type MaintenanceScope ¶
type MaintenanceScope struct {
Scope
OrganizationID int32
ProjectEnvironmentID int64
Disabled bool
}
MaintenanceScope identifies retained state even after its environment is disabled.
type Policy ¶
type Policy struct {
OrganizationID int32
ProjectID, ProjectEnvironmentID int64
WorkerIdentity string
Value proofevidence.Policy
}
type Repository ¶
type Repository struct{}
func New ¶
func New() *Repository
func (*Repository) Activity ¶
func (*Repository) Activity(ctx context.Context, db postgres.DBTX) (proofevidence.ActivitySnapshot, error)
Activity returns bounded platform aggregates, without job or provider identifiers.
func (*Repository) Budget ¶
func (*Repository) Budget(ctx context.Context, db postgres.DBTX, policy *Policy, request proofevidence.Request) (Budget, error)
func (*Repository) CancelObsolete ¶
func (*Repository) CancelObsolete(ctx context.Context, db postgres.DBTX, orgID int32, environmentID int64) ([]JobReference, error)
func (*Repository) Create ¶
func (*Repository) Create(ctx context.Context, db postgres.DBTX, policy *Policy, request proofevidence.Request, authorization proofevidence.Authorization, ciphertext []byte, deadline time.Time) (*Job, error)
func (*Repository) DeleteExpired ¶
func (*Repository) DeleteExpired(ctx context.Context, db postgres.DBTX, orgID int32, environmentID int64) ([]JobReference, error)
func (*Repository) DisablePolicy ¶
func (*Repository) Expire ¶
func (*Repository) Expire(ctx context.Context, db postgres.DBTX, orgID int32, environmentID int64) ([]JobReference, error)
func (*Repository) FindScoped ¶
func (*Repository) FindSlugByDigest ¶
func (*Repository) FinishInterrupted ¶
func (*Repository) ListMaintenanceScopes ¶
func (*Repository) ListMaintenanceScopes(ctx context.Context, db postgres.DBTX, after MaintenanceScope) ([]MaintenanceScope, error)
func (*Repository) LockMaintenanceScope ¶
func (*Repository) LockMaintenanceScope(ctx context.Context, db postgres.DBTX, scope Scope) (*MaintenanceScope, error)
func (*Repository) LockPolicy ¶
func (*Repository) LockPolicyForCleanup ¶
func (*Repository) LockPolicyForCleanup(ctx context.Context, db postgres.DBTX, scope Scope) (*Policy, error)
LockPolicyForCleanup includes deleted environments so deletion cannot prevent retention enforcement.
func (*Repository) MaintenanceHealth ¶
func (*Repository) MaintenanceHealth(ctx context.Context, db postgres.DBTX) (model.ProofMaintenanceHealth, error)
MaintenanceHealth is an operator aggregate, not a tenant-scoped data-access path.
func (*Repository) PurgeSnapshots ¶
func (*Repository) PurgeSnapshots(ctx context.Context, db postgres.DBTX, orgID int32, environmentID int64) ([]JobReference, error)
func (*Repository) SavePolicy ¶
type State ¶
type State int
func StateString ¶
StateString retrieves an enum value from the enum constants string name. Throws an error if the param is not part of the enum.
func (State) IsAState ¶
IsAState returns "true" if the value is listed in the enum definition. "false" otherwise
func (State) MarshalJSON ¶
MarshalJSON implements the json.Marshaler interface for State
func (State) MarshalText ¶
MarshalText implements the encoding.TextMarshaler interface for State
func (*State) UnmarshalJSON ¶
UnmarshalJSON implements the json.Unmarshaler interface for State
func (*State) UnmarshalText ¶
UnmarshalText implements the encoding.TextUnmarshaler interface for State