Documentation ¶
Overview ¶
Package wbstore implements a wrapper for a blob.Store that caches non-replacement writes of in a buffer and pushes them to the base store concurrently in the background.
Index ¶
- type Store
- func (s Store) Buffer() blob.KV
- func (s Store) CAS(ctx context.Context, name string) (blob.CAS, error)
- func (s Store) Close(ctx context.Context) error
- func (s Store) KV(ctx context.Context, name string) (blob.KV, error)
- func (s Store) Sub(ctx context.Context, name string) (blob.Store, error)
- func (s Store) Sync(ctx context.Context) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store implements the blob.Store interface by delegating to a base store. Non-replacement writes to blob.KV instances derived from the base store are buffered and written back to the underlying store by a background worker that runs concurrently with the store.
func New ¶
New constructs a blob.Store wrapper that delegates to base and uses buf as a local buffer store. New will panic if base == nil or buf == nil. The ctx value governs the operation of the background writer, which will run until the store is closed or ctx terminates.
If the buffer store is not empty, existing blobs there will be discarded.
func (Store) CAS ¶ added in v0.9.0
CAS implements part of the blob.Store interface.
func (Store) Close ¶
Close implements part of the blob.StoreCloser interface.
func (Store) KV ¶ added in v0.9.0
KV implements part of blob.Store. It wraps the blob.KV produced by the base store to direct writes through the buffer.
If the blob.KV returned by the base store implements blob.CAS, then the returned wrapper does also. Otherwise it does not.
func (Store) Sub ¶ added in v0.8.0
Sub implements part of blob.Store. It wraps the substore produced by the base store to direct writes through the buffer.