Documentation ¶
Index ¶
- Variables
- func Register(name string, factory Factory) error
- type Batcher
- type Factory
- type InjectBase
- func (i *InjectBase) Delete(key string) error
- func (i *InjectBase) Get(key string) (record.Record, error)
- func (i *InjectBase) Injected() bool
- func (i *InjectBase) MaintainRecordStates(ctx context.Context, purgeDeletedBefore time.Time, shadowDelete bool) error
- func (i *InjectBase) Put(m record.Record) (record.Record, error)
- func (i *InjectBase) Query(q *query.Query, local, internal bool) (*iterator.Iterator, error)
- func (i *InjectBase) ReadOnly() bool
- func (i *InjectBase) Shutdown() error
- type Interface
- type Maintainer
- type MetaHandler
- type Purger
Constants ¶
This section is empty.
Variables ¶
var (
ErrNotFound = errors.New("storage entry not found")
)
Errors for storages.
var ErrNotImplemented = errors.New("not implemented")
ErrNotImplemented is returned when a function is not implemented by a storage.
Functions ¶
Types ¶
type Batcher ¶
type Batcher interface {
PutMany(shadowDelete bool) (batch chan<- record.Record, errs <-chan error)
}
Batcher defines the database storage API for backends that support batch operations.
type InjectBase ¶
type InjectBase struct{}
InjectBase is a dummy base structure to reduce boilerplate code for injected storage interfaces.
func (*InjectBase) Delete ¶
func (i *InjectBase) Delete(key string) error
Delete deletes a record from the database.
func (*InjectBase) Get ¶
func (i *InjectBase) Get(key string) (record.Record, error)
Get returns a database record.
func (*InjectBase) Injected ¶
func (i *InjectBase) Injected() bool
Injected returns whether the database is injected.
func (*InjectBase) MaintainRecordStates ¶
func (i *InjectBase) MaintainRecordStates(ctx context.Context, purgeDeletedBefore time.Time, shadowDelete bool) error
MaintainRecordStates maintains records states in the database.
func (*InjectBase) ReadOnly ¶
func (i *InjectBase) ReadOnly() bool
ReadOnly returns whether the database is read only.
func (*InjectBase) Shutdown ¶
func (i *InjectBase) Shutdown() error
Shutdown shuts down the database.
type Interface ¶
type Interface interface { // Primary Interface Get(key string) (record.Record, error) Put(m record.Record) (record.Record, error) Delete(key string) error Query(q *query.Query, local, internal bool) (*iterator.Iterator, error) // Information and Control ReadOnly() bool Injected() bool Shutdown() error // Mandatory Record Maintenance MaintainRecordStates(ctx context.Context, purgeDeletedBefore time.Time, shadowDelete bool) error }
Interface defines the database storage API.
func CreateDatabase ¶
CreateDatabase starts a new database with the given name and storageType at location.
func StartDatabase ¶
StartDatabase starts a new database with the given name and storageType at location.
type Maintainer ¶
type Maintainer interface { Maintain(ctx context.Context) error MaintainThorough(ctx context.Context) error }
Maintainer defines the database storage API for backends that require regular maintenance.
type MetaHandler ¶
MetaHandler defines the database storage API for backends that support optimized fetching of only the metadata.