ledisdb/store/driver/driver.go

62 lines
806 B
Go
Raw Normal View History

2014-07-25 13:58:00 +04:00
package driver
2014-07-29 13:29:51 +04:00
import (
"errors"
)
var (
ErrTxSupport = errors.New("transaction is not supported")
)
2014-07-25 13:58:00 +04:00
type IDB interface {
Close() error
Get(key []byte) ([]byte, error)
Put(key []byte, value []byte) error
Delete(key []byte) error
NewIterator() IIterator
NewWriteBatch() IWriteBatch
2014-07-29 13:29:51 +04:00
Begin() (Tx, error)
2014-07-25 13:58:00 +04:00
}
type IIterator interface {
Close() error
First()
Last()
Seek(key []byte)
Next()
Prev()
Valid() bool
Key() []byte
Value() []byte
}
type IWriteBatch interface {
Close() error
Put(key []byte, value []byte)
Delete(key []byte)
Commit() error
Rollback() error
}
2014-07-29 13:29:51 +04:00
type Tx interface {
Get(key []byte) ([]byte, error)
Put(key []byte, value []byte) error
Delete(key []byte) error
NewIterator() IIterator
NewWriteBatch() IWriteBatch
Commit() error
Rollback() error
}