rainbowadn/rainbowadn/collection/trees/binary/core/binarycreation.py
2023-10-02 19:07:57 +00:00

31 lines
1.1 KiB
Python

from typing import Generic, Optional, TypeVar
from rainbowadn.collection.comparison import *
from rainbowadn.core import *
from .binarysplit import *
__all__ = ("BinaryCreation",)
TreeType = TypeVar("TreeType")
ActiveKeyType = TypeVar("ActiveKeyType", bound=Mentionable)
MetaDataType = TypeVar("MetaDataType", bound=Mentionable)
class BinaryCreation(Generic[ActiveKeyType, MetaDataType, TreeType]):
def __init__(self, comparator: Comparator[ActiveKeyType]):
assert isinstance(comparator, Comparator)
self.comparator = comparator
async def split(self, tree: TreeType) -> Optional[BinarySplit[ActiveKeyType, MetaDataType, TreeType]]:
"""result of this method is supposed to be used right after the call, therefore all values are resolved"""
raise NotImplementedError
async def tree(self, treel: TreeType, treer: TreeType, key: HashPoint[ActiveKeyType]) -> TreeType:
raise NotImplementedError
async def verify_metadata(
self, treel: TreeType, treer: TreeType, key: HashPoint[ActiveKeyType], metadata: HashPoint[MetaDataType]
) -> bool:
raise NotImplementedError