internal/infra/pg/generationsnapshot.go
internal/infra/pg · 117 lines · 11 declarations · source
Declarations
const MaxGenerationClaims
const MaxGenerationClaims = 100
const MaxGenerationMessages
const MaxGenerationMessages = 256
const MaxGenerationBytes
const MaxGenerationBytes = 1 << 20
var ErrGenerationConflict
var ErrGenerationConflict = errors.New("source or knowledge changed during generation preparation")
var ErrGenerationLimit
var ErrGenerationLimit = errors.New("generation exceeds its source or output bound")
var ErrInvalidGeneration
var ErrInvalidGeneration = errors.New("invalid generation request")
var ErrGenerationSource
var ErrGenerationSource = errors.New("generation source is unavailable or is authoritative human input")
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.
method FactStore.ReadGenerationSource
func (s *FactStore) ReadGenerationSource(ctx context.Context, schema Schema, scope, source string) (GenerationSnapshot, error)
func readGenerationSourceTx
func readGenerationSourceTx(ctx context.Context, tx pgx.Tx, schema Schema, scope, source string, writing bool) (GenerationSnapshot, error)
method GenerationSnapshot.MessageTime
func (s GenerationSnapshot) MessageTime(m domain.Message) time.Time