27 lines
734 B
Python
27 lines
734 B
Python
from typing import Generic, Optional, TypeVar
|
|
|
|
from .binarycreation import *
|
|
from .binarysplit import *
|
|
|
|
__all__ = ('BinaryProtocolized',)
|
|
|
|
TreeType = TypeVar('TreeType')
|
|
ActiveKeyType = TypeVar('ActiveKeyType')
|
|
MetaDataType = TypeVar('MetaDataType')
|
|
|
|
|
|
class BinaryProtocolized(
|
|
Generic[ActiveKeyType, MetaDataType, TreeType]
|
|
):
|
|
def __init__(
|
|
self,
|
|
creation: BinaryCreation[ActiveKeyType, MetaDataType, TreeType],
|
|
tree: TreeType
|
|
):
|
|
assert isinstance(creation, BinaryCreation)
|
|
self.creation = creation
|
|
self.tree = tree
|
|
|
|
async def split(self) -> Optional[BinarySplit[ActiveKeyType, MetaDataType, TreeType]]:
|
|
return await self.creation.split(self.tree)
|