Skip to content

Continuously read/write to disk using random offsets and lengths .

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT
Notifications You must be signed in to change notification settings

datrs/random-access-disk

Folders and files

NameName
Last commit message
Last commit date

Latest commit

bf8639e · Nov 10, 2018

History

57 Commits
Mar 22, 2018
Aug 30, 2018
Apr 16, 2018
Nov 10, 2018
Sep 17, 2018
Apr 8, 2018
Sep 10, 2018
Mar 22, 2018
Aug 30, 2018
Nov 10, 2018
Mar 30, 2018
Mar 30, 2018
Nov 10, 2018
Mar 22, 2018

Repository files navigation

random-access-disk

crates.io version build status downloads docs.rs docs

Continuously read,write to disk, using random offsets and lengths. Adapted from random-access-storage/random-access-file.

Usage

extern crate random_access_storage;
extern crate random_access_disk;
extern crate tempfile;
extern crate failure;

use random_access_disk::RandomAccessDisk;
use random_access_storage::RandomAccess;
use tempfile::Builder;
use failure::Error;

fn main () -> Result<(), Error>{
  let dir = Builder::new()
    .prefix("random-access-disk")
    .tempdir()?;

  let file = dir.path().join("example.db");
  let mut file = RandomAccessDisk::open(file)?;

  file.write(0, b"hello")?;
  file.write(5, b" world")?;

  let text = file.read(0, 11)?;
  assert_eq!(&text, b"hello world");
  Ok(())
}

Installation

$ cargo add random-access-disk

License

MIT OR Apache-2.0

About

Continuously read/write to disk using random offsets and lengths .

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Languages