Documentation
¶
Overview ¶
Package postgres implements the authoritative ledger. The caller owns the pool.
Index ¶
- type AESGCM
- type Cipher
- type ExtractionInventoryBackfill
- type Ledger
- func (l *Ledger) AbandonRebuild(ctx context.Context, k model.GenerationKey, a model.RebuildActor, fence int64) (model.RebuildStatus, error)
- func (l *Ledger) AcknowledgeDelivery(ctx context.Context, d model.Delivery) error
- func (l *Ledger) ActivateRebuild(ctx context.Context, k model.GenerationKey, a model.RebuildActor, ...) (model.RebuildStatus, error)
- func (l *Ledger) ActiveProjection(ctx context.Context, tenant string) (model.ActiveProjection, error)
- func (l *Ledger) ArchivePayload(ctx context.Context, d model.Delivery) (model.ArchivePayload, error)
- func (l *Ledger) BackfillExtractionInputInventories(ctx context.Context, tenant string, limit int) (result ExtractionInventoryBackfill, err error)
- func (l *Ledger) ClaimDelivery(ctx context.Context, k model.ConsumerKey, lease time.Duration) (model.Delivery, error)
- func (l *Ledger) ConsumerStatus(ctx context.Context, k model.ConsumerKey) (model.ConsumerStatus, error)
- func (l *Ledger) FailDelivery(ctx context.Context, d model.Delivery, backoff time.Duration) error
- func (l *Ledger) FinishActivation(ctx context.Context, k model.GenerationKey, a model.RebuildActor, fence int64) (model.RebuildStatus, error)
- func (l *Ledger) FinishResume(ctx context.Context, k model.GenerationKey, a model.RebuildActor, fence int64) (model.RebuildStatus, error)
- func (l *Ledger) FreezeRebuild(ctx context.Context, k model.GenerationKey, a model.RebuildActor) (model.RebuildStatus, error)
- func (l *Ledger) ProjectionCleanupStatus(ctx context.Context, k model.ProjectionCleanupKey) (model.ProjectionCleanupStatus, error)
- func (l *Ledger) ProjectionDestinationInventory(ctx context.Context, tenant string) (model.ProjectionDestinationInventory, error)
- func (l *Ledger) ProjectionDocument(ctx context.Context, d model.Delivery, generation string) (*model.ProjectionDocument, error)
- func (l *Ledger) ProjectionDocumentPage(ctx context.Context, k model.GenerationKey, fence, through int64, ...) (model.ProjectionPage, error)
- func (l *Ledger) ProjectionDocuments(ctx context.Context, k model.GenerationKey, through int64) ([]model.ProjectionDocument, error)
- func (l *Ledger) ReadOutboxProgress(ctx context.Context, key model.ConsumerKey) (model.OutboxProgress, error)
- func (l *Ledger) RebuildStatus(ctx context.Context, k model.GenerationKey) (model.RebuildStatus, error)
- func (l *Ledger) RegisterConsumer(ctx context.Context, k model.ConsumerKey, maxAttempts int) error
- func (l *Ledger) RegisterProjectionDestination(ctx context.Context, k model.GenerationKey) error
- func (l *Ledger) RenewDelivery(ctx context.Context, d model.Delivery, lease time.Duration) error
- func (l *Ledger) ResumeRebuild(ctx context.Context, k model.GenerationKey, a model.RebuildActor, fence int64) (model.RebuildStatus, error)
- func (l *Ledger) RetentionDomain(ctx context.Context) (string, error)
- func (l *Ledger) RetryConsumer(ctx context.Context, k model.ConsumerKey, failedFence int64) error
- func (l *Ledger) ScanProjectionCleanup(ctx context.Context, r model.ProjectionCleanupQuery) ([]model.ProjectionCleanupRequest, error)
- func (l *Ledger) StartRebuild(ctx context.Context, k model.GenerationKey, a model.RebuildActor, ...) (model.RebuildStatus, error)
- func (l *Ledger) Transact(ctx context.Context, tenant string, fn func(model.Tx) error) error
- func (l *Ledger) VerifyRebuild(ctx context.Context, k model.GenerationKey, a model.RebuildActor, fence int64, ...) (model.RebuildStatus, error)
- type Option
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cipher ¶
type Cipher interface {
Seal(tenant string, plaintext []byte) ([]byte, error)
Open(tenant string, ciphertext []byte) ([]byte, error)
}
Cipher encrypts retained payloads. Production implementations should use envelope encryption and operator-managed versioned keys; destroying one shared key is not selective retention.
type ExtractionInventoryBackfill ¶
ExtractionInventoryBackfill reports a committed page. Complete means no missing inventory receipts were observed in that tenant at the final query; it is not authorization for disposal or verification of all retained copies.
type Ledger ¶
type Ledger struct {
// contains filtered or unexported fields
}
func (*Ledger) AbandonRebuild ¶
func (l *Ledger) AbandonRebuild(ctx context.Context, k model.GenerationKey, a model.RebuildActor, fence int64) (model.RebuildStatus, error)
func (*Ledger) AcknowledgeDelivery ¶
func (*Ledger) ActivateRebuild ¶
func (l *Ledger) ActivateRebuild(ctx context.Context, k model.GenerationKey, a model.RebuildActor, verifiedFence int64) (model.RebuildStatus, error)
func (*Ledger) ActiveProjection ¶
func (*Ledger) ArchivePayload ¶
func (l *Ledger) ArchivePayload(ctx context.Context, d model.Delivery) (model.ArchivePayload, error)
ArchivePayload retains the full event and immutable referenced artifacts. Missing classes are explicit gaps; this is not a complete database backup.
func (*Ledger) BackfillExtractionInputInventories ¶
func (l *Ledger) BackfillExtractionInputInventories(ctx context.Context, tenant string, limit int) (result ExtractionInventoryBackfill, err error)
BackfillExtractionInputInventories is a host-authorized maintenance operation, not an engine command or public RPC. Upgrade and stop legacy extraction writers first. The host owns tenant authorization, pool credentials and decryption keys. Each call processes at most limit attempts (1..100) and 64 MiB of ciphertext. It never rewrites an attempt or a completed inventory. Malformed input, missing source content, or partial inventory rows fail the entire page atomically. Repeating calls drains missing receipts without requiring a persistent cursor.
func (*Ledger) ClaimDelivery ¶
func (*Ledger) ConsumerStatus ¶
func (l *Ledger) ConsumerStatus(ctx context.Context, k model.ConsumerKey) (model.ConsumerStatus, error)
func (*Ledger) FailDelivery ¶
func (*Ledger) FinishActivation ¶
func (l *Ledger) FinishActivation(ctx context.Context, k model.GenerationKey, a model.RebuildActor, fence int64) (model.RebuildStatus, error)
func (*Ledger) FinishResume ¶
func (l *Ledger) FinishResume(ctx context.Context, k model.GenerationKey, a model.RebuildActor, fence int64) (model.RebuildStatus, error)
func (*Ledger) FreezeRebuild ¶
func (l *Ledger) FreezeRebuild(ctx context.Context, k model.GenerationKey, a model.RebuildActor) (model.RebuildStatus, error)
func (*Ledger) ProjectionCleanupStatus ¶
func (l *Ledger) ProjectionCleanupStatus(ctx context.Context, k model.ProjectionCleanupKey) (model.ProjectionCleanupStatus, error)
func (*Ledger) ProjectionDestinationInventory ¶
func (*Ledger) ProjectionDocument ¶
func (l *Ledger) ProjectionDocument(ctx context.Context, d model.Delivery, generation string) (*model.ProjectionDocument, error)
ProjectionDocument resolves immutable content at the acceptance event's revision, even when a delayed delivery follows a later correction.
func (*Ledger) ProjectionDocumentPage ¶
func (l *Ledger) ProjectionDocumentPage(ctx context.Context, k model.GenerationKey, fence, through int64, after model.ProjectionCursor, limit int) (model.ProjectionPage, error)
func (*Ledger) ProjectionDocuments ¶
func (l *Ledger) ProjectionDocuments(ctx context.Context, k model.GenerationKey, through int64) ([]model.ProjectionDocument, error)
ProjectionDocuments is a bounded exhaustive acceptance inventory, pinned to the frozen source revision. Immutable versions remain stable across reads.
func (*Ledger) ReadOutboxProgress ¶
func (l *Ledger) ReadOutboxProgress(ctx context.Context, key model.ConsumerKey) (model.OutboxProgress, error)
func (*Ledger) RebuildStatus ¶
func (l *Ledger) RebuildStatus(ctx context.Context, k model.GenerationKey) (model.RebuildStatus, error)
func (*Ledger) RegisterConsumer ¶
func (*Ledger) RegisterProjectionDestination ¶
func (*Ledger) RenewDelivery ¶
func (*Ledger) ResumeRebuild ¶
func (l *Ledger) ResumeRebuild(ctx context.Context, k model.GenerationKey, a model.RebuildActor, fence int64) (model.RebuildStatus, error)
func (*Ledger) RetentionDomain ¶
func (*Ledger) RetryConsumer ¶
RetryConsumer is a trusted operator command, fenced against a specific failure. Its immutable receipt makes retries safe after a lost response.
func (*Ledger) ScanProjectionCleanup ¶
func (l *Ledger) ScanProjectionCleanup(ctx context.Context, r model.ProjectionCleanupQuery) ([]model.ProjectionCleanupRequest, error)
func (*Ledger) StartRebuild ¶
func (l *Ledger) StartRebuild(ctx context.Context, k model.GenerationKey, a model.RebuildActor, maxAttempts int) (model.RebuildStatus, error)
func (*Ledger) VerifyRebuild ¶
func (l *Ledger) VerifyRebuild(ctx context.Context, k model.GenerationKey, a model.RebuildActor, fence int64, check model.ProjectionCheck) (model.RebuildStatus, error)
type Option ¶
type Option func(*options)
Option configures New.
func WithSchema ¶
WithSchema names the PostgreSQL schema that holds the ledger tables. The default is "public". With this option the pool's search_path must resolve to the same schema, because runtime queries use unqualified table names; without it New behaves as before and checks public only.
Source Files
¶
- archive.go
- attestation_disposal.go
- audit.go
- audit_entries.go
- calculation_disposal.go
- cipher.go
- confirmation.go
- context.go
- context_disposal.go
- conversation.go
- conversation_disposal.go
- decision_disposal.go
- disposal_batch.go
- extraction.go
- extraction_disposal.go
- extraction_inventory.go
- extraction_inventory_backfill.go
- extraction_runs.go
- history_pages.go
- identities.go
- ledger.go
- memory.go
- memory_attestations.go
- memory_lifecycle.go
- memory_refresh.go
- orphan_disposal.go
- outbox.go
- projection.go
- projection_cleanup.go
- projection_cleanup_execution.go
- projection_cleanup_scan.go
- projection_destinations.go
- reads.go
- rebuild.go
- rebuild_pages.go
- retention.go
- retry.go
- snapshot_disposal.go
- sql_types.go
- temporal.go
- version_disposal.go
- version_retention.go