Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // Errors returned by KeyValueStore methods. ErrKeyNotFound = fmt.Errorf("key not found") ErrStoreLocked = fmt.Errorf("store is already locked") ErrStoreNotLocked = fmt.Errorf("store is not locked") ErrStoreEmpty = fmt.Errorf("store is empty") ErrTimeoutLockingStore = fmt.Errorf("timed out locking store") ErrNonBlockingLockIsAlreadyLocked = fmt.Errorf("attempted to perform non-blocking lock on an already locked store") )
Functions ¶
This section is empty.
Types ¶
type KeyValueStore ¶
type KeyValueStore interface { Read(key string, value interface{}) error Write(key string, value interface{}) error Flush() error Lock(block bool) error Unlock(forceUnlock bool) error GetModificationTime() (time.Time, error) GetLockFileModificationTime() (time.Time, error) GetLockFileName() string Remove() }
KeyValueStore represents a persistent store of (key,value) pairs.
func NewJsonFileStore ¶
func NewJsonFileStore(fileName string) (KeyValueStore, error)
NewJsonFileStore creates a new jsonFileStore object, accessed as a KeyValueStore.
func NewMockStore ¶
func NewMockStore(lockFilePath string) KeyValueStore
NewMockStore creates a new jsonFileStore object, accessed as a KeyValueStore.
Click to show internal directories.
Click to hide internal directories.