Skip to content

Java asynchronous file I/O based on io_uring Linux interface

License

Notifications You must be signed in to change notification settings

stolsvik/jasyncfio

 
 

Repository files navigation

Jasyncfio

Build

Jasyncfio provides an asynchronous file I/O API based on the Linux io_uring interface.

Jasyncfio Features

  • Fully asynchronous io_uring based file I/O API
  • API comes in two kinds: Buffered and Direct I/O
  • API for linear access to file (depends on your file system)
  • Using a wide range of io_uring features such as polling, registered buffers/files

Examples

EventExecutorGroup eventExecutorGroup = EventExecutorGroup.initDefault();

CompletableFuture<BufferedFile> bufferedFileCompletableFuture =
        eventExecutorGroup.openBufferedFile(filePath, OpenOption.CREATE, OpenOption.WRITE_ONLY);

BufferedFile bufferedFile = bufferedFileCompletableFuture.get();

ByteBuffer buffer = ByteBuffer.allocateDirect(1024);
CompletableFuture<Integer> writeCompletableFuture = bufferedFile.write(0, buffer);
Integer writtenBytes = writeCompletableFuture.get();

If you want to dive deeper, there are more examples with explanations on the wiki.

Download

Releases are available at Maven Central.

Since the library uses native code, it is necessary to specify the classifier. At the moment there are releases only for linux-amd64, there are plans to support linux-arm64.

Requirements

  • Linux Kernel >= 5.11
  • Java >= 8

Maven

<dependency>
    <groupId>one.jasyncfio</groupId>
    <artifactId>jasyncfio</artifactId>
    <version>0.0.1</version>
    <classifier>linux-amd64</classifier>
</dependency>

Gradle Groovy DSL

implementation 'one.jasyncfio:jasyncfio:0.0.1:linux-amd64'

Gradle Kotlin DSL

implementation("one.jasyncfio:jasyncfio:0.0.1:linux-amd64")

About

Java asynchronous file I/O based on io_uring Linux interface

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 81.5%
  • C 15.4%
  • Kotlin 3.1%