-
Notifications
You must be signed in to change notification settings - Fork 751
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: Add
KVPbApi::list_pb()
, simplify UdfMgr::get_udfs()
`KVPbApi::list_pb()` lists key value pairs by a prefix `DirName<K>`, and decodes key back to `kvapi::Key` and values back to `kvapi::Key::ValueType`. `UdfMgr::get_udfs()` is simplified by using `list_pb()`.
- Loading branch information
1 parent
d8713c6
commit ce4b569
Showing
8 changed files
with
298 additions
and
16 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
// Copyright 2021 Datafuse Labs | ||
// | ||
// 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. | ||
|
||
use databend_common_meta_types::SeqV; | ||
|
||
use crate::kvapi::Key; | ||
|
||
/// Key-Value item contains key and optional value with seq number. | ||
#[derive(Clone, Debug, PartialEq, Eq)] | ||
pub struct Item<K: Key> { | ||
pub key: K, | ||
pub seqv: Option<SeqV<K::ValueType>>, | ||
} | ||
|
||
impl<K: Key> Item<K> { | ||
pub fn new(key: K, seqv: Option<SeqV<K::ValueType>>) -> Self { | ||
Item { key, seqv } | ||
} | ||
} | ||
|
||
/// Key-Value item contains key and non-optional value with seq number. | ||
#[derive(Clone, Debug, PartialEq, Eq)] | ||
pub struct NonEmptyItem<K: Key> { | ||
pub key: K, | ||
pub seqv: SeqV<K::ValueType>, | ||
} | ||
|
||
impl<K: Key> NonEmptyItem<K> { | ||
pub fn new(key: K, seqv: SeqV<K::ValueType>) -> Self { | ||
NonEmptyItem { key, seqv } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.