70ea2300ca
* Vendor: update gitea.com/macaron/session to a177a270 * make vendor * Vendor: update gitea.com/macaron/macaron to 0db5d458 * make vendor * Vendor: update gitea.com/macaron/cache to 905232fb * make vendor * Vendor: update gitea.com/macaron/i18n to 4ca3dd0c * make vendor * Vendor: update gitea.com/macaron/gzip to efa5e847 * make vendor * Vendor: update gitea.com/macaron/captcha to e8597820 * make vendor
67 lines
922 B
Go
Vendored
67 lines
922 B
Go
Vendored
package driver
|
|
|
|
import (
|
|
"errors"
|
|
)
|
|
|
|
var (
|
|
ErrTxSupport = errors.New("transaction is not supported")
|
|
)
|
|
|
|
type IDB interface {
|
|
Close() error
|
|
|
|
Get(key []byte) ([]byte, error)
|
|
|
|
Put(key []byte, value []byte) error
|
|
Delete(key []byte) error
|
|
|
|
NewIterator() IIterator
|
|
|
|
NewWriteBatch() IWriteBatch
|
|
|
|
NewSnapshot() (ISnapshot, error)
|
|
|
|
Begin() (Tx, error)
|
|
}
|
|
|
|
type ISnapshot interface {
|
|
Get(key []byte) ([]byte, error)
|
|
NewIterator() IIterator
|
|
Close()
|
|
}
|
|
|
|
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
|
|
Rollback() error
|
|
}
|
|
|
|
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
|
|
}
|