Sled
Sled service 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 sled data directory
You can refer to [SledBuilder
]'s docs for more information
Example
Via Builder
use anyhow::Result;
use opendal::services::Sled;
use opendal::Operator;
#[tokio::main]
async fn main() -> Result<()> {
let mut builder = Sled::default();
builder.datadir("/tmp/opendal/sled");
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 map = HashMap::new();
map.insert("datadir".to_string(), "/tmp/opendal/sled".to_string());
let op: Operator = Operator::via_map(Scheme::Sled, map)?;
Ok(())
}
import { Operator } from "opendal";
async function main() {
const op = new Operator("sled", {
datadir: "/tmp/opendal/sled",
});
}
import opendal
op = opendal.Operator("sled",
datadir="/tmp/opendal/sled",
)