Documentation
¶
Overview ¶
Package storage defines the transactional persistence boundary used by Floret. Backends store opaque namespaced bytes; Floret owns every domain schema and index encoded into those bytes.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ErrNotFound reports that a key does not exist in a namespace. ErrNotFound = errors.New("storage record not found") // ErrClosed reports an operation attempted on a closed backend. ErrClosed = errors.New("storage backend closed") // ErrConflict reports that a transaction could not commit because another // transaction committed after its snapshot was taken. ErrConflict = errors.New("storage transaction conflict") // ErrInvalidArgument reports a request outside the storage contract. ErrInvalidArgument = errors.New("invalid storage argument") // ErrTransactionClosed reports use of a transaction outside its callback. ErrTransactionClosed = errors.New("storage transaction closed") // ErrMigrationRequired reports an exact legacy storage schema that must be // migrated explicitly before it can be opened as a Backend. ErrMigrationRequired = errors.New("storage migration required") )
var ( // ErrMigrationConflict reports that a v2 store was produced by a different // migration operation. ErrMigrationConflict = errors.New("floret v2 migration operation conflict") )
Functions ¶
This section is empty.
Types ¶
type Backend ¶
type Backend interface {
View(context.Context, func(ReadTx) error) error
Update(context.Context, func(WriteTx) error) error
Close() error
}
Backend provides snapshot reads and serializable writes over opaque records. Implementations must invoke an Update callback exactly once and must never retry it implicitly.
type MigrateV2Request ¶
MigrateV2Request identifies one exact SQLite migration operation.
type MigrateV2Result ¶
type MigrateV2Result struct {
OperationID string `json:"operation_id"`
Replayed bool `json:"replayed"`
Threads int `json:"threads"`
Entries int `json:"entries"`
ContentHash string `json:"content_hash"`
}
MigrateV2Result reports the committed operation and whether it was replayed.
func MigrateV2 ¶
func MigrateV2(ctx context.Context, request MigrateV2Request) (result MigrateV2Result, resultErr error)
MigrateV2 atomically converts one exact schema-v16 SQLite store into the v2 backend format. It never opens, repairs, or upgrades any other schema.
type MigrationSchemaError ¶
MigrationSchemaError reports a database outside the one exact v16 source schema or exact v2 migration receipt accepted by MigrateV2.
func (*MigrationSchemaError) Error ¶
func (failure *MigrationSchemaError) Error() string
Error describes the rejected migration schema.
type ReadTx ¶
type ReadTx interface {
Get(namespace string, key []byte) ([]byte, error)
Scan(ScanRequest) (ScanPage, error)
}
ReadTx is a snapshot that is valid only for the duration of its callback.
type Record ¶
Record is one key and value returned by Scan. Both byte slices are owned by the caller.
type ScanPage ¶
ScanPage is one ordered page. Next is the exclusive After cursor for the following request and is present only when HasMore is true.
type ScanRequest ¶
ScanRequest selects a bounded lexicographic page from one namespace. Start is inclusive, End is exclusive, and After is exclusive. Limit must be positive.