2021-04-19 11:13:52 +08:00
|
|
|
// Copyright (C) 2019-2020 Zilliz. All rights reserved.
|
|
|
|
//
|
|
|
|
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance
|
|
|
|
// with the License. You may obtain a copy of the License at
|
|
|
|
//
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
//
|
|
|
|
// Unless required by applicable law or agreed to in writing, software distributed under the License
|
|
|
|
// is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
|
|
|
|
// or implied. See the License for the specific language governing permissions and limitations under the License.
|
|
|
|
|
2020-11-16 21:10:43 +08:00
|
|
|
package kv
|
2020-09-07 21:07:36 +08:00
|
|
|
|
2021-05-18 14:18:02 +08:00
|
|
|
import (
|
|
|
|
"github.com/milvus-io/milvus/internal/util/typeutil"
|
|
|
|
)
|
|
|
|
|
2021-04-12 18:09:28 +08:00
|
|
|
type BaseKV interface {
|
2020-09-07 21:07:36 +08:00
|
|
|
Load(key string) (string, error)
|
2020-11-03 15:08:50 +08:00
|
|
|
MultiLoad(keys []string) ([]string, error)
|
2020-11-06 16:47:18 +08:00
|
|
|
LoadWithPrefix(key string) ([]string, []string, error)
|
2020-09-07 21:07:36 +08:00
|
|
|
Save(key, value string) error
|
2020-11-03 15:08:50 +08:00
|
|
|
MultiSave(kvs map[string]string) error
|
2020-09-07 21:07:36 +08:00
|
|
|
Remove(key string) error
|
2020-11-03 15:08:50 +08:00
|
|
|
MultiRemove(keys []string) error
|
2021-04-09 09:55:04 +08:00
|
|
|
RemoveWithPrefix(key string) error
|
2020-12-07 15:22:20 +08:00
|
|
|
|
2020-12-07 14:37:42 +08:00
|
|
|
Close()
|
2020-12-05 17:39:58 +08:00
|
|
|
}
|
2020-12-07 15:22:20 +08:00
|
|
|
|
2021-04-12 18:09:28 +08:00
|
|
|
type TxnKV interface {
|
|
|
|
BaseKV
|
2020-12-07 15:22:20 +08:00
|
|
|
MultiSaveAndRemove(saves map[string]string, removals []string) error
|
2021-03-06 16:00:41 +08:00
|
|
|
MultiRemoveWithPrefix(keys []string) error
|
|
|
|
MultiSaveAndRemoveWithPrefix(saves map[string]string, removals []string) error
|
2020-12-07 15:22:20 +08:00
|
|
|
}
|
2021-05-18 14:18:02 +08:00
|
|
|
|
|
|
|
type SnapShotKV interface {
|
|
|
|
Save(key, value string) (typeutil.Timestamp, error)
|
|
|
|
Load(key string, ts typeutil.Timestamp) (string, error)
|
2021-07-23 14:36:12 +08:00
|
|
|
MultiSave(kvs map[string]string, additions ...func(ts typeutil.Timestamp) (string, string, error)) (typeutil.Timestamp, error)
|
2021-05-18 14:18:02 +08:00
|
|
|
LoadWithPrefix(key string, ts typeutil.Timestamp) ([]string, []string, error)
|
2021-07-23 14:36:12 +08:00
|
|
|
MultiSaveAndRemoveWithPrefix(saves map[string]string, removals []string, additions ...func(ts typeutil.Timestamp) (string, string, error)) (typeutil.Timestamp, error)
|
2021-05-18 14:18:02 +08:00
|
|
|
}
|