2014-08-21 22:06:11 +02:00
|
|
|
package index
|
|
|
|
|
2014-09-10 18:41:52 +02:00
|
|
|
import "encoding"
|
2014-08-21 22:06:11 +02:00
|
|
|
|
|
|
|
// KeyValueStore persists key/value pairs.
|
|
|
|
type KeyValueStore interface {
|
2014-09-09 14:36:26 +02:00
|
|
|
Put(key, value encoding.BinaryMarshaler) error
|
|
|
|
Get(k encoding.BinaryMarshaler, v encoding.BinaryUnmarshaler) (bool, error)
|
|
|
|
Has(k encoding.BinaryMarshaler) (has bool, err error)
|
|
|
|
Delete(k encoding.BinaryMarshaler) error
|
2014-08-21 22:06:11 +02:00
|
|
|
|
|
|
|
NewBatch() Batch
|
|
|
|
Commit(b Batch) error
|
|
|
|
|
|
|
|
Close() error
|
|
|
|
}
|
|
|
|
|
|
|
|
// Batch allows KeyValueStore mutations to be pooled and committed together.
|
|
|
|
type Batch interface {
|
2014-09-09 14:36:26 +02:00
|
|
|
Put(key, value encoding.BinaryMarshaler) error
|
|
|
|
Delete(key encoding.BinaryMarshaler) error
|
2014-08-21 22:06:11 +02:00
|
|
|
Reset()
|
|
|
|
}
|