diff --git a/docs/references.md b/docs/references.md index 04a0f7d..0c57b93 100644 --- a/docs/references.md +++ b/docs/references.md @@ -829,6 +829,8 @@ alias of `rpc_pb2.DeleteRangeRequest` ### _class_ etcetra.types.EtcdLockOption(lock_name: 'str', timeout: 'Optional[float]', ttl: 'Optional[int]') +### _class_ etcetra.types.EtcdLockOptionV2(lock_name: 'bytes', timeout: 'Optional[float]', ttl: 'Optional[int]') + ### _class_ etcetra.types.HostPortPair(host: 'str', port: 'int') ### etcetra.types.PutRequestType() diff --git a/src/etcetra/__init__.py b/src/etcetra/__init__.py index 10b7589..d85ec40 100644 --- a/src/etcetra/__init__.py +++ b/src/etcetra/__init__.py @@ -4,12 +4,10 @@ __all__ = ( *_client.__all__, - *_client_v2.__all__, *_types.__all__, ) from .client import * # noqa -from .client_v2 import * # noqa from .types import * # noqa __version__ = '0.1.18' diff --git a/src/etcetra/client_v2.py b/src/etcetra/client_v2.py index d7f4144..1d10dc5 100644 --- a/src/etcetra/client_v2.py +++ b/src/etcetra/client_v2.py @@ -24,7 +24,7 @@ from .grpc_api import rpc_pb2, rpc_pb2_grpc from .grpc_api import v3lock_pb2, v3lock_pb2_grpc from .types import ( - DeleteRangeRequestType, EtcdCredential, EtcdLockOption, HostPortPair, + DeleteRangeRequestType, EtcdCredential, EtcdLockOptionV2 as EtcdLockOption, HostPortPair, PutRequestType, RangeRequestSortOrder, RangeRequestSortTarget, RangeRequestType, TransactionRequest, TxnReturnType, TxnReturnValues, WatchCreateRequestFilterType, WatchEvent, WatchEventType, @@ -130,7 +130,7 @@ def connect(self) -> EtcdConnectionManager: def with_lock( self, - lock_name: str, + lock_name: bytes, timeout: Optional[float] = None, ttl: Optional[int] = None, ) -> EtcdConnectionManager: diff --git a/src/etcetra/types.py b/src/etcetra/types.py index 78d153c..effef85 100644 --- a/src/etcetra/types.py +++ b/src/etcetra/types.py @@ -189,3 +189,9 @@ class EtcdLockOption: lock_name: str timeout: Optional[float] ttl: Optional[int] + +@dataclass +class EtcdLockOptionV2: + lock_name: bytes + timeout: Optional[float] + ttl: Optional[int]