kvstore

package
v0.0.2-alpha.1 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidReadBufferSize = errors.New("kvstore/afero: invalid read buffer size")
)
View Source
var (
	ErrRecordNotFound = errors.New("datastore/kvstore: record not found")
)

Functions

func New

func New[E any](
	logger *logging.Logger,
	dao datastore.GenericDAO[E]) datastore.GenericDAO[E]

func NewAferoDAO

func NewAferoDAO[E any](logger *logging.Logger,
	fs afero.Fs,
	rootDir string,
	partition string,
	serializer datastore.Serializer,
	readBufferSize int) (datastore.GenericDAO[E], error)

Creates a key/value blob storage backend

Types

type AferoDAO

type AferoDAO[E any] struct {
	datastore.GenericDAO[E]
	// contains filtered or unexported fields
}

func (*AferoDAO[E]) Count

func (aferoDAO *AferoDAO[E]) Count(CONSISTENCY_LEVEL int) (int, error)

Returns the number of items in the blob store partition using a buffered read

func (*AferoDAO[E]) Delete

func (aferoDAO *AferoDAO[E]) Delete(entity E) error

Deletes the provided entity from the blob datastore. Returns an error if the provided entity can't be found.

func (*AferoDAO[E]) ForEachPage

func (aferoDAO *AferoDAO[E]) ForEachPage(
	pageQuery datastore.PageQuery,
	pagerProcFunc datastore.PagerProcFunc[E],
	CONSISTENCY_LEVEL int) error

Reads all records in batches of PageQuery.PageSize, passing each page to the provided pageProcFunc to process the resultset.

func (*AferoDAO[E]) Get

func (aferoDAO *AferoDAO[E]) Get(id uint64, CONSISTENCY_LEVEL int) (E, error)

Retrieves the entity with the provided ID from the blob datastore. Returns an error if the entity can't be found or if it can't be unmarshalled.

func (*AferoDAO[E]) Page

func (aferoDAO *AferoDAO[E]) Page(
	pageQuery datastore.PageQuery,
	CONSISTENCY_LEVEL int) (datastore.PageResult[E], error)

Returns a page of items in the blob store partition

func (*AferoDAO[E]) Save

func (aferoDAO *AferoDAO[E]) Save(entity E) error

Saves the provided entity to the blob datastore. Returns an error if the entity can not be serialized or there is a problem saving to blob storage.

type KVStore

type KVStore[E any] struct {
	datastore.GenericDAO[E]
	// contains filtered or unexported fields
}

func (*KVStore[E]) Count

func (kvstore *KVStore[E]) Count(CONSISTENCY_LEVEL int) (int, error)

func (*KVStore[E]) Delete

func (kvstore *KVStore[E]) Delete(entity E) error

func (*KVStore[E]) ForEachPage

func (kvstore *KVStore[E]) ForEachPage(
	pageQuery datastore.PageQuery,
	pagerProcFunc datastore.PagerProcFunc[E],
	CONSISTENCY_LEVEL int) error

func (*KVStore[E]) Get

func (kvstore *KVStore[E]) Get(id uint64, CONSISTENCY_LEVEL int) (E, error)

func (*KVStore[E]) Page

func (kvstore *KVStore[E]) Page(
	pageQuery datastore.PageQuery,
	CONSISTENCY_LEVEL int) (datastore.PageResult[E], error)

func (*KVStore[E]) Save

func (kvstore *KVStore[E]) Save(entity E) error

Jump to

Keyboard shortcuts

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