Skip to main content

Asynchronous file IO for Linux Posix and Wondows.

Project description

Python bindings for Linux AIO API and simple asyncio wrapper.

Example

import asyncio
from linux_aio import AsyncioAIOContext

loop = asyncio.get_event_loop()

async def main():
    # max_requests=128 by default
    ctx = AsyncioAIOContext(max_requests=128)

    with open("test.file", "wb+") as fp:
        fd = fp.fileno()

        # Execute one write operation
        await ctx.write(b"Hello world", fd, offset=0)

        # Execute one read operation
        print(await ctx.read(32, fd, offset=0))

        # Execute one fdsync operation
        await ctx.fdsync(fd)

        op1 = ctx.write(b"Hello from ", fd, offset=0)
        op2 = ctx.write(b"async world", fd, offset=11)

        await asyncio.gather(op1, op2)

        print(await ctx.read(32, fd, offset=0))
        # Hello from async world


loop.run_until_complete(main())

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

caio-0.3.0.tar.gz (17.7 kB view details)

Uploaded Source

Built Distribution

caio-0.3.0-cp38-cp38-macosx_10_9_x86_64.whl (34.4 kB view details)

Uploaded CPython 3.8 macOS 10.9+ x86-64

File details

Details for the file caio-0.3.0.tar.gz.

File metadata

  • Download URL: caio-0.3.0.tar.gz
  • Upload date:
  • Size: 17.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.8.3

File hashes

Hashes for caio-0.3.0.tar.gz
Algorithm Hash digest
SHA256 52d6a023fe57a90ab27d0897447c93c8f43f645e878337039d3420e66ef038a3
MD5 95f2e67c827be93ea2d76fd5341080b4
BLAKE2b-256 a201b5fd9f48248a3ace2595901824791d757a2312c8254e30597b73f6544bff

See more details on using hashes here.

File details

Details for the file caio-0.3.0-cp38-cp38-macosx_10_9_x86_64.whl.

File metadata

  • Download URL: caio-0.3.0-cp38-cp38-macosx_10_9_x86_64.whl
  • Upload date:
  • Size: 34.4 kB
  • Tags: CPython 3.8, macOS 10.9+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.8.3

File hashes

Hashes for caio-0.3.0-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 bd4c553473ad8b2fcca4128f49c5e6ae5d9e35654214b9ed8b003dddbad9ee92
MD5 7c791a331b096d444dd46b50613c541e
BLAKE2b-256 e8d60496ff15711be76c1a13094f4f1eca8e3b1ae5f6758958c2adcf4f75c81c

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page