Skip to main content

internal/infra/pg/chunkrecovery.go

internal/infra/pg · 157 lines · 6 declarations · source

Declarations​

const MaxChunkRecoveryBytes​

const MaxChunkRecoveryBytes = 16 << 20

source

var ErrChunkRecoveryLimit​

var ErrChunkRecoveryLimit = errors.New("chunk recovery page exceeds 16 MiB of source text; reduce the page limit")

source

type ChunkRecoveryCursor​

type ChunkRecoveryCursor struct {
Offset int64 `json:"log_offset"`
Ordinal int `json:"ordinal"`
}

source

type ChunkRecoveryPage​

type ChunkRecoveryPage struct {
Examined int `json:"examined"`
Restored int `json:"restored"`
Repaired int `json:"repaired"`
Next *ChunkRecoveryCursor `json:"next,omitempty"`
}

source

method ObservationStore.RecoverChunks​

func (s *ObservationStore) RecoverChunks(ctx context.Context, schema Schema, scope, source, actor string, after ChunkRecoveryCursor, limit int) (ChunkRecoveryPage, error)

Source offsets are monotonic within the project. Each page locks surviving source material before restoring derived rows; erasure wins cleanly if a selected message disappears before that lock.

source

func recoverMessageChunkTx​

func recoverMessageChunkTx(ctx context.Context, tx pgx.Tx, schema Schema, scope, source string, ordinal int) (bool, bool, error)

source