fmmap

Crates.iofmmap
lib.rsfmmap
version0.3.3
sourcesrc
created_at2021-12-09 13:18:29.047602
updated_at2023-09-18 11:17:40.392511
descriptionA flexible and convenient high-level mmap for zero-copy file I/O.
homepage
repositoryhttps://github.com/al8n/fmmap/tree/main/fmmap-rs
max_upload_size
id495149
size554,231
Al Liu (al8n)

documentation

https://docs.rs/fmmap

README

fmmap

A flexible and convenient high-level mmap for zero-copy file I/O.

English | 简体中文

github Build codecov

docs.rs crates.io rustc

license-apache license-mit

Design

The design of this crate is inspired by Dgraph's mmap file implementation in Stretto.

All of file-backed memory map has the potential for Undefined Behavior (UB) if the underlying file is subsequently modified (e.g. the file is deleted by another process), in or out of process, this crate tries to avoid this situation by provide file lock APIs.

This crate supports std and popular async runtime(tokio, async-std, smol), and thanks to macro in Rust, it is super easy to support any new async runtime. For details, please see the implementation for tokio, async-std, smol of the source code.

Features

  • dozens of file I/O util functions
  • file-backed memory maps
  • synchronous and asynchronous flushing
  • copy-on-write memory maps
  • read-only memory maps
  • stack support (MAP_STACK on unix)
  • executable memory maps
  • file locks.
  • tokio
  • smol
  • async-std

Installation

  • std

    [dependencies]
    fmmap = 0.2 
    
  • tokio

    [dependencies]
    fmmap = { version = "0.3", features = ["tokio-async"] }
    
  • async-std

    [dependencies]
    fmmap = { version = "0.3", features = ["std-async"] }
    
  • smol

    [dependencies]
    fmmap = { version = "0.3", features = ["smol-async"] }
    

Examples

This crate is 100% documented, see documents for examples.

TODO

  • add benchmarks

License

Licensed under either of Apache License, Version 2.0 or MIT license at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this project by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.
Commit count: 0

cargo fmt