Skip to main content

internal/infra/pg/generationsnapshot.go

internal/infra/pg · 117 lines · 11 declarations · source

Declarations​

const MaxGenerationClaims​

const MaxGenerationClaims = 100

source

const MaxGenerationMessages​

const MaxGenerationMessages = 256

source

const MaxGenerationBytes​

const MaxGenerationBytes = 1 << 20

source

var ErrGenerationConflict​

var ErrGenerationConflict = errors.New("source or knowledge changed during generation preparation")

source

var ErrGenerationLimit​

var ErrGenerationLimit = errors.New("generation exceeds its source or output bound")

source

var ErrInvalidGeneration​

var ErrInvalidGeneration = errors.New("invalid generation request")

source

var ErrGenerationSource​

var ErrGenerationSource = errors.New("generation source is unavailable or is authoritative human input")

source

type GenerationSnapshot​

type GenerationSnapshot struct {
SourceID string
Scope string
LogOffset int64
Owner string
OccurredAt time.Time
IngestedAt time.Time
Messages []domain.Message
Revision int64
PreviousVersion string
PreviousGeneration string
Digest [32]byte
}

GenerationSnapshot is held only during one bounded model attempt. Its digest includes source bytes, message groups/roles, attribution, fact revision and the previous extraction pointer.

source

method FactStore.ReadGenerationSource​

func (s *FactStore) ReadGenerationSource(ctx context.Context, schema Schema, scope, source string) (GenerationSnapshot, error)

source

func readGenerationSourceTx​

func readGenerationSourceTx(ctx context.Context, tx pgx.Tx, schema Schema, scope, source string, writing bool) (GenerationSnapshot, error)

source

method GenerationSnapshot.MessageTime​

func (s GenerationSnapshot) MessageTime(m domain.Message) time.Time

source