Documentation
¶
Overview ¶
Package paylog is a volume engine shell over a storage Device: block payloads append to a log of segment files, and one ordered index holds the key-value store, the block locations, and the garbage collection journal.
Every durable index commit also publishes the locations of the blocks written since the previous one. The commit's flush covers the earlier segment writes, so a published block is durable, and a key-value commit that follows a block write publishes that block with it. An ordered commit publishes no blocks, since a crash could keep its record and lose their payloads.
Index ¶
- type 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 Index ¶
type Index interface {
kvtx.Store
// Close releases the index. Uncommitted writes are lost.
Close() error
}
Index is the ordered key-value index a Store keeps on its device. Read transactions see a snapshot and may stay open across commits. A write transaction excludes other writers, and its Commit applies atomically and makes every earlier write on the device durable no later than the commit itself, so a crash never keeps a commit without them. A write transaction may also implement kvtx.OrderedCommitTx, whose commits a device flush makes durable. The index keeps its own files on the device, none named with segmentPrefix.
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 Device with an ordered index.
func Open ¶
Open opens the store on dev with index, an index opened on the same device. The store owns the index and closes it on Close or on failure.
func (*Store) AppendJournal ¶
AppendJournal durably journals reference graph changes in one index commit, which also publishes the pending blocks.
func (*Store) AppendJournalOrdered ¶
AppendJournalOrdered journals reference graph changes in one ordered index 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 from one index view.
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 appends the payload to the open segment. The block is readable at once and durable after the next Sync or index commit.
func (*Store) PutBlockBatch ¶
PutBlockBatch verifies every entry, then appends the new payloads in one device call and records 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 index commit, skipping the commit when the journal is empty.
func (*Store) RmBlock ¶
RmBlock records a pending remove, published by the next Sync or index commit.