2020-01-27 00:10:33 +08:00
|
|
|
from typing import Awaitable, Callable, Union
|
|
|
|
|
|
|
|
from libp2p.peer.id import ID
|
|
|
|
|
|
|
|
from .pb import rpc_pb2
|
|
|
|
|
|
|
|
SyncValidatorFn = Callable[[ID, rpc_pb2.Message], bool]
|
|
|
|
AsyncValidatorFn = Callable[[ID, rpc_pb2.Message], Awaitable[bool]]
|
|
|
|
ValidatorFn = Union[SyncValidatorFn, AsyncValidatorFn]
|
2020-01-28 00:29:05 +08:00
|
|
|
|
|
|
|
UnsubscribeFn = Callable[[], Awaitable[None]]
|