formattedstore

package
v0.0.0-...-64dd8ac Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FormattedProvider

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

FormattedProvider is a spi.Provider that allows for data to be formatted in an underlying provider.

func NewProvider

func NewProvider(underlyingProvider spi.Provider, formatter Formatter) *FormattedProvider

NewProvider instantiates a new FormattedProvider with the given spi.Provider and Formatter. The Formatter is used to format data before being sent to the Provider for storage. The Formatter is also used to restore the original format of data being retrieved from Provider.

func (*FormattedProvider) Close

func (f *FormattedProvider) Close() error

Close closes all stores created under this store provider. For persistent store implementations, this does not delete any data in the underlying stores.

func (*FormattedProvider) GetOpenStores

func (f *FormattedProvider) GetOpenStores() []spi.Store

GetOpenStores returns all currently open stores.

func (*FormattedProvider) GetStoreConfig

func (f *FormattedProvider) GetStoreConfig(name string) (spi.StoreConfiguration, error)

GetStoreConfig gets the current store configuration. The store must be created prior to calling this method. If the store cannot be found, then an error wrapping ErrStoreNotFound will be returned.

func (*FormattedProvider) OpenStore

func (f *FormattedProvider) OpenStore(name string) (spi.Store, error)

OpenStore opens a store with the given name and returns a handle. If the store has never been opened before, then it is created. Store names are not case-sensitive.

func (*FormattedProvider) SetStoreConfig

func (f *FormattedProvider) SetStoreConfig(name string, config spi.StoreConfiguration) error

SetStoreConfig sets the configuration on a store. The store must be created prior to calling this method. If the store cannot be found, then an error wrapping spi.ErrStoreNotFound will be returned from the underlying provider.

type Formatter

type Formatter interface {
	Format(key string, value []byte, tags ...spi.Tag) (formattedKey string, formattedValue []byte,
		formattedTags []spi.Tag, err error)
	Deformat(formattedKey string, formattedValue []byte, formattedTags ...spi.Tag) (key string, value []byte,
		tags []spi.Tag, err error)
	// UsesDeterministicKeyFormatting indicates whether the formatted keys produced by this formatter can be
	// deterministically derived from the unformatted keys. If so, then FormattedProvider can take advantage of
	// certain performance optimizations.
	UsesDeterministicKeyFormatting() bool
}

Formatter represents a type that can convert data between two formats.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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