Documentation
¶
Index ¶
Constants ¶
Variables ¶
var ErrStoreClosed = errors.New("store closed")
Functions ¶
Types ¶
type StoreAsync ¶
type StoreAsync struct {
// contains filtered or unexported fields
}
StoreAsync is a wrapper that implements a sharded buffered queue and Group Commit pattern. Producers append to the shard of the record id, so operations on the same id keep their order in the WAL. The worker sweeps all shards, drains them, and writes to disk in batches.
The first write or sync error is sticky: every later operation fails with it, because after a failed fsync the state of the file is unknown.
func NewStoreAsync ¶
func NewStoreAsync(store Store) *StoreAsync
func (*StoreAsync) Append ¶
Append pushes the operation to the shard of id. If fsync is true, it blocks until physically persisted.
func (*StoreAsync) Close ¶
func (s *StoreAsync) Close() error
Close triggers a shutdown of the worker and waits for it to drain before closing the underlying store.
func (*StoreAsync) Flush ¶
func (s *StoreAsync) Flush() error
func (*StoreAsync) Sync ¶
func (s *StoreAsync) Sync() error
type StoreCrazy ¶
type StoreCrazy struct {
// contains filtered or unexported fields
}
StoreCrazy is a high-speed variant of StoreDisk that omits CRC checksums. It trades corruption guarantees for pure raw throughput.
func NewStoreCrazy ¶
func NewStoreCrazy(path string) (*StoreCrazy, error)
func (*StoreCrazy) Append ¶
Append writes the operation to the WAL. Header (13 bytes) = OpCode(1) + ID(8) + Length(4) (NO CRC)
func (*StoreCrazy) Close ¶
func (s *StoreCrazy) Close() error
func (*StoreCrazy) Flush ¶
func (s *StoreCrazy) Flush() error
func (*StoreCrazy) Sync ¶
func (s *StoreCrazy) Sync() error
type StoreDisk ¶
type StoreDisk struct {
// contains filtered or unexported fields
}
func NewStoreDisk ¶
func (*StoreDisk) Append ¶
Append escribe la operación en el WAL. Header (17 bytes) = OpCode(1) + ID(8) + Length(4) + CRC32(4)
type StoreFlusher ¶
type StoreFlusher struct {
// contains filtered or unexported fields
}
StoreFlusher is a wrapper that periodically calls Flush() and Sync() on the underlying store in a background goroutine.
func NewStoreFlusher ¶
func NewStoreFlusher(store Store, interval time.Duration) *StoreFlusher
func (*StoreFlusher) Close ¶
func (s *StoreFlusher) Close() error
func (*StoreFlusher) Flush ¶
func (s *StoreFlusher) Flush() error
func (*StoreFlusher) Sync ¶
func (s *StoreFlusher) Sync() error
type StoreJson ¶
type StoreJson struct {
// contains filtered or unexported fields
}
func NewStoreJson ¶
type StoreSnappy ¶
type StoreSnappy struct {
// contains filtered or unexported fields
}
StoreSnappy is a wrapper that compresses payloads using the fast Snappy algorithm. It encodes payload data on Append and decodes it on Replay, leaving headers intact.
func NewStoreSnappy ¶
func NewStoreSnappy(store Store) *StoreSnappy
func (*StoreSnappy) Append ¶
Append compresses the supplied data and passes it to the underlying store.
func (*StoreSnappy) Close ¶
func (s *StoreSnappy) Close() error
func (*StoreSnappy) Flush ¶
func (s *StoreSnappy) Flush() error
func (*StoreSnappy) Replay ¶
Replay reads the underlying store's raw data, decompressing the payloads before yielding.
func (*StoreSnappy) Sync ¶
func (s *StoreSnappy) Sync() error