use alloc::string::String;
use alloc::vec::Vec;
use serde::{Deserialize, Serialize};
use crate::db::Scope;
pub type BlobPath = String;
#[derive(Clone, Copy, Debug, Eq, PartialEq, Hash, Serialize, Deserialize)]
pub enum BlobHash {
Sha2([u8; 32]),
}
#[derive(Clone, Debug, Serialize, Deserialize)]
#[allow(missing_docs)]
pub struct BlobId {
pub scope: Scope,
pub hash: BlobHash,
}
#[derive(Clone, Copy, Debug, Serialize, Deserialize)]
#[allow(missing_docs)]
pub struct ChunkRange {
pub offset: u64,
pub length: u64,
}
#[derive(Debug, Serialize, Deserialize)]
#[allow(missing_docs)]
pub struct BlobResponse {
pub blob: Vec<u8>,
pub blob_id: BlobId,
pub range: Option<ChunkRange>,
pub total_len: u64,
}
#[derive(Debug, Serialize, Deserialize)]
#[allow(missing_docs)]
pub struct BlobStoreRequest {
pub scope: Scope,
}
#[derive(Debug, Serialize, Deserialize)]
#[allow(missing_docs)]
pub struct BlobStoreResponse {
pub blob_id: BlobId,
}
#[derive(Debug, Serialize, Deserialize)]
#[allow(missing_docs)]
pub struct BlobLinkRequest {
pub blob_id: BlobId,
pub path: BlobPath,
}
#[derive(Debug, Serialize, Deserialize)]
#[allow(missing_docs)]
pub struct BlobUnlinkRequest {
pub scope: Scope,
pub path: BlobPath,
}
#[derive(Debug, Serialize, Deserialize)]
#[allow(missing_docs)]
pub struct BlobMoveRequest {
pub scope: Scope,
pub old_path: BlobPath,
pub new_path: BlobPath,
}
#[derive(Debug, Serialize, Deserialize)]
#[allow(missing_docs)]
pub struct BlobResolveRequest {
pub blob_id: BlobId,
pub range: Option<ChunkRange>,
}
#[derive(Debug, Serialize, Deserialize)]
#[allow(missing_docs)]
pub struct PathResolveRequest {
pub scope: Scope,
pub path: BlobPath,
pub range: Option<ChunkRange>,
}
#[derive(Debug, Serialize, Deserialize)]
#[allow(missing_docs)]
pub struct ResolveResponse {
pub blob: Option<BlobResponse>,
}
#[derive(Debug, Serialize, Deserialize)]
#[allow(missing_docs)]
pub struct PathsListRequest {
pub scope: Scope,
pub limit: Option<usize>,
}
#[derive(Debug, Serialize, Deserialize)]
#[allow(missing_docs)]
pub struct PathsListResponse {
pub paths: Vec<BlobPath>,
}