Documentation ¶
Index ¶
- Variables
- type BoltStorage
- func (b *BoltStorage) Add(ctx *Context, loc string, data *Pair) error
- func (b *BoltStorage) Clear(ctx *Context, loc string) (int64, error)
- func (b *BoltStorage) Close(ctx *Context) error
- func (b *BoltStorage) Delete(ctx *Context, loc string) error
- func (b *BoltStorage) Destroy(ctx *Context) error
- func (b *BoltStorage) GetStats(ctx *Context, loc string) (StorageStats, error)
- func (b *BoltStorage) Health(ctx *Context) error
- func (b *BoltStorage) Load(ctx *Context, loc string) ([]Pair, error)
- func (b *BoltStorage) Remove(ctx *Context, loc string, k []byte) (int64, error)
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultOptions = &bolt.Options{ Timeout: 5 * time.Second, }
Functions ¶
This section is empty.
Types ¶
type BoltStorage ¶
type BoltStorage struct { Filename string // contains filtered or unexported fields }
BoltStorage implements Storage using boltdb
This name stutters because it's convenient to dot-import core, which defines 'Storage'.
func NewStorage ¶
func NewStorage(ctx *Context, filename string) (*BoltStorage, error)
NewStorage returns a BoltStorage based Storage
func (*BoltStorage) Add ¶
func (b *BoltStorage) Add(ctx *Context, loc string, data *Pair) error
Add adds a pair to a location
func (*BoltStorage) Clear ¶
func (b *BoltStorage) Clear(ctx *Context, loc string) (int64, error)
Clear removes a location and returns the number of records dropped
func (*BoltStorage) Close ¶
func (b *BoltStorage) Close(ctx *Context) error
func (*BoltStorage) Delete ¶
func (b *BoltStorage) Delete(ctx *Context, loc string) error
Delete removes a location and returns the number of records dropped
func (*BoltStorage) Destroy ¶
func (b *BoltStorage) Destroy(ctx *Context) error
Destroy closes the database and deletes it
func (*BoltStorage) GetStats ¶
func (b *BoltStorage) GetStats(ctx *Context, loc string) (StorageStats, error)
GetStats returns the stats for a location ToDo: store last record times
func (*BoltStorage) Health ¶
func (b *BoltStorage) Health(ctx *Context) error
func (*BoltStorage) Load ¶
func (b *BoltStorage) Load(ctx *Context, loc string) ([]Pair, error)
Load returns data for a location ToDo: should we return an error if there was no bucket for a location?
Click to show internal directories.
Click to hide internal directories.