Skip to content

Commit 55dec8f

Browse files
committed
full renaming
1 parent eb3db50 commit 55dec8f

File tree

8 files changed

+19
-19
lines changed

8 files changed

+19
-19
lines changed

examples/coordination/example.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ async def main():
2929
async def some_workload(driver, text):
3030
client = CoordinationClient(driver)
3131
await client.create_node("/local/node1")
32-
session = client.node("/local/node1")
32+
session = client.session("/local/node1")
3333
semaphore = session.lock("semaphore")
3434
for i in range(10):
3535
# print(f"{text} starting iteration {i}")
@@ -48,4 +48,4 @@ async def some_workload(driver, text):
4848

4949

5050
if __name__ == "__main__":
51-
asyncio.run(main())
51+
asyncio.run(main())

tests/coordination/test_coordination_client.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ async def test_coordination_node_lifecycle_async(self, async_coordination_node):
119119
async def test_coordination_lock_describe_full_async(self, async_coordination_node):
120120
client, node_path, _ = async_coordination_node
121121

122-
async with client.node(node_path) as node:
122+
async with client.session(node_path) as node:
123123
lock = node.lock("test_lock")
124124

125125
desc = await lock.describe()
@@ -139,7 +139,7 @@ async def test_coordination_lock_describe_full_async(self, async_coordination_no
139139
def test_coordination_lock_describe_full(self, sync_coordination_node):
140140
client, node_path, _ = sync_coordination_node
141141

142-
with client.node(node_path) as node:
142+
with client.session(node_path) as node:
143143
lock = node.lock("test_lock")
144144

145145
desc = lock.describe()
@@ -160,7 +160,7 @@ async def test_coordination_lock_racing_async(self, async_coordination_node):
160160
client, node_path, _ = async_coordination_node
161161
timeout = 5
162162

163-
async with client.node(node_path) as node:
163+
async with client.session(node_path) as node:
164164
lock2_started = asyncio.Event()
165165
lock2_acquired = asyncio.Event()
166166
lock2_release = asyncio.Event()
@@ -183,7 +183,7 @@ def test_coordination_lock_racing(self, sync_coordination_node):
183183
client, node_path, _ = sync_coordination_node
184184
timeout = 5
185185

186-
with client.node(node_path) as node:
186+
with client.session(node_path) as node:
187187
lock2_started = threading.Event()
188188
lock2_acquired = threading.Event()
189189
lock2_release = threading.Event()
@@ -207,7 +207,7 @@ def second_lock_task():
207207
async def test_coordination_reconnect_async(self, async_coordination_node):
208208
client, node_path, _ = async_coordination_node
209209

210-
async with client.node(node_path) as node:
210+
async with client.session(node_path) as node:
211211
lock = node.lock("test_lock")
212212

213213
async with lock:
@@ -221,7 +221,7 @@ async def test_coordination_reconnect_async(self, async_coordination_node):
221221
async def test_same_lock_cannot_be_acquired_twice(self, async_coordination_node):
222222
client, node_path, _ = async_coordination_node
223223

224-
async with client.node(node_path) as node:
224+
async with client.session(node_path) as node:
225225
lock1 = node.lock("lock1")
226226
lock1_1 = node.lock("lock1")
227227

ydb/aio/coordination/client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,5 +40,5 @@ async def delete_node(self, path: str, settings=None):
4040
settings=settings,
4141
)
4242

43-
def node(self, path: str) -> CoordinationNode:
43+
def session(self, path: str) -> CoordinationNode:
4444
return CoordinationNode(self._driver, path)

ydb/aio/coordination/node.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import asyncio
22

33
from .reconnector import CoordinationReconnector
4-
from .lock import CoordinationLock
4+
from .semaphore import CoordinationSemaphore
55

66

77
class CoordinationNode:
@@ -25,10 +25,10 @@ async def next_req_id(self) -> int:
2525
self._req_id += 1
2626
return self._req_id
2727

28-
def lock(self, name: str) -> CoordinationLock:
28+
def lock(self, name: str) -> CoordinationSemaphore:
2929
if self._closed:
3030
raise RuntimeError("CoordinationNode is closed")
31-
return CoordinationLock(self, name)
31+
return CoordinationSemaphore(self, name)
3232

3333
async def close(self):
3434
if self._closed:
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
)
1313

1414

15-
class CoordinationLock:
15+
class CoordinationSemaphore:
1616
def __init__(self, node, name: str):
1717
self._node = node
1818
self._name = name

ydb/coordination/client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,5 +36,5 @@ def delete_node(self, path: str, settings=None):
3636
settings=settings,
3737
)
3838

39-
def node(self, path: str) -> CoordinationNodeSync:
39+
def session(self, path: str) -> CoordinationNodeSync:
4040
return CoordinationNodeSync(self, path)

ydb/coordination/node_sync.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from .._topic_common.common import _get_shared_event_loop, CallFromSyncToAsync
22
from ..aio.coordination.node import CoordinationNode
3-
from .lock_sync import CoordinationLockSync
3+
from .semaphore_sync import CoordinationSemaphoreSync
44

55

66
class CoordinationNodeSync:
@@ -24,7 +24,7 @@ async def _make_node() -> CoordinationNode:
2424
)
2525

2626
def lock(self, name: str):
27-
return CoordinationLockSync(self, name)
27+
return CoordinationSemaphoreSync(self, name)
2828

2929
def close(self):
3030
if self._closed:
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,17 @@
22

33
from .. import issues
44
from .._topic_common.common import _get_shared_event_loop, CallFromSyncToAsync
5-
from ..aio.coordination.lock import CoordinationLock
5+
from ..aio.coordination.semaphore import CoordinationSemaphore
66

77

8-
class CoordinationLockSync:
8+
class CoordinationSemaphoreSync:
99
def __init__(self, node_sync, name: str, timeout_sec: float = 5):
1010
self._node_sync = node_sync
1111
self._name = name
1212
self._timeout_sec = timeout_sec
1313
self._closed = False
1414
self._caller = CallFromSyncToAsync(_get_shared_event_loop())
15-
self._async_lock: CoordinationLock = self._node_sync._async_node.lock(name)
15+
self._async_lock: CoordinationSemaphore = self._node_sync._async_node.lock(name)
1616

1717
def _check_closed(self):
1818
if self._closed:

0 commit comments

Comments
 (0)