proofobservations

package
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 16, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package proofobservations persists the backend-owned Proof observation ledger.

Index

Constants

This section is empty.

Variables

View Source
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 Budget

type Budget struct{ ActiveJobs, Requests, Bytes, Rows, Cost int64 }

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

type JobReference struct {
	Slug          slug.Slug
	RequestDigest string
}

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

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) Cancel

func (*Repository) Cancel(ctx context.Context, db postgres.DBTX, org, job slug.Slug) 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) DisablePolicy(ctx context.Context, db postgres.DBTX, orgID int32, environmentID int64) error

func (*Repository) Expire

func (*Repository) Expire(ctx context.Context, db postgres.DBTX, orgID int32, environmentID int64) ([]JobReference, error)

func (*Repository) Find

func (*Repository) Find(ctx context.Context, db postgres.DBTX, org, job slug.Slug) (*Job, error)

func (*Repository) FindScoped

func (*Repository) FindScoped(ctx context.Context, db postgres.DBTX, scope Scope, job slug.Slug) (*Job, error)

func (*Repository) FindSlugByDigest

func (*Repository) FindSlugByDigest(ctx context.Context, db postgres.DBTX, org slug.Slug, digest string) (slug.Slug, error)

func (*Repository) Finish

func (*Repository) Finish(ctx context.Context, db postgres.DBTX, job *Job, result proofevidence.Result, snapshot []byte) (bool, error)

func (*Repository) FinishInterrupted

func (*Repository) FinishInterrupted(ctx context.Context, db postgres.DBTX, job *Job) (bool, error)

func (*Repository) IsActive

func (*Repository) IsActive(ctx context.Context, db postgres.DBTX, job *Job) (bool, error)

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) LockPolicy(ctx context.Context, db postgres.DBTX, scope Scope) (*Policy, error)

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

func (*Repository) SavePolicy(ctx context.Context, db postgres.DBTX, scope Scope, policy proofevidence.Policy, identity string) (*Policy, error)

func (*Repository) Start

func (*Repository) Start(ctx context.Context, db postgres.DBTX, job *Job) (bool, error)

type Scope

type Scope struct{ Organization, Project, Environment slug.Slug }

type State

type State int
const (
	StateUnknown  State = iota // unknown
	StatePending               // pending
	StateRunning               // running
	StateFinished              // finished
)

func StateString

func StateString(s string) (State, error)

StateString retrieves an enum value from the enum constants string name. Throws an error if the param is not part of the enum.

func StateValues

func StateValues() []State

StateValues returns all values of the enum

func (State) IsAState

func (i State) IsAState() bool

IsAState returns "true" if the value is listed in the enum definition. "false" otherwise

func (State) MarshalJSON

func (i State) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface for State

func (State) MarshalText

func (i State) MarshalText() ([]byte, error)

MarshalText implements the encoding.TextMarshaler interface for State

func (State) String

func (i State) String() string

func (*State) UnmarshalJSON

func (i *State) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface for State

func (*State) UnmarshalText

func (i *State) UnmarshalText(text []byte) error

UnmarshalText implements the encoding.TextUnmarshaler interface for State

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL