wbstore

package
v0.12.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 5, 2025 License: Apache-2.0 Imports: 18 Imported by: 1

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

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Store

type Store struct {
	*monitor.M[wbState, kvWrapper]
}

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

func New(ctx context.Context, base blob.Store, buf blob.KV) Store

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.

func (Store) Buffer

func (s Store) Buffer() blob.KV

Buffer returns the buffer store used by s.

func (Store) Close

func (s Store) Close(ctx context.Context) error

Close implements part of the blob.StoreCloser interface.

func (Store) Sync

func (s Store) Sync(ctx context.Context) error

Sync blocks until the buffer is empty or ctx ends.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL