| 7 | |
| 8 | |
| 9 | class JSONWriter(BufferWriter): |
| 10 | def __init__(self, config: StorageConfig): |
| 11 | assert config.storage_type == StorageType.FILE.value |
| 12 | self.writer = FileStorage.get_wrapper(config) |
| 13 | self.wrap_in_ray = config.wrap_in_ray |
| 14 | |
| 15 | async def write(self, data: List) -> None: |
| 16 | if self.wrap_in_ray: |
| 17 | await self.writer.write.remote(data) |
| 18 | else: |
| 19 | self.writer.write(data) |
| 20 | |
| 21 | async def acquire(self) -> int: |
| 22 | if self.wrap_in_ray: |
| 23 | return await self.writer.acquire.remote() |
| 24 | else: |
| 25 | return 0 |
| 26 | |
| 27 | async def release(self) -> int: |
| 28 | if self.wrap_in_ray: |
| 29 | return await self.writer.release.remote() |
| 30 | else: |
| 31 | self.writer.release() |
| 32 | return 0 |
no outgoing calls
no test coverage detected