Skip to main content

Crate marple_db

Crate marple_db 

Source
Expand description

Rust SDK for the MarpleDB API.

The SDK provides async helpers for checking API health, managing streams, listing datasets, uploading files, waiting for imports, and fetching pre-signed download links.

§Quickstart

use marple_db::{ImportStatus, MarpleDB, PushFileOptions};
use serde_json::json;
use std::time::Duration;

let db = MarpleDB::new(
    "https://db.marpledata.com/api/v1",
    "mdb_your_token_here",
)?;
let stream = db.get_stream("runs").await?;
let dataset = db
    .push_file(
        stream.id,
        "run.csv",
        PushFileOptions::builder()
            .metadata([("source", json!("example"))])
            .build(),
    )
    .await?;
let dataset = db
    .wait_for_import(stream.id, dataset.id, Duration::from_secs(180))
    .await?;
assert_eq!(dataset.import_status, ImportStatus::Finished);

§Core Types

§Errors

match db.get_stream("runs").await {
    Ok(stream) => println!("stream id: {}", stream.id),
    Err(marple_db::Error::StreamNotFound { name }) => {
        eprintln!("missing stream: {name}");
    }
    Err(error) => return Err(error),
}

This crate is async and does not install a runtime. The examples use Tokio, but callers can use any runtime supported by reqwest.

Structs§

Dataset
Dataset metadata returned by the MarpleDB API.
HealthResponse
Health response returned by the MarpleDB API.
MarpleDB
Client for the MarpleDB API.
MarpleDBBuilder
Builder for MarpleDB.
NoopProgress
Progress reporter that ignores all updates.
PushFileOptions
Options for uploading a file.
PushFileOptionsBuilder
Builder for PushFileOptions.
Stream
MarpleDB stream metadata.

Enums§

Error
Error type returned by the MarpleDB SDK.
ImportStatus
Dataset import lifecycle status.
StreamType
MarpleDB stream type.
UploadModeOverride
Upload mode preference for MarpleDB::push_file.

Traits§

ProgressReporter
Receives byte-position updates from long-running transfers.

Type Aliases§

Metadata
JSON object used for user-defined stream or dataset metadata.
Result
Result type returned by the MarpleDB SDK.