Documentation
¶
Overview ¶
Package direct is a volume engine that stores every key-value entry, block, and journal entry as its own record in a records.Store, the shape of an IndexedDB object store.
The key-value store and the journal also live in a memtable loaded at Open, so reads never reach the record store. Each write transaction commits as one record store call carrying its changes and the block writes and removes made since the previous commit. Record store calls apply atomically and in order, so an ordered commit may publish blocks too: a crash that keeps it keeps every call before it.
Index ¶
- type Store
- func (s *Store) AppendJournal(ctx context.Context, adds, removes []block_gc.RefEdge) error
- func (s *Store) AppendJournalOrdered(ctx context.Context, adds, removes []block_gc.RefEdge) error
- func (s *Store) BeginReadOperation(context.Context) (block.StoreOps, func(), error)
- func (s *Store) Close() error
- func (s *Store) GetBlock(ctx context.Context, ref *block.BlockRef) ([]byte, bool, error)
- func (s *Store) GetBlockExists(ctx context.Context, ref *block.BlockRef) (bool, error)
- func (s *Store) GetBlockExistsBatch(ctx context.Context, refs []*block.BlockRef) ([]bool, error)
- func (s *Store) GetHashType() hash.HashType
- func (s *Store) GetStoredBlock(ctx context.Context, ref *block.BlockRef) (*block.StoredBlock, error)
- func (s *Store) GetSupportedFeatures() block.StoreFeature
- func (s *Store) PutBlock(ctx context.Context, data []byte, opts *block.PutOpts) (*block.BlockRef, bool, error)
- func (s *Store) PutBlockBatch(ctx context.Context, entries []*block.PutBatchEntry) error
- func (s *Store) ReplayJournal(ctx context.Context, apply func(adds, removes []block_gc.RefEdge) error) error
- func (s *Store) RmBlock(ctx context.Context, ref *block.BlockRef) error
- func (s *Store) StatBlock(ctx context.Context, ref *block.BlockRef) (*block.BlockStat, error)
- func (s *Store) Sync(ctx context.Context) (bool, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Store ¶
type Store struct {
// kvtx.Store serves the key-value store under kvPrefix.
kvtx.Store
// contains filtered or unexported fields
}
Store is a volume engine on a record store.
func (*Store) AppendJournal ¶
AppendJournal durably journals reference graph changes in one commit, which also commits the pending blocks.
func (*Store) AppendJournalOrdered ¶
AppendJournalOrdered journals reference graph changes in one ordered commit, which the next Sync or durable commit makes durable.
func (*Store) BeginReadOperation ¶
BeginReadOperation returns the store, which needs no read scope.
func (*Store) GetBlockExists ¶
GetBlockExists checks whether a block is stored.
func (*Store) GetBlockExistsBatch ¶
GetBlockExistsBatch checks each reference in one record store call.
func (*Store) GetHashType ¶
GetHashType returns zero to select the default hash type.
func (*Store) GetStoredBlock ¶
func (s *Store) GetStoredBlock(ctx context.Context, ref *block.BlockRef) (*block.StoredBlock, error)
GetStoredBlock serves the block without refs because this store keeps block bytes without their refs.
func (*Store) GetSupportedFeatures ¶
func (s *Store) GetSupportedFeatures() block.StoreFeature
GetSupportedFeatures reports native batches and the store's own buffering.
func (*Store) PutBlock ¶
func (s *Store) PutBlock(ctx context.Context, data []byte, opts *block.PutOpts) (*block.BlockRef, bool, error)
PutBlock adds the payload to the pending blocks. The block is readable at once and durable after the next Sync or durable commit.
func (*Store) PutBlockBatch ¶
PutBlockBatch verifies every entry, then adds the new payloads and the tombstones as removes.
func (*Store) ReplayJournal ¶
func (s *Store) ReplayJournal(ctx context.Context, apply func(adds, removes []block_gc.RefEdge) error) error
ReplayJournal passes every journal entry in order to apply and removes the entries in one durable commit, skipping the commit when the journal is empty.