Skip to content

Commit 9be7072

Browse files
committed
index: initial sortedkv get_blob_meta + test suite
1 parent 6f81400 commit 9be7072

4 files changed

Lines changed: 58 additions & 0 deletions

File tree

perkeepy/index/sortedkv/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,5 @@
1111
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
14+
15+
from .index import SortedKVIndex
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Copyright 2021 The Perkeepy Authors
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
from perkeepy.index import Indexer
16+
from perkeepy.index import test_index
17+
from perkeepy.index.sortedkv import SortedKVIndex
18+
from perkeepy.sortedkv.ordered_dict import OrderedDictSortedKV
19+
20+
21+
def test_sortedkv() -> None:
22+
def indexer_factory() -> Indexer:
23+
sorted_kv_indexer: Indexer = SortedKVIndex(
24+
sorted_kv=OrderedDictSortedKV(),
25+
)
26+
return sorted_kv_indexer
27+
28+
test_index.run_index_test(indexer_factory=indexer_factory)

perkeepy/index/test_index.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Copyright 2021 The Perkeepy Authors
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
from typing import Callable
16+
17+
from perkeepy.index import Indexer
18+
19+
20+
def run_index_test(indexer_factory: Callable[[], Indexer]) -> None:
21+
"""Suite of tests to validate an Indexer implementation"""
22+
23+
# Create and index a permanode
24+
# TODO: Create a permanode using a schema builder
25+
26+
assert indexer_factory

perkeepy/sortedkv/ordered_dict/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,5 @@
1111
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
14+
15+
from .ordered_dict import OrderedDictSortedKV

0 commit comments

Comments
 (0)