store

package
v0.1.2 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateMultiStore

func CreateMultiStore(name, databasesDir string, storeFactory StoreFactory) (types.MultiStore, error)

func GenerateStoreId

func GenerateStoreId(name string) string

func GenererateStorageInfo

func GenererateStorageInfo(name string, databasesDir string) (string, string)

func IsValidStoreName

func IsValidStoreName(s string) bool

func NewMultiStore

func NewMultiStore(store types.Store, storeFactory StoreFactory) (types.MultiStore, error)

NewMultiStore creates a new instance of MultiStoreImpl with the provided store options.

Types

type MultiStoreImpl

type MultiStoreImpl struct {
	types.Store // Embedding Store to satisfy the Store interface
	// contains filtered or unexported fields
}

MultiStoreImpl is a concrete implementation of the MultiStore interface.

func (*MultiStoreImpl) CreateStore

func (ms *MultiStoreImpl) CreateStore(namespace string) (types.Store, bool, error)

CreateStore creates and initializes a new store with the given namespace and options. If a store with the same namespace already exists, it returns an error.

func (*MultiStoreImpl) GetStore

func (ms *MultiStoreImpl) GetStore(namespace []byte) types.Store

GetStore returns the store with the given namespace. If the store doesn't exist, it returns an error.

func (*MultiStoreImpl) GetStoreCount

func (ms *MultiStoreImpl) GetStoreCount() int

GetStoreCount returns the total number of stores in the multistore.

func (*MultiStoreImpl) Load

func (ms *MultiStoreImpl) Load() (int64, error)

Load loads the latest versioned database from disk.

func (*MultiStoreImpl) SaveVersion

func (ms *MultiStoreImpl) SaveVersion() ([]byte, int64, error)

SaveVersion saves a new version of the database to disk.

type StoreFactory

type StoreFactory interface {
	// CreateStoreInternal creates a new store.
	CreateStore(name string) (types.Store, error)
}

func NewStoreFactory

func NewStoreFactory(databasesDir string, dbFactory db.DatabaseFactory) StoreFactory

type StoreFactoryImpl

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

func (StoreFactoryImpl) CreateStore

func (f StoreFactoryImpl) CreateStore(name string) (types.Store, error)

type StoreImpl

type StoreImpl struct {
	types.Database // Embedding Database to satisfy the Database interface
	// contains filtered or unexported fields
}

StoreImpl is a concrete implementation of the Store interface.

func NewStoreImpl

func NewStoreImpl(name, path string, database types.Database) (*StoreImpl, error)

NewStoreImpl creates a new instance of StoreImpl with the provided StoreOptions object.

func (*StoreImpl) Name

func (s *StoreImpl) Name() string

Name returns the name of the store.

func (*StoreImpl) Path

func (s *StoreImpl) Path() string

Path returns the path of the store.

type StoreMetaData

type StoreMetaData struct {
	Id   string `json:"id"`
	Name string `json:"name"`
	Path string `json:"path"`
}

StoreMetaData contains metadata for a store.

Jump to

Keyboard shortcuts

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