2020-11-19 10:59:10 +08:00
## Appendix A. Basic Components
2021-04-12 12:45:38 +08:00
#### A.1 System Component
2020-11-19 10:59:10 +08:00
2021-10-27 18:40:25 +08:00
Milvus has 9 different components and can be abstracted into basic Components.
2021-04-12 12:45:38 +08:00
```go
type Component interface {
Init() error
Start() error
Stop() error
GetComponentStates(ctx context.Context) (*internalpb.ComponentStates, error)
GetStatisticsChannel(ctx context.Context) (*milvuspb.StringResponse, error)
2021-09-16 10:53:49 +08:00
Register() error
2020-11-19 10:59:10 +08:00
}
2021-04-12 12:45:38 +08:00
```
2021-10-04 08:40:06 +08:00
- _GetComponentStates_
2021-04-12 12:45:38 +08:00
```go
2020-11-19 10:59:10 +08:00
2021-04-12 12:45:38 +08:00
type StateCode = int
const (
INITIALIZING StateCode = 0
HEALTHY StateCode = 1
ABNORMAL StateCode = 2
)
type ComponentInfo struct {
NodeID UniqueID
Role string
StateCode StateCode
ExtraInfo []*commonpb.KeyValuePair
2020-11-19 10:59:10 +08:00
}
2021-04-12 12:45:38 +08:00
type ComponentStates struct {
State *ComponentInfo
SubcomponentStates []*ComponentInfo
Status *commonpb.Status
2020-11-19 10:59:10 +08:00
}
2021-04-12 12:45:38 +08:00
```
2021-10-27 18:40:25 +08:00
If a component needs to process timetick message to align timetick, it needs to implement the TimeTickProvider interface.
2020-11-19 10:59:10 +08:00
2021-04-12 12:45:38 +08:00
```go
type TimeTickProvider interface {
GetTimeTickChannel(ctx context.Context) (*milvuspb.StringResponse, error)
}
2020-11-19 10:59:10 +08:00
```
2021-05-14 17:09:14 +08:00
#### A.2 Session
2021-10-04 08:40:06 +08:00
2021-05-14 17:09:14 +08:00
###### ServerID
2020-11-19 10:59:10 +08:00
2021-09-16 13:33:49 +08:00
The ID is stored in a key-value pair on etcd. The key is metaRootPath + "/session/id". The initial value is 0. When a service is registered, it is incremented by 1 and returned to the next registered service.
2021-04-12 12:45:38 +08:00
2021-09-16 09:19:49 +08:00
###### Registration
2021-05-14 17:09:14 +08:00
2021-10-04 08:40:06 +08:00
- Registration is achieved through etcd's lease mechanism.
2021-05-14 17:09:14 +08:00
2021-10-04 08:40:06 +08:00
- The service creates a lease with etcd and stores a key-value pair in etcd. If the lease expires or the service goes offline, etcd will delete the key-value pair. You can judge whether this service is available through the key.
2021-05-14 17:09:14 +08:00
2021-10-04 08:40:06 +08:00
- key: metaRoot + "/session" + "/ServerName(-ServerID)(optional)"
2021-05-14 17:09:14 +08:00
2021-10-04 08:40:06 +08:00
- value: json format
2021-05-18 19:07:27 +08:00
```json
2021-05-14 17:09:14 +08:00
{
2021-05-18 19:07:27 +08:00
"ServerID": "ServerID",
"ServerName": "ServerName",
"Address": "ip:port",
2021-10-04 08:40:06 +08:00
"Exclusive": "Exclusive"
2021-05-14 17:09:14 +08:00
}
2021-05-18 19:07:27 +08:00
```
2021-10-04 08:40:06 +08:00
- By obtaining the address, you can establish a connection with other services
2021-05-14 17:09:14 +08:00
2021-10-04 08:40:06 +08:00
- If a service is exclusive, the key will not have **ServerID** . But **ServerID** still will be stored in value.
2021-05-14 17:09:14 +08:00
###### Discovery
2021-10-04 08:40:06 +08:00
- All currently available services can be obtained by obtaining all the key-value pairs deposited during registration. If you want to get all the available nodes for a certain type of service, you can pass in the prefix of the corresponding key
2021-05-14 17:09:14 +08:00
2021-10-04 08:40:06 +08:00
- Registration time can be compared with ServerID for ServerID will increase according to time.
2021-05-14 17:09:14 +08:00
###### Interface
2021-10-04 08:40:06 +08:00
````go
2021-06-23 17:14:10 +08:00
const (
DefaultServiceRoot = "session/"
DefaultIDKey = "id"
DefaultRetryTimes = 30
2021-10-04 08:40:06 +08:00
DefaultTTL = 60
2021-06-23 17:14:10 +08:00
)
2021-05-14 17:09:14 +08:00
2021-05-18 11:39:21 +08:00
// Session is a struct to store service's session, including ServerID, ServerName,
// Address.
2021-06-23 17:14:10 +08:00
// Exclusive indicates that this server can only start one.
2021-05-14 17:09:14 +08:00
type Session struct {
2021-05-24 11:53:07 +08:00
ctx context.Context
ServerID int64 `json:"ServerID,omitempty"`
ServerName string `json:"ServerName,omitempty"`
Address string `json:"Address,omitempty"`
Exclusive bool `json:"Exclusive,omitempty"`
2021-05-14 17:09:14 +08:00
}
2021-06-23 17:14:10 +08:00
// NewSession is a helper to build Session object.
// ServerID, ServerName, Address, Exclusive will be assigned after registeration.
// metaRoot is a path in etcd to save session information.
// etcdEndpoints is to init etcdCli when NewSession
func NewSession(ctx context.Context, metaRoot string, etcdEndpoints []string) *Session {}
2021-05-24 11:53:07 +08:00
2021-06-23 17:14:10 +08:00
// Init will initialize base struct of the Session, including ServerName, ServerID,
// Address, Exclusive. ServerID is obtained in getServerID.
// Finally it will process keepAliveResponse to keep alive with etcd.
2021-05-24 11:53:07 +08:00
func (s *Session) Init(serverName, address string, exclusive bool) < -chan bool { }
2021-06-23 17:14:10 +08:00
// GetSessions will get all sessions registered in etcd.
// Revision is returned for WatchServices to prevent key events from being missed.
func (s *Session) GetSessions(prefix string) (map[string]*Session, int64, error) {}
// WatchServices watch the service's up and down in etcd, and send event to
// eventChannel.
// prefix is a parameter to know which service to watch and can be obtained in
// typeutil.type.go.
2021-10-11 19:24:54 +08:00
// revision is an etcd reversion to prevent missing key events and can be obtained
2021-06-23 17:14:10 +08:00
// in GetSessions.
2021-10-11 19:24:54 +08:00
// If a server up, an event will be added to channel with eventType SessionAddType.
// If a server down, an event will be added to channel with eventType SessionDelType.
2021-06-23 17:14:10 +08:00
func (s *Session) WatchServices(prefix string, revision int64) (eventChannel < -chan * SessionEvent ) { }
2021-05-14 17:09:14 +08:00
#### A.3 Global Parameter Table
2020-11-19 10:59:10 +08:00
``` go
2021-04-12 12:45:38 +08:00
type BaseTable struct {
params *memkv.MemoryKV
2020-11-19 10:59:10 +08:00
}
2021-04-12 12:45:38 +08:00
func (gp *BaseTable) Init()
func (gp *BaseTable) LoadFromKVPair(kvPairs []*commonpb.KeyValuePair) error
func (gp *BaseTable) Load(key string) (string, error)
func (gp *BaseTable) LoadRange(key, endKey string, limit int) ([]string, []string, error)
func (gp *BaseTable) LoadYaml(fileName string) error
func (gp *BaseTable) LoadYaml(fileName string) error
func (gp *BaseTable) LoadYaml(fileName string) error
func (gp *BaseTable) ParseFloat(key string) float64
func (gp *BaseTable) ParseInt64(key string) int64
func (gp *BaseTable) ParseInt32(key string) int32
func (gp *BaseTable) ParseInt(key string) int
func (gp *BaseTable) WriteNodeIDList() []UniqueID
func (gp *BaseTable) DataNodeIDList() []UniqueID
func (gp *BaseTable) ProxyIDList() []UniqueID
func (gp *BaseTable) QueryNodeIDList() []UniqueID
2021-10-04 08:40:06 +08:00
````
2020-11-19 10:59:10 +08:00
2021-10-04 08:40:06 +08:00
- _LoadYaml(filePath string)_ turns a YAML file into multiple key-value pairs. For example, given the following YAML
2020-11-19 10:59:10 +08:00
```yaml
etcd:
address: localhost
2021-04-12 12:45:38 +08:00
port: 2379
2020-11-19 10:59:10 +08:00
rootpath: milvus/etcd
```
2021-10-04 08:40:06 +08:00
_BaseTable.LoadYaml_ will insert three key-value pairs into _params_
2020-11-19 10:59:10 +08:00
```go
2021-04-12 12:45:38 +08:00
"etcd.address" -> "localhost"
"etcd.port" -> "2379"
"etcd.rootpath" -> "milvus/etcd"
2020-11-19 10:59:10 +08:00
```
#### A.4 Time Ticked Flow Graph
2021-04-12 12:45:38 +08:00
//TODO remove?
2021-10-04 08:40:06 +08:00
2020-11-19 10:59:10 +08:00
###### A.4.1 Flow Graph States
```go
type flowGraphStates struct {
2021-04-12 12:45:38 +08:00
startTick Timestamp
numActiveTasks map[string]int32
numCompletedTasks map[string]int64
2020-11-19 10:59:10 +08:00
}
```
###### A.4.2 Message
```go
type Msg interface {
2021-04-12 12:45:38 +08:00
TimeTick() Timestamp
2020-11-19 10:59:10 +08:00
}
```
###### A.4.3 Node
```go
type Node interface {
2021-04-12 12:45:38 +08:00
Name() string
MaxQueueLength() int32
MaxParallelism() int32
Operate(ctx context.Context, in []Msg) ([]Msg, context.Context)
IsInputNode() bool
Close()
2020-11-19 10:59:10 +08:00
}
```
```go
2021-04-12 12:45:38 +08:00
type BaseNode struct {
maxQueueLength int32
maxParallelism int32
2020-11-19 10:59:10 +08:00
}
```
###### A.4.4 Flow Graph
```go
type nodeCtx struct {
2021-04-12 12:45:38 +08:00
node Node
inputChannels []chan Msg
inputMessages []Msg
downstream []*nodeCtx
downstreamInputChanIdx map[string]int
NumActiveTasks int64
NumCompletedTasks int64
2020-11-19 10:59:10 +08:00
}
func (nodeCtx *nodeCtx) Start(ctx context.Context) error
```
2021-10-04 08:40:06 +08:00
_Start()_ will enter a loop. In each iteration, it tries to collect input messages from _inputChan_ , then prepares the node's input. When the input is ready, it will trigger _node.Operate_ . When _node.Operate_ returns, it sends the returned _Msg_ to _outputChans_ , which connects to the downstreams' _inputChans_ .
2020-11-19 10:59:10 +08:00
```go
type TimeTickedFlowGraph struct {
2021-04-12 12:45:38 +08:00
ctx context.Context
nodeCtx map[NodeName]*nodeCtx
2020-11-19 10:59:10 +08:00
}
2021-03-04 10:35:28 +08:00
func (*pipeline TimeTickedFlowGraph) AddNode(node Node)
2020-11-19 10:59:10 +08:00
func (*pipeline TimeTickedFlowGraph) SetEdges(nodeName string, in []string, out []string)
func (*pipeline TimeTickedFlowGraph) Start() error
func (*pipeline TimeTickedFlowGraph) Close() error
func NewTimeTickedFlowGraph(ctx context.Context) *TimeTickedFlowGraph
```
2021-04-12 12:45:38 +08:00
#### A.5 Allocator
```go
type Allocator struct {
Ctx context.Context
CancelFunc context.CancelFunc
wg sync.WaitGroup
Reqs chan Request
ToDoReqs []Request
CanDoReqs []Request
SyncReqs []Request
2020-11-19 10:59:10 +08:00
2021-04-12 12:45:38 +08:00
TChan TickerChan
ForceSyncChan chan Request
2020-11-19 10:59:10 +08:00
2021-04-12 12:45:38 +08:00
SyncFunc func() bool
ProcessFunc func(req Request) error
CheckSyncFunc func(timeout bool) bool
PickCanDoFunc func()
2021-09-14 17:25:56 +08:00
SyncErr error
Role string
2021-04-12 12:45:38 +08:00
}
func (ta *Allocator) Start() error
func (ta *Allocator) Init() error
func (ta *Allocator) Close() error
func (ta *Allocator) CleanCache() error
```
#### A.6 ID Allocator
2020-11-19 10:59:10 +08:00
```go
2021-03-04 10:35:28 +08:00
type IDAllocator struct {
2021-04-12 12:45:38 +08:00
Allocator
2021-06-23 16:14:08 +08:00
rootCoordAddress string
rootCoord types.RootCoord
2021-04-12 12:45:38 +08:00
countPerRPC uint32
idStart UniqueID
idEnd UniqueID
PeerID UniqueID
2020-11-19 10:59:10 +08:00
}
2021-03-04 10:35:28 +08:00
func (ia *IDAllocator) Start() error
func (ia *IDAllocator) AllocOne() (UniqueID, error)
func (ia *IDAllocator) Alloc(count uint32) (UniqueID, UniqueID, error)
2020-11-19 10:59:10 +08:00
2021-03-04 10:35:28 +08:00
func NewIDAllocator(ctx context.Context, masterAddr string) (*IDAllocator, error)
2020-11-19 10:59:10 +08:00
```
2020-11-21 11:39:23 +08:00
#### A.6 Timestamp Allocator
###### A.6.1 Timestamp
2021-10-27 18:40:25 +08:00
Let's take a brief review of the Hybrid Logical Clock (HLC). HLC uses 64bits timestamps which are composed of a 46-bits physical component (thought of as and always close to local wall time) and an 18-bits logical component (used to distinguish between events with the same physical component).
2020-11-21 11:39:23 +08:00
2020-12-22 14:47:55 +08:00
< img src = "./figs/hlc.png" width = 400 >
2020-11-21 11:39:23 +08:00
2021-09-15 21:09:49 +08:00
HLC's logical part is advanced on each request. The physical part can be increased in two cases:
2020-11-21 11:39:23 +08:00
A. when the local wall time is greater than HLC's physical part,
B. or the logical part overflows.
2021-09-15 21:09:49 +08:00
In either case, the physical part will be updated, and the logical part will be set to 0.
2020-11-21 11:39:23 +08:00
2021-11-16 19:31:16 +08:00
Keeping the physical part close to local wall time may face non-monotonic problems such as updates to POSIX time that could turn time backward. HLC avoids such problems, since if 'local wall time < HLC ' s physical part ' holds , only case B is satisfied , thus monotonicity is guaranteed .
2020-11-21 11:39:23 +08:00
2021-12-21 15:42:28 +08:00
Milvus does not support the transaction, but it should guarantee the deterministic execution of the multi-way WAL. The timestamp attached to each request should
2020-11-21 11:39:23 +08:00
2021-09-15 21:09:49 +08:00
- have its physical part close to wall time (has an acceptable bounded error, a.k.a. uncertainty interval in transaction scenarios),
2020-11-21 11:39:23 +08:00
- and be globally unique.
2021-09-15 21:09:49 +08:00
HLC leverages physical clocks at nodes that are synchronized using the NTP. NTP usually maintains time to within tens of milliseconds over local networks in the datacenter. Asymmetric routes and network congestion occasionally cause errors of hundreds of milliseconds. Both the normal time error and the spike are acceptable for Milvus use cases.
2020-11-21 11:39:23 +08:00
The interface of Timestamp is as follows.
```
type timestamp struct {
2021-04-12 12:45:38 +08:00
physical uint64 // 18-63 bits
logical uint64 // 0-17 bits
2020-11-21 11:39:23 +08:00
}
type Timestamp uint64
```
###### A.6.2 Timestamp Oracle
```go
type timestampOracle struct {
2021-04-12 12:45:38 +08:00
key string
2021-11-16 19:29:23 +08:00
txnkv kv.TxnKV
2021-04-12 12:45:38 +08:00
saveInterval time.Duration
maxResetTSGap func() time.Duration
TSO unsafe.Pointer
lastSavedTime atomic.Value
2020-11-21 11:39:23 +08:00
}
2021-03-04 10:35:28 +08:00
func (t *timestampOracle) InitTimestamp() error
func (t *timestampOracle) ResetUserTimestamp(tso uint64) error
func (t *timestampOracle) UpdateTimestamp() error
func (t *timestampOracle) ResetTimestamp()
2020-11-21 11:39:23 +08:00
```
###### A.6.3 Timestamp Allocator
```go
2021-03-04 10:35:28 +08:00
type TimestampAllocator struct {
2021-04-12 12:45:38 +08:00
Allocator
2021-06-23 16:14:08 +08:00
rootCoordAddress string
rootCoordClient types.RootCoord
2021-04-12 12:45:38 +08:00
countPerRPC uint32
lastTsBegin Timestamp
lastTsEnd Timestamp
PeerID UniqueID
2021-03-04 10:35:28 +08:00
}
2020-11-21 11:39:23 +08:00
2021-03-04 10:35:28 +08:00
func (ta *TimestampAllocator) Start() error
func (ta *TimestampAllocator) AllocOne() (UniqueID, error)
func (ta *TimestampAllocator) Alloc(count uint32) (UniqueID, UniqueID, error)
func (ta *TimestampAllocator) ClearCache()
func NewTimestampAllocator(ctx context.Context, masterAddr string) (*TimestampAllocator, error)
2020-11-21 11:39:23 +08:00
```
2021-10-04 08:40:06 +08:00
- Batch Allocation of Timestamps
2020-11-21 11:39:23 +08:00
2021-10-04 08:40:06 +08:00
- Expiration of Timestamps
2020-11-21 11:39:23 +08:00
#### A.7 KV
###### A.7.1 KV Base
2020-11-19 10:59:10 +08:00
```go
2021-04-12 12:45:38 +08:00
type BaseKV interface {
Load(key string) (string, error)
MultiLoad(keys []string) ([]string, error)
LoadWithPrefix(key string) ([]string, []string, error)
Save(key, value string) error
MultiSave(kvs map[string]string) error
Remove(key string) error
MultiRemove(keys []string) error
2021-09-14 17:25:56 +08:00
RemoveWithPrefix(key string) error
2021-04-12 12:45:38 +08:00
Close()
2020-11-19 10:59:10 +08:00
}
```
2021-03-04 10:35:28 +08:00
###### A.7.2 Txn Base
2020-11-19 10:59:10 +08:00
2021-03-04 10:35:28 +08:00
```go
2021-04-12 12:45:38 +08:00
type TxnKV interface {
BaseKV
2021-09-16 09:19:49 +08:00
2021-04-12 12:45:38 +08:00
MultiSaveAndRemove(saves map[string]string, removals []string) error
MultiRemoveWithPrefix(keys []string) error
MultiSaveAndRemoveWithPrefix(saves map[string]string, removals []string) error
2021-03-04 10:35:28 +08:00
}
```
2020-11-19 10:59:10 +08:00
2021-09-14 17:25:56 +08:00
###### A.7.3 MetaKv
2020-11-19 10:59:10 +08:00
2021-09-16 09:19:49 +08:00
```go
2021-11-06 12:19:31 +08:00
// MetaKv is TxnKV for meta data. It should save data with lease.
2021-09-14 17:25:56 +08:00
type MetaKv interface {
TxnKV
GetPath(key string) string
LoadWithPrefix(key string) ([]string, []string, error)
LoadWithPrefix2(key string) ([]string, []string, []int64, error)
LoadWithRevision(key string) ([]string, []string, int64, error)
Watch(key string) clientv3.WatchChan
WatchWithPrefix(key string) clientv3.WatchChan
WatchWithRevision(key string, revision int64) clientv3.WatchChan
SaveWithLease(key, value string, id clientv3.LeaseID) error
Grant(ttl int64) (id clientv3.LeaseID, err error)
KeepAlive(id clientv3.LeaseID) (< -chan * clientv3 . LeaseKeepAliveResponse , error )
CompareValueAndSwap(key, value, target string, opts ...clientv3.OpOption) error
CompareVersionAndSwap(key string, version int64, target string, opts ...clientv3.OpOption) error
}
```
###### A.7.4 MetaKv
```go
2021-11-15 09:17:13 +08:00
// SnapShotKV is TxnKV for snapshot data. It must save timestamp.
2021-09-14 17:25:56 +08:00
type SnapShotKV interface {
Save(key string, value string, ts typeutil.Timestamp) error
Load(key string, ts typeutil.Timestamp) (string, error)
MultiSave(kvs map[string]string, ts typeutil.Timestamp, additions ...func(ts typeutil.Timestamp) (string, string, error)) error
LoadWithPrefix(key string, ts typeutil.Timestamp) ([]string, []string, error)
MultiSaveAndRemoveWithPrefix(saves map[string]string, removals []string, ts typeutil.Timestamp, additions ...func(ts typeutil.Timestamp) (string, string, error)) error
```
2021-03-04 10:35:28 +08:00
2021-09-14 17:25:56 +08:00
###### A.7.5 Etcd KV
2020-11-19 10:59:10 +08:00
```go
type EtcdKV struct {
client *clientv3.Client
rootPath string
}
2021-03-04 10:35:28 +08:00
func (kv *EtcdKV) Close()
func (kv *EtcdKV) GetPath(key string) string
func (kv *EtcdKV) LoadWithPrefix(key string) ([]string, []string, error)
func (kv *EtcdKV) Load(key string) (string, error)
func (kv *EtcdKV) GetCount(key string) (int64, error)
func (kv *EtcdKV) MultiLoad(keys []string) ([]string, error)
func (kv *EtcdKV) Save(key, value string) error
func (kv *EtcdKV) MultiSave(kvs map[string]string) error
func (kv *EtcdKV) RemoveWithPrefix(prefix string) error
func (kv *EtcdKV) Remove(key string) error
func (kv *EtcdKV) MultiRemove(keys []string) error
func (kv *EtcdKV) MultiSaveAndRemove(saves map[string]string, removals []string) error
func (kv *EtcdKV) Watch(key string) clientv3.WatchChan
func (kv *EtcdKV) WatchWithPrefix(key string) clientv3.WatchChan
2021-10-20 19:34:05 +08:00
func (kv *EtcdKV) WatchWithRevision(key string, revision int64) clientv3.WatchChan
2021-03-04 10:35:28 +08:00
2020-11-19 10:59:10 +08:00
func NewEtcdKV(etcdAddr string, rootPath string) *EtcdKV
```
2021-10-04 08:40:06 +08:00
EtcdKV implements all _TxnKV_ interfaces.
2021-04-12 12:45:38 +08:00
2021-09-14 17:25:56 +08:00
###### A.7.6 Memory KV
2021-04-12 12:45:38 +08:00
```go
type MemoryKV struct {
sync.RWMutex
tree *btree.BTree
}
func (s memoryKVItem) Less(than btree.Item) bool
func (kv *MemoryKV) Load(key string) (string, error)
func (kv *MemoryKV) LoadRange(key, endKey string, limit int) ([]string, []string, error)
func (kv *MemoryKV) Save(key, value string) error
func (kv *MemoryKV) Remove(key string) error
func (kv *MemoryKV) MultiLoad(keys []string) ([]string, error)
func (kv *MemoryKV) MultiSave(kvs map[string]string) error
func (kv *MemoryKV) MultiRemove(keys []string) error
func (kv *MemoryKV) MultiSaveAndRemove(saves map[string]string, removals []string) error
func (kv *MemoryKV) LoadWithPrefix(key string) ([]string, []string, error)
func (kv *MemoryKV) Close()
func (kv *MemoryKV) MultiRemoveWithPrefix(keys []string) error
func (kv *MemoryKV) MultiSaveAndRemoveWithPrefix(saves map[string]string, removals []string) error
```
2021-10-04 08:40:06 +08:00
MemoryKV implements all _TxnKV_ interfaces.
2021-04-12 12:45:38 +08:00
2021-09-14 17:25:56 +08:00
###### A.7.7 MinIO KV
2021-04-12 12:45:38 +08:00
```go
type MinIOKV struct {
ctx context.Context
minioClient *minio.Client
bucketName string
}
func (kv *MinIOKV) LoadWithPrefix(key string) ([]string, []string, error)
func (kv *MinIOKV) Load(key string) (string, error)
func (kv *MinIOKV) MultiLoad(keys []string) ([]string, error)
func (kv *MinIOKV) Save(key, value string) error
func (kv *MinIOKV) MultiSave(kvs map[string]string) error
func (kv *MinIOKV) RemoveWithPrefix(key string) error
func (kv *MinIOKV) Remove(key string) error
func (kv *MinIOKV) MultiRemove(keys []string) error
func (kv *MinIOKV) Close()
```
2021-10-04 08:40:06 +08:00
MinIOKV implements all _KV_ interfaces.
2021-04-12 12:45:38 +08:00
2021-09-14 17:25:56 +08:00
###### A.7.8 RocksdbKV KV
2021-04-12 12:45:38 +08:00
```go
type RocksdbKV struct {
opts *gorocksdb.Options
db *gorocksdb.DB
writeOptions *gorocksdb.WriteOptions
readOptions *gorocksdb.ReadOptions
name string
}
func (kv *RocksdbKV) Close()
func (kv *RocksdbKV) GetName() string
func (kv *RocksdbKV) Load(key string) (string, error)
func (kv *RocksdbKV) LoadWithPrefix(key string) ([]string, []string, error)
func (kv *RocksdbKV) MultiLoad(keys []string) ([]string, error)
func (kv *RocksdbKV) Save(key, value string) error
func (kv *RocksdbKV) MultiSave(kvs map[string]string) error
func (kv *RocksdbKV) RemoveWithPrefix(key string) error
func (kv *RocksdbKV) Remove(key string) error
func (kv *RocksdbKV) MultiRemove(keys []string) error
func (kv *RocksdbKV) MultiSaveAndRemove(saves map[string]string, removals []string) error
func (kv *RocksdbKV) MultiRemoveWithPrefix(keys []string) error
func (kv *RocksdbKV) MultiSaveAndRemoveWithPrefix(saves map[string]string, removals []string) error
```
2021-10-04 08:40:06 +08:00
RocksdbKV implements all _TxnKV_ interfaces.h