Redb
Redb services support.
Capabilities
This service can be used to:
- stat
- read
- write
- create_dir
- delete
- copy
- rename
-
list -
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
- Rust
- Node.js
- Python
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(())
}
import { Operator } from "opendal";
async function main() {
const config = {
datadir: "/tmp/opendal/redb",
};
const op = new Operator("redb", config);
}
import opendal
config = {
"datadir": "/tmp/opendal/redb",
}
op = opendal.Operator("redb", **config)