29 lines
502 B
Go
29 lines
502 B
Go
|
package storage
|
||
|
|
||
|
import (
|
||
|
"errors"
|
||
|
"sync"
|
||
|
)
|
||
|
|
||
|
var (
|
||
|
ErrNoSuchKey = errors.New("no such key in store")
|
||
|
)
|
||
|
|
||
|
type Item interface {
|
||
|
sync.Locker
|
||
|
Dirty()
|
||
|
IsDirty() bool
|
||
|
GetData() interface{}
|
||
|
SetData(interface{})
|
||
|
ItemKey() string
|
||
|
}
|
||
|
|
||
|
type Store interface {
|
||
|
GetItem(key string, data interface{}) (Item, error)
|
||
|
Get(key string, data interface{}) error
|
||
|
Put(key string, version, minorVersion int, secretMode bool, data interface{}) (Item, error)
|
||
|
FlushAll() []error
|
||
|
Flush(key string) error
|
||
|
Shutdown()
|
||
|
}
|