Documentation
¶
Overview ¶
Package postgres implements Knowl operational state and search projections with PostgreSQL-native transactions and full-text search.
Package postgres implements Knowl operational state and search projections with PostgreSQL-native transactions and full-text search.
Index ¶
- Variables
- type ProjectionState
- type Store
- func (store *Store) CheckProjection(ctx context.Context, snapshot knowl.WorkspaceSnapshot) error
- func (store *Store) ClaimReady(ctx context.Context, scope knowl.ScopeRef, lease knowl.WorkLease) (knowl.WorkClaim, error)
- func (store *Store) Close() error
- func (store *Store) CommitOutcome(ctx context.Context, id knowl.OperationID, commit knowl.ContentCommit) error
- func (store *Store) DSN() string
- func (store *Store) DescriptorFailures(ctx context.Context, scope knowl.ScopeRef, limit int) ([]knowl.OperationID, error)
- func (store *Store) Execution(ctx context.Context, scope knowl.ScopeRef, id knowl.OperationID) (knowl.ExecutionDescriptor, error)
- func (store *Store) Fail(ctx context.Context, id knowl.OperationID, failure knowl.Failure) error
- func (store *Store) Links(ctx context.Context, scope knowl.ScopeRef, page knowl.PageID, ...) ([]knowl.LinkReference, error)
- func (store *Store) MarkApplying(ctx context.Context, id knowl.OperationID, lease knowl.Lease) error
- func (store *Store) MarkAwaitingReview(ctx context.Context, id knowl.OperationID) error
- func (store *Store) Operation(ctx context.Context, scope knowl.ScopeRef, id knowl.OperationID) (knowl.Operation, error)
- func (store *Store) Project(ctx context.Context, commit knowl.ContentCommit) error
- func (store *Store) ProjectionStatus(ctx context.Context, scope knowl.ScopeRef) (ProjectionState, error)
- func (store *Store) Rebuild(ctx context.Context, snapshot knowl.WorkspaceSnapshot) error
- func (store *Store) ReleaseClaim(ctx context.Context, scope knowl.ScopeRef, id knowl.OperationID, token string) error
- func (store *Store) RenewClaim(ctx context.Context, scope knowl.ScopeRef, id knowl.OperationID, ...) error
- func (store *Store) Reserve(ctx context.Context, key knowl.OperationKey, meta knowl.OperationMeta) (app.OperationReservation, error)
- func (store *Store) ResumeReady(ctx context.Context, scope knowl.ScopeRef, limit int) ([]knowl.OperationID, error)
- func (store *Store) SavePlan(ctx context.Context, id knowl.OperationID, summary knowl.PlanSummary) error
- func (store *Store) Search(ctx context.Context, scope knowl.ScopeRef, query string, ...) ([]knowl.PageReference, error)
- func (store *Store) SelectContext(ctx context.Context, scope knowl.ScopeRef, source knowl.SourceSummary, ...) ([]knowl.PageID, error)
Constants ¶
This section is empty.
Variables ¶
var ( ErrConflict = errors.New("knowl operation conflict") ErrNotFound = app.ErrOperationNotFound ErrInvalidState = errors.New("knowl operation state transition is invalid") ErrLeaseConflict = app.ErrApplyLeaseConflict ErrInvalidQuery = errors.New("knowl search query is invalid") ErrProjectionNotReady = errors.New("knowl projection is not ready") ErrProjectionDrift = errors.New("knowl projection drift detected") )
Functions ¶
This section is empty.
Types ¶
type ProjectionState ¶
type ProjectionState struct {
Scope knowl.ScopeRef
SchemaDigest string
SnapshotDigest string
PageCount int
LinkCount int
ReadyAt time.Time
}
ProjectionState describes the last canonical snapshot projected for a scope.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store implements app.OperationStore and app.SearchIndex.
func (*Store) CheckProjection ¶
CheckProjection verifies that a projection represents the supplied snapshot.
func (*Store) ClaimReady ¶
func (store *Store) ClaimReady(ctx context.Context, scope knowl.ScopeRef, lease knowl.WorkLease) (knowl.WorkClaim, error)
ClaimReady atomically grants a work lease using database-level row locking.
func (*Store) CommitOutcome ¶
func (store *Store) CommitOutcome(ctx context.Context, id knowl.OperationID, commit knowl.ContentCommit) error
CommitOutcome marks a canonical content commit as complete.
func (*Store) DescriptorFailures ¶
func (store *Store) DescriptorFailures(ctx context.Context, scope knowl.ScopeRef, limit int) ([]knowl.OperationID, error)
DescriptorFailures lists non-terminal operations whose durable inputs cannot be validated.
func (*Store) Execution ¶
func (store *Store) Execution(ctx context.Context, scope knowl.ScopeRef, id knowl.OperationID) (knowl.ExecutionDescriptor, error)
Execution returns the validated durable descriptor for one scoped operation.
func (*Store) Links ¶
func (store *Store) Links(ctx context.Context, scope knowl.ScopeRef, page knowl.PageID, limits knowl.ReadLimits) ([]knowl.LinkReference, error)
Links returns bounded, untrusted graph references.
func (*Store) MarkApplying ¶
func (store *Store) MarkApplying(ctx context.Context, id knowl.OperationID, lease knowl.Lease) error
MarkApplying claims an operation with a lease.
func (*Store) MarkAwaitingReview ¶
MarkAwaitingReview marks an operation that needs explicit apply.
func (*Store) Operation ¶
func (store *Store) Operation(ctx context.Context, scope knowl.ScopeRef, id knowl.OperationID) (knowl.Operation, error)
Operation reads one operation within its scope.
func (*Store) ProjectionStatus ¶
func (store *Store) ProjectionStatus(ctx context.Context, scope knowl.ScopeRef) (ProjectionState, error)
ProjectionStatus returns readiness metadata for a scope.
func (*Store) ReleaseClaim ¶
func (store *Store) ReleaseClaim(ctx context.Context, scope knowl.ScopeRef, id knowl.OperationID, token string) error
ReleaseClaim makes owned non-terminal work immediately ready again.
func (*Store) RenewClaim ¶
func (store *Store) RenewClaim(ctx context.Context, scope knowl.ScopeRef, id knowl.OperationID, currentToken string, next knowl.WorkLease) error
RenewClaim replaces a live work lease when the caller still owns its token.
func (*Store) Reserve ¶
func (store *Store) Reserve(ctx context.Context, key knowl.OperationKey, meta knowl.OperationMeta) (app.OperationReservation, error)
Reserve creates or returns the operation for one source revision.
func (*Store) ResumeReady ¶
func (store *Store) ResumeReady(ctx context.Context, scope knowl.ScopeRef, limit int) ([]knowl.OperationID, error)
ResumeReady lists bounded claimable operation IDs without granting ownership.
func (*Store) SavePlan ¶
func (store *Store) SavePlan(ctx context.Context, id knowl.OperationID, summary knowl.PlanSummary) error
SavePlan persists a redacted plan digest and advances the operation.
func (*Store) Search ¶
func (store *Store) Search(ctx context.Context, scope knowl.ScopeRef, query string, limits knowl.ReadLimits) ([]knowl.PageReference, error)
Search returns bounded, untrusted PostgreSQL full-text references.
func (*Store) SelectContext ¶
func (store *Store) SelectContext(ctx context.Context, scope knowl.ScopeRef, source knowl.SourceSummary, limits knowl.ReadLimits) ([]knowl.PageID, error)
SelectContext returns source-relevant pages, one-hop context, the required index control page, and only then deterministic recent fallback pages.