An open API service indexing awesome lists of open source software.

https://github.com/arindas/laminarmq-io

Generic I/O abstraction over local File storage and AWS S3 for laminarmq
https://github.com/arindas/laminarmq-io

append-only async-io async-storage aws-s3 generic-associated-types

Last synced: 2 months ago
JSON representation

Generic I/O abstraction over local File storage and AWS S3 for laminarmq

Awesome Lists containing this project

README

        


laminarmq-io












An attempt to rewrite the laminarmq I/O layer
to accommodate bounded memory overhead during read/write ops.

## Usage

`laminarmq-io` is a library crate. In order to use it, add the following to your `Cargo.toml`

```toml
[dependencies]
laminarmq-io = { git = "https://github.com/arindas/laminarmq-io.git" }
```

## Overview

This crate provides the following I/O related traits:

| **Trait** | **Type** | **Wrapper Implemented On** |
| ----------------- | ---------------------------------- | ------------------------------------------------------------------------ |
| [`AsyncRead`] | `Read I/O` | [`AsyncBufRead`], [`AsyncRead`]
(struct [`BufReader`]) |
| [`AsyncBufRead`] | `Read I/O` | - |
| [`StreamRead`] | _Streaming_ `Read I/O` | [`AsyncRead`] (struct [`AsyncReadStreamRead`],
struct [`BufReader`]) |
| [`AsyncAppend`] | `Write I/O` | [`AsyncAppend`] (struct [`BufAppender`]) |
| [`StreamAppend`] | _Streaming_ `Write I/O` | [`AsyncAppend`] (_trait impl_) |
| [`AsyncTruncate`] | `Write I/O` | - |
| [`AsyncRemove`] | Management | - |
| [`AsyncClose`] |
Management |
- |

> The "Wrapper Implemented on" column denotes on which underlying trait, the current trait has an impl with the help of a wrapper struct wrapping the mentioned trait.
> For example, [`StreamRead`] is implemented by a wrapper struct [`AsyncReadStreamRead`] which wraps an [`AsyncRead`] instance.
>
> Some traits in this table also have direct impls on other trait types e.g:
>
> ```text
> impl StreamAppend for T where T: AsyncAppend { /* ... */ }
> ```
>
> They are marked with (_trait impl_).


This library makes the following improvements over existing I/O primitives in `laminarmq`:

- Provides traits at individual operaton level i.e `Read` / `Append` level as opposed to a unified `Storage` trait
- All operations are exclusive with a `&mut self` receiver to avoid internal locks
- Supports both streaming read and streaming write operations
- Provides impls on both filessytem based APIs and cloud object storage APIs such as S3

## License

This repository is licensed under the same terms as [`laminarmq`](https://github.com/arindas/laminarmq).
See [LICENSE](https://raw.githubusercontent.com/arindas/laminarmq-io/main/LICENSE) for more details.