Skip to content

Commit

Permalink
add lock option v2 and do not import client v2 in __init__
Browse files Browse the repository at this point in the history
  • Loading branch information
fregataa committed Dec 12, 2023
1 parent cd38d66 commit d780a78
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 4 deletions.
2 changes: 2 additions & 0 deletions docs/references.md
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
2 changes: 0 additions & 2 deletions src/etcetra/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'
4 changes: 2 additions & 2 deletions src/etcetra/client_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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:
Expand Down
6 changes: 6 additions & 0 deletions src/etcetra/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,3 +189,9 @@ class EtcdLockOption:
lock_name: str
timeout: Optional[float]
ttl: Optional[int]

@dataclass

Check failure on line 193 in src/etcetra/types.py

View workflow job for this annotation

GitHub Actions / lint

E302 expected 2 blank lines, found 1
class EtcdLockOptionV2:
lock_name: bytes
timeout: Optional[float]
ttl: Optional[int]

0 comments on commit d780a78

Please sign in to comment.