Skip to content

Commit

Permalink
Merge pull request #34 from arindas/develop
Browse files Browse the repository at this point in the history
chore: merge development updates
  • Loading branch information
arindas authored Aug 10, 2024
2 parents 6324463 + 70e2209 commit 362cebc
Show file tree
Hide file tree
Showing 2 changed files with 82 additions and 11 deletions.
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,16 @@ laminarmq-io = { git = "https://github.com/arindas/laminarmq-io.git" }

This crate provides the following I/O related traits:

| **Trait** | **Type** | **Wrapper Implemented On** |
| ----------------- | ------------------- | --------------------------------------------------------------------------------------------------------------------------- |
| [`AsyncRead`] | `R I/O` | [`AsyncBufRead`] (<code>struct <i>BufferedReader\*</i></code>),<br> [`AsyncRead`] (struct [`DirectReaderBufferedAppender`]) |
| [`AsyncBufRead`] | `R I/O` | |
| [`StreamRead`] | _Streaming_ `R I/O` | [`AsyncRead`] (struct [`AsyncReadStreamer`],<br> <code>struct <i>BufferedStreamReader\*</i></code>) |
| [`AsyncAppend`] | `W I/O` | [`AsyncAppend`] (<code>struct <i>\*BufferedAppender</i></code>) |
| [`StreamAppend`] | _Streaming_ `W I/O` | [`AsyncAppend`] (_trait impl_) |
| [`AsyncTruncate`] | `W I/O` | |
| [`AsyncRemove`] | Management | |
| [`AsyncClose`] | Management | <img width="1000" id="full-width-cell" /> |
| **Trait** | **Type** | **Wrapper Implemented On** |
| ----------------- | ------------------------------ | --------------------------------------------------------------------------------------------------------------------------- |
| [`AsyncRead`] | `R I/O` | [`AsyncBufRead`] (<code>struct <i>BufferedReader\*</i></code>),<br> [`AsyncRead`] (struct [`DirectReaderBufferedAppender`]) |
| [`AsyncBufRead`] | `R I/O` | - |
| [`StreamRead`] | _Streaming_ `R I/O` | [`AsyncRead`] (struct [`AsyncReadStreamer`],<br> <code>struct <i>BufferedStreamReader\*</i></code>) |
| [`AsyncAppend`] | `W I/O` | [`AsyncAppend`] (<code>struct <i>\*BufferedAppender</i></code>) |
| [`StreamAppend`] | _Streaming_ `W I/O` | [`AsyncAppend`] (_trait impl_) |
| [`AsyncTruncate`] | `W I/O` | - |
| [`AsyncRemove`] | Management | - |
| [`AsyncClose`] | Management <img width="200" /> | - <img width="500" /> |

> 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 [`AsyncReadStreamer`] which wraps an [`AsyncRead`] instance.
Expand Down
73 changes: 72 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,75 @@
#![doc = include_str!("../README.md")]
/*!
<p align="center">
<h1 align="center"><code>laminarmq-io</code></h1>
</p>
<p align="center">
<a href="https://github.com/arindas/laminarmq-io/actions/workflows/rust-ci.yml">
<img src="https://github.com/arindas/laminarmq-io/actions/workflows/rust-ci.yml/badge.svg">
</a>
<a href="https://github.com/arindas/laminarmq-io/actions/workflows/rustdoc.yml">
<img src="https://github.com/arindas/laminarmq-io/actions/workflows/rustdoc.yml/badge.svg">
</a>
<a href="https://github.com/arindas/laminarmq-io">
<img src="https://img.shields.io/badge/github-arindas/laminarmq--io-blue?logo=github&labelColor=black">
</a>
</p>
<p align="center">
An attempt to rewrite <a href="https://github.com/arindas/laminarmq"><code>laminarmq</code></a> I/O layer
to accommodate bounded memory overhead when reading and writing.
</p>
## 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`] | `R I/O` | [`AsyncBufRead`] (<code>struct <i>BufferedReader\*</i></code>),<br> [`AsyncRead`] (struct [`DirectReaderBufferedAppender`]) |
| [`AsyncBufRead`] | `R I/O` | - |
| [`StreamRead`] | _Streaming_ `R I/O` | [`AsyncRead`] (struct [`AsyncReadStreamer`],<br> <code>struct <i>BufferedStreamReader\*</i></code>) |
| [`AsyncAppend`] | `W I/O` | [`AsyncAppend`] (<code>struct <i>\*BufferedAppender</i></code>) |
| [`StreamAppend`] | _Streaming_ `W I/O` | [`AsyncAppend`] (_trait impl_) |
| [`AsyncTruncate`] | `W I/O` | - |
| [`AsyncRemove`] | Management | - |
| [`AsyncClose`] | <br>Management <img width="200" /> | <br> - <img width="500" /> |
> 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 [`AsyncReadStreamer`] which wraps an [`AsyncRead`] instance.
>
> Some traits in this table also have direct impls on other trait types e.g:
>
> ```text
> impl<T> StreamAppend for T where T: AsyncAppend { /* ... */ }
> ```
>
> They are marked with (_trait impl_).
<br>
This library makes the following improvments 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
- Provides both streaming read and streaming write
- 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.
*/

pub mod fs;
pub mod object_storage;
Expand Down

0 comments on commit 362cebc

Please sign in to comment.