storekv

package
v0.0.0-...-7899014 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Break = store.Break

	DefaultCodec = codec.DefaultCodec

	ErrKeyNotFound = store.ErrKeyNotFound
	ErrKeyNotMatch = store.ErrKeyNotMatch
	ErrRead        = store.ErrRead
)

Functions

func WithCache

func WithCache(cache Cache) withCache

func WithCodec

func WithCodec(codec Codec) withCodec

Types

type Cache

type Cache = store.Cache

type Codec

type Codec = codec.Codec

type CostInfo

type CostInfo struct {
	Put    int
	Get    int
	Exists int
	Iter   int
	Delete int
}

type Def

type Def struct{}

func (Def) New

func (Def) New(
	newHashState key.NewHashState,
	parallel sys.Parallel,
) (
	newStore New,
)

func (Def) TestKV

func (Def) TestKV(
	scope dscope.Scope,
	testStore store.TestStore,
) TestKV

type KV

type KV interface {
	StoreID() string                      // IndexID is only used in initialization, should be stable and unique
	Name() string                         // Name is for human readable
	KeyPut(key string, r io.Reader) error // implementation should not retain reader underlying bytes after return
	KeyGet(key string, fn func(io.Reader) error) error
	KeyExists(key string) (bool, error)
	KeyIter(prefix string, fn func(key string) error) error
	KeyDelete(key ...string) error
	CostInfo() CostInfo
}

type Key

type Key = key.Key

type New

type New func(
	ctx context.Context,
	kv KV,
	prefix string,
	options ...NewOption,
) (*Store, error)

type NewOption

type NewOption interface {
	IsNewOption()
}

type Store

type Store struct {
	// contains filtered or unexported fields
}

func (*Store) CacheGet

func (s *Store) CacheGet(key Key, fn func(sb.Stream) error) (err error)

func (*Store) CachePut

func (s *Store) CachePut(key Key, tokes sb.Tokens, options ...store.CachePutOption) error

func (*Store) Delete

func (s *Store) Delete(keys []Key) error

func (*Store) Exists

func (s *Store) Exists(key Key) (bool, error)

func (*Store) ID

func (s *Store) ID() (StoreID, error)

func (*Store) IterAllKeys

func (s *Store) IterAllKeys(fn func(Key) error) error

func (*Store) IterKeys

func (s *Store) IterKeys(ns key.Namespace, fn func(Key) error) error

func (*Store) Name

func (s *Store) Name() string

func (*Store) Read

func (s *Store) Read(key Key, fn func(sb.Stream) error) error

func (*Store) Write

func (s *Store) Write(
	ns key.Namespace,
	stream sb.Stream,
	options ...WriteOption,
) (res store.WriteResult, err error)

type StoreID

type StoreID = store.ID

type StringKey

type StringKey string

func (StringKey) Error

func (s StringKey) Error() string

type TapKey

type TapKey = opts.TapKey

type TapWriteResult

type TapWriteResult = store.TapWriteResult

type TestKV

type TestKV func(
	ctx context.Context,
	t *testing.T,
	with func(
		fn func(kv KV, prefix string),
	),
)

type WithOffload

type WithOffload func(
	key Key,
	length int,
) store.Store

func (WithOffload) IsNewOption

func (_ WithOffload) IsNewOption()

type WithoutRead

type WithoutRead struct{}

func (WithoutRead) IsNewOption

func (_ WithoutRead) IsNewOption()

type WithoutWrite

type WithoutWrite struct{}

func (WithoutWrite) IsNewOption

func (_ WithoutWrite) IsNewOption()

type WriteOption

type WriteOption = store.WriteOption

type WriteResult

type WriteResult = store.WriteResult

Jump to

Keyboard shortcuts

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