2016-07-26 04:33:43 +03:00
|
|
|
// Copyright Microsoft Corp.
|
|
|
|
// All rights reserved.
|
|
|
|
|
|
|
|
package store
|
|
|
|
|
2016-07-28 04:24:26 +03:00
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
)
|
|
|
|
|
2016-07-26 04:33:43 +03:00
|
|
|
// KeyValueStore represents a persistent store of (key,value) pairs.
|
|
|
|
type KeyValueStore interface {
|
|
|
|
Read(key string, value interface{}) error
|
|
|
|
Write(key string, value interface{}) error
|
|
|
|
Flush() error
|
2016-11-22 00:48:03 +03:00
|
|
|
Lock(block bool) error
|
2016-11-15 05:21:37 +03:00
|
|
|
Unlock() error
|
2016-07-26 04:33:43 +03:00
|
|
|
}
|
2016-07-28 04:24:26 +03:00
|
|
|
|
|
|
|
var (
|
|
|
|
// Errors returned by KeyValueStore methods.
|
2016-11-15 05:21:37 +03:00
|
|
|
ErrKeyNotFound = fmt.Errorf("Key not found")
|
|
|
|
ErrStoreLocked = fmt.Errorf("Store is locked")
|
|
|
|
ErrStoreNotLocked = fmt.Errorf("Store is not locked")
|
2016-07-28 04:24:26 +03:00
|
|
|
)
|