Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions extension/storage/batch_dependent_store.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,22 @@ import (
)

// BatchDependentStore is an interface that defines methods for managing batch dependent information in the database.
//
// A BatchDependent is a reverse index ("batches that depend on me") paired one-to-one with a Batch.
// The batch-creation flow always calls Create here before creating the Batch itself, so every active
// Batch is guaranteed to have a corresponding BatchDependent row. Lookups via Get are only performed
// for batch IDs returned from the active-batch set, meaning a missing row indicates data corruption or
// out-of-band manipulation rather than a normal "not found" outcome. ErrNotFound is therefore part of
// the contract for completeness but is not expected to be returned in steady-state operation.
type BatchDependentStore interface {
// Get retrieves the batch dependent by batch ID.
// Returns ErrNotFound if the batch dependent is not found.
// If the batch contains no dependents, the returned BatchDependent will have an empty Dependents list.
// Returns ErrNotFound if the batch itself is not found, which should never happen in steady-state system and
// therefore does not need a special handling.
Get(ctx context.Context, batchID string) (entity.BatchDependent, error)

// Create creates a new batch dependent.
// Returns ErrAlreadyExists if the entry already exists.
// Returns ErrAlreadyExists if the entry already exists for the given batch ID.
Create(ctx context.Context, batchDependent entity.BatchDependent) error

// UpdateDependents updates the dependents of a batch dependent and the version to newVersion
Expand Down
Loading