Crate forceps[][src]

forceps is a crate that provides a simple and easy-to-use on-disk cache/database.

This crate is intended to be used with the tokio runtime.

This crate is designed to be thread-safe, performant, and asyncronous for use in HTTP servers and other network applications. Because of it’s use-case, it is optimized for workloads that include many cache HITs as compared to MISSes.

It was originally designed to be used in scalpel, the MD@Home implementation for the Rust language.

Features

  • Asynchronous APIs
  • Fast and reliable reading/writing
  • Tuned for large-file databases
  • Easily accessible value metadata
  • Optimized for cache HITs
  • Easy error handling

Examples

use forceps::CacheBuilder;

let cache = CacheBuilder::new("./cache")
    .build()
    .await
    .unwrap();

cache.write(b"MY_KEY", b"Hello World").await.unwrap();
let data = cache.read(b"MY_KEY").await.unwrap();
assert_eq!(&data, b"Hello World");

Structs

Cache

The main component of forceps, acts as the API for interacting with the on-disk API.

CacheBuilder

A builder for the Cache object. Exposes APIs for configuring the initial setup of the database.

Metadata

Metadata information about a certain entry in the cache

Enums

ForcepError

Global error type for the forceps crate, which is used in the Result types of all calls to forcep APIs.

Type Definitions

Error

Re-export of ForcepError

Md5Bytes

Type definition for an array of bytes that make up an md5 hash.

Result

Result that is returned by all error-bound operations of forceps.