Documentation ¶
Index ¶
- Variables
- func NewBBoltPersister(filePath string) (*BBoltPersister, PersisterShutdownFunc, error)
- type BBoltPersister
- func (p *BBoltPersister) Clear() error
- func (p *BBoltPersister) Delete(_ context.Context, key string) error
- func (p *BBoltPersister) Get(_ context.Context, key string) ([]byte, error)
- func (p *BBoltPersister) Keys() ([]string, error)
- func (p *BBoltPersister) Set(_ context.Context, key string, value []byte) error
- type CachedPersister
- type NoopPersister
- type PersisterShutdownFunc
Constants ¶
This section is empty.
Variables ¶
var OffsetsBucket = []byte(`offsets`)
OffsetsBucket is the scope provided to offset persistence
Functions ¶
func NewBBoltPersister ¶
func NewBBoltPersister(filePath string) (*BBoltPersister, PersisterShutdownFunc, error)
NewBBoltPersister opens a connection to a bbolt database for the given filePath and wraps it in a Scopped Persister. scope refers to a bbolt bucket name
Types ¶
type BBoltPersister ¶
type BBoltPersister struct {
// contains filtered or unexported fields
}
BBoltPersister is a persister that uses a database for the backend
func (*BBoltPersister) Clear ¶
func (p *BBoltPersister) Clear() error
Clear clears the offset bucket of all data
func (*BBoltPersister) Delete ¶
func (p *BBoltPersister) Delete(_ context.Context, key string) error
Delete removes the key from the bbolt scoped bucket
func (*BBoltPersister) Keys ¶
func (p *BBoltPersister) Keys() ([]string, error)
Keys returns all the keys associated with the bbolt db backing this persister
type CachedPersister ¶
type CachedPersister struct {
// contains filtered or unexported fields
}
CachedPersister implements a cache on top of a persister
func NewCachedPersister ¶
func NewCachedPersister(p operator.Persister) *CachedPersister
NewCachedPersister creates a Cache Persister that wraps the supplied Persister in a cache
func (*CachedPersister) Delete ¶
func (p *CachedPersister) Delete(ctx context.Context, key string) error
type NoopPersister ¶
type NoopPersister struct{}
NoopPersister is a persister that does nothing and returns no errors
func (*NoopPersister) Delete ¶
func (p *NoopPersister) Delete(_ context.Context, _ string) error
Delete does nothing and returns no error
type PersisterShutdownFunc ¶
type PersisterShutdownFunc func() error
PersisterShutdownFunc handles cleanup of the persister
var NoopShutdownFunc PersisterShutdownFunc = func() error { return nil }
NoopShutdownFunc is a PersisterShutdownFunc that returns nil. To be used with persisters that have no shutdown operation