cafs-cache-cdn-client 1.0.5__tar.gz → 1.0.7__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {cafs_cache_cdn_client-1.0.5 → cafs_cache_cdn_client-1.0.7}/PKG-INFO +2 -2
- {cafs_cache_cdn_client-1.0.5 → cafs_cache_cdn_client-1.0.7}/cafs_cache_cdn_client/cafs/client.py +22 -11
- {cafs_cache_cdn_client-1.0.5 → cafs_cache_cdn_client-1.0.7}/cafs_cache_cdn_client/file_utils.py +3 -2
- {cafs_cache_cdn_client-1.0.5 → cafs_cache_cdn_client-1.0.7}/cafs_cache_cdn_client/repo/client.py +1 -1
- {cafs_cache_cdn_client-1.0.5 → cafs_cache_cdn_client-1.0.7}/pyproject.toml +2 -2
- {cafs_cache_cdn_client-1.0.5 → cafs_cache_cdn_client-1.0.7}/README.md +0 -0
- {cafs_cache_cdn_client-1.0.5 → cafs_cache_cdn_client-1.0.7}/cafs_cache_cdn_client/__init__.py +0 -0
- {cafs_cache_cdn_client-1.0.5 → cafs_cache_cdn_client-1.0.7}/cafs_cache_cdn_client/cafs/README.md +0 -0
- {cafs_cache_cdn_client-1.0.5 → cafs_cache_cdn_client-1.0.7}/cafs_cache_cdn_client/cafs/__init__.py +0 -0
- {cafs_cache_cdn_client-1.0.5 → cafs_cache_cdn_client-1.0.7}/cafs_cache_cdn_client/cafs/blob/__init__.py +0 -0
- {cafs_cache_cdn_client-1.0.5 → cafs_cache_cdn_client-1.0.7}/cafs_cache_cdn_client/cafs/blob/hash_.py +0 -0
- {cafs_cache_cdn_client-1.0.5 → cafs_cache_cdn_client-1.0.7}/cafs_cache_cdn_client/cafs/blob/package.py +0 -0
- {cafs_cache_cdn_client-1.0.5 → cafs_cache_cdn_client-1.0.7}/cafs_cache_cdn_client/cafs/blob/utils.py +0 -0
- {cafs_cache_cdn_client-1.0.5 → cafs_cache_cdn_client-1.0.7}/cafs_cache_cdn_client/cafs/exceptions.py +0 -0
- {cafs_cache_cdn_client-1.0.5 → cafs_cache_cdn_client-1.0.7}/cafs_cache_cdn_client/cafs/types.py +0 -0
- {cafs_cache_cdn_client-1.0.5 → cafs_cache_cdn_client-1.0.7}/cafs_cache_cdn_client/client.py +0 -0
- {cafs_cache_cdn_client-1.0.5 → cafs_cache_cdn_client-1.0.7}/cafs_cache_cdn_client/repo/__init__.py +0 -0
- {cafs_cache_cdn_client-1.0.5 → cafs_cache_cdn_client-1.0.7}/cafs_cache_cdn_client/repo/datatypes.py +0 -0
@@ -1,13 +1,13 @@
|
|
1
1
|
Metadata-Version: 2.3
|
2
2
|
Name: cafs-cache-cdn-client
|
3
|
-
Version: 1.0.
|
3
|
+
Version: 1.0.7
|
4
4
|
Summary: Async Cache CDN client implementation
|
5
5
|
Keywords: cafs,cache
|
6
6
|
Author: Konstantin Belov
|
7
7
|
Author-email: k.belov@gaijin.team
|
8
8
|
Requires-Python: >=3.11,<4.0
|
9
9
|
Classifier: License :: OSI Approved :: MIT License
|
10
|
-
Classifier: Development Status ::
|
10
|
+
Classifier: Development Status :: 4 - Beta
|
11
11
|
Classifier: Programming Language :: Python :: 3.11
|
12
12
|
Classifier: Programming Language :: Python :: 3.12
|
13
13
|
Classifier: Programming Language :: Python :: 3.13
|
{cafs_cache_cdn_client-1.0.5 → cafs_cache_cdn_client-1.0.7}/cafs_cache_cdn_client/cafs/client.py
RENAMED
@@ -1,5 +1,4 @@
|
|
1
1
|
import asyncio
|
2
|
-
from asyncio import Queue, QueueShutDown
|
3
2
|
from collections.abc import (
|
4
3
|
AsyncIterator,
|
5
4
|
Callable,
|
@@ -282,7 +281,8 @@ class ConnectionPool:
|
|
282
281
|
|
283
282
|
_lock: asyncio.Lock
|
284
283
|
_connections: set[CAFSConnection]
|
285
|
-
_connection_queue: Queue[CAFSConnection]
|
284
|
+
_connection_queue: asyncio.Queue[CAFSConnection]
|
285
|
+
_close_event: asyncio.Event
|
286
286
|
|
287
287
|
def __init__(
|
288
288
|
self,
|
@@ -297,8 +297,9 @@ class ConnectionPool:
|
|
297
297
|
self.connection_per_server = connection_per_server
|
298
298
|
|
299
299
|
self._connections = set()
|
300
|
-
self._connection_queue = Queue()
|
300
|
+
self._connection_queue = asyncio.Queue()
|
301
301
|
self._lock = asyncio.Lock()
|
302
|
+
self._close_event = asyncio.Event()
|
302
303
|
|
303
304
|
async def get_connection_count(self) -> int:
|
304
305
|
async with self._lock:
|
@@ -315,10 +316,21 @@ class ConnectionPool:
|
|
315
316
|
await self._connection_queue.put(conn)
|
316
317
|
|
317
318
|
async def _get_connection(self) -> CAFSConnection:
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
319
|
+
if self._close_event.is_set():
|
320
|
+
raise EmptyConnectionPoolError()
|
321
|
+
get_task = asyncio.create_task(self._connection_queue.get())
|
322
|
+
close_task = asyncio.create_task(self._close_event.wait())
|
323
|
+
_, pending = await asyncio.wait(
|
324
|
+
[get_task, close_task], return_when=asyncio.FIRST_COMPLETED
|
325
|
+
)
|
326
|
+
|
327
|
+
for task in pending:
|
328
|
+
task.cancel()
|
329
|
+
|
330
|
+
if get_task in pending:
|
331
|
+
raise EmptyConnectionPoolError()
|
332
|
+
|
333
|
+
return get_task.result()
|
322
334
|
|
323
335
|
async def _release_connection(self, conn: CAFSConnection) -> None:
|
324
336
|
await self._connection_queue.put(conn)
|
@@ -328,14 +340,15 @@ class ConnectionPool:
|
|
328
340
|
async with self._lock:
|
329
341
|
self._connections.remove(conn)
|
330
342
|
if not self._connections:
|
331
|
-
self.
|
343
|
+
self._close_event.set()
|
332
344
|
|
333
345
|
async def close(self) -> None:
|
334
346
|
async with self._lock:
|
335
|
-
self.
|
347
|
+
self._close_event.set()
|
336
348
|
for conn in self._connections:
|
337
349
|
if conn.is_connected:
|
338
350
|
await conn.disconnect()
|
351
|
+
self._connections.clear()
|
339
352
|
|
340
353
|
@asynccontextmanager
|
341
354
|
async def connection(self) -> AsyncIterator[CAFSConnection]:
|
@@ -428,7 +441,6 @@ class CAFSClient:
|
|
428
441
|
stop_event = asyncio.Event()
|
429
442
|
workers = [asyncio.create_task(worker(stop_event)) for _ in range(len(blobs))]
|
430
443
|
errors = await asyncio.gather(*workers, return_exceptions=True)
|
431
|
-
files_queue.shutdown(immediate=True)
|
432
444
|
|
433
445
|
for err in errors:
|
434
446
|
if isinstance(err, Exception):
|
@@ -508,7 +520,6 @@ class CAFSClient:
|
|
508
520
|
asyncio.create_task(worker(stop_event)) for _ in range(max_concurrent)
|
509
521
|
]
|
510
522
|
errors = await asyncio.gather(*workers, return_exceptions=True)
|
511
|
-
files_queue.shutdown(immediate=True)
|
512
523
|
|
513
524
|
for err in errors:
|
514
525
|
if isinstance(err, Exception):
|
{cafs_cache_cdn_client-1.0.5 → cafs_cache_cdn_client-1.0.7}/cafs_cache_cdn_client/file_utils.py
RENAMED
@@ -40,9 +40,10 @@ class LocalFile:
|
|
40
40
|
|
41
41
|
def walk(directory: Path) -> list[LocalFile]:
|
42
42
|
results = []
|
43
|
-
for root, _, files in
|
43
|
+
for root, _, files in os.walk(str(directory)):
|
44
|
+
root_ = Path(root)
|
44
45
|
for file in files:
|
45
|
-
file_ =
|
46
|
+
file_ = root_ / file
|
46
47
|
file_stat = file_.stat()
|
47
48
|
results.append(
|
48
49
|
LocalFile(
|
{cafs_cache_cdn_client-1.0.5 → cafs_cache_cdn_client-1.0.7}/cafs_cache_cdn_client/repo/client.py
RENAMED
@@ -82,7 +82,7 @@ class RepoClient:
|
|
82
82
|
|
83
83
|
async def tag_ref(self, repo: str, ref: str, tag: str) -> None:
|
84
84
|
await self._request(
|
85
|
-
f'/repository/{repo}/{ref}/tag', method=HTTPMethod.
|
85
|
+
f'/repository/{repo}/{ref}/tag', method=HTTPMethod.POST, data={'tag': tag}
|
86
86
|
)
|
87
87
|
|
88
88
|
async def post_ref_info(self, repo: str, ref: str, data: dt.RefInfoBody) -> None:
|
@@ -1,6 +1,6 @@
|
|
1
1
|
[project]
|
2
2
|
name = "cafs-cache-cdn-client"
|
3
|
-
version = "1.0.
|
3
|
+
version = "1.0.7"
|
4
4
|
description = "Async Cache CDN client implementation"
|
5
5
|
authors = [
|
6
6
|
{ name = "Konstantin Belov", "email" = "k.belov@gaijin.team" },
|
@@ -9,7 +9,7 @@ readme = "README.md"
|
|
9
9
|
keywords = ["cafs", "cache"]
|
10
10
|
classifiers = [
|
11
11
|
"License :: OSI Approved :: MIT License",
|
12
|
-
"Development Status ::
|
12
|
+
"Development Status :: 4 - Beta",
|
13
13
|
"Programming Language :: Python :: 3.11",
|
14
14
|
"Programming Language :: Python :: 3.12",
|
15
15
|
"Programming Language :: Python :: 3.13",
|
File without changes
|
{cafs_cache_cdn_client-1.0.5 → cafs_cache_cdn_client-1.0.7}/cafs_cache_cdn_client/__init__.py
RENAMED
File without changes
|
{cafs_cache_cdn_client-1.0.5 → cafs_cache_cdn_client-1.0.7}/cafs_cache_cdn_client/cafs/README.md
RENAMED
File without changes
|
{cafs_cache_cdn_client-1.0.5 → cafs_cache_cdn_client-1.0.7}/cafs_cache_cdn_client/cafs/__init__.py
RENAMED
File without changes
|
File without changes
|
{cafs_cache_cdn_client-1.0.5 → cafs_cache_cdn_client-1.0.7}/cafs_cache_cdn_client/cafs/blob/hash_.py
RENAMED
File without changes
|
File without changes
|
{cafs_cache_cdn_client-1.0.5 → cafs_cache_cdn_client-1.0.7}/cafs_cache_cdn_client/cafs/blob/utils.py
RENAMED
File without changes
|
{cafs_cache_cdn_client-1.0.5 → cafs_cache_cdn_client-1.0.7}/cafs_cache_cdn_client/cafs/exceptions.py
RENAMED
File without changes
|
{cafs_cache_cdn_client-1.0.5 → cafs_cache_cdn_client-1.0.7}/cafs_cache_cdn_client/cafs/types.py
RENAMED
File without changes
|
File without changes
|
{cafs_cache_cdn_client-1.0.5 → cafs_cache_cdn_client-1.0.7}/cafs_cache_cdn_client/repo/__init__.py
RENAMED
File without changes
|
{cafs_cache_cdn_client-1.0.5 → cafs_cache_cdn_client-1.0.7}/cafs_cache_cdn_client/repo/datatypes.py
RENAMED
File without changes
|