ledisdb/store/driver/driver.go

58 lines
805 B
Go
Raw Permalink Normal View History

2014-07-25 13:58:00 +04:00
package driver
type IDB interface {
Close() error
Get(key []byte) ([]byte, error)
Put(key []byte, value []byte) error
Delete(key []byte) error
2014-10-09 09:05:55 +04:00
SyncPut(key []byte, value []byte) error
SyncDelete(key []byte) error
2014-07-25 13:58:00 +04:00
NewIterator() IIterator
NewWriteBatch() IWriteBatch
2014-07-29 13:29:51 +04:00
2014-08-25 10:18:23 +04:00
NewSnapshot() (ISnapshot, error)
2014-09-12 11:06:36 +04:00
Compact() error
2014-07-25 13:58:00 +04:00
}
2014-08-25 10:18:23 +04:00
type ISnapshot interface {
Get(key []byte) ([]byte, error)
NewIterator() IIterator
Close()
}
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 {
Put(key []byte, value []byte)
Delete(key []byte)
Commit() error
2014-10-09 09:05:55 +04:00
SyncCommit() error
2014-07-25 13:58:00 +04:00
Rollback() error
Data() []byte
2014-11-10 10:31:36 +03:00
Close()
2014-07-25 13:58:00 +04:00
}
2014-07-29 13:29:51 +04:00
2014-10-29 05:29:35 +03:00
type ISliceGeter interface {
GetSlice(key []byte) (ISlice, error)
}