Skip to main content

Persy

Persy service support.

Capabilities

This service can be used to:

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

Configuration

  • datafile: Set the path to the persy data file. The directory in the path must already exist.
  • segment: Set the name of the persy segment.
  • index: Set the name of the persy index.

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

Example

Via Builder

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

#[tokio::main]
async fn main() -> Result<()> {
let mut builder = Persy::default();
builder.datafile("./test.persy");
builder.segment("data");
builder.index("index");

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("datafile".to_string(), "./test.persy".to_string());
config.insert("segment".to_string(), "data".to_string());
config.insert("index".to_string(), "index".to_string());

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