Skip to main content

Redb

Redb services support.

Capabilities

This service can be used to:

  • stat
  • read
  • write
  • create_dir
  • delete
  • copy
  • rename
  • list
  • scan
  • presign
  • blocking

Configuration

  • datadir: Set the path to the redb data directory

You can refer to [RedbBuilder]'s docs for more information

Example

Via Builder

use anyhow::Result;
use opendal::services::Redb;
use opendal::Operator;

#[tokio::main]
async fn main() -> Result<()> {
let mut builder = Redb::default();
builder.datadir("/tmp/opendal/redb");
builder.table("opendal-redb");

let op: Operator = Operator::new(builder)?.finish();
Ok(())
}

Via Config

use anyhow::Result;
use opendal::Operator;
use opendal::Scheme;
use std::collections::HashMap;

#[tokio::main]
async fn main() -> Result<()> {
let mut config = HashMap::new();
config.insert("datadir".to_string(), "/tmp/opendal/redb".to_string());

let op: Operator = Operator::via_map(Scheme::Redb, config)?;
Ok(())
}