mirror of
https://github.com/rustfs/rustfs.git
synced 2026-09-01 17:58:22 +00:00
docs: add documentation to storage-api public types Add doc comments to public structs, enums, and traits in storage-api crate to improve documentation coverage. Refs #741
This commit is contained in:
@@ -17,44 +17,69 @@ use std::fmt::Debug;
|
|||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use time::OffsetDateTime;
|
use time::OffsetDateTime;
|
||||||
|
|
||||||
|
/// Options for creating a new bucket.
|
||||||
#[derive(Debug, Default, Serialize, Deserialize)]
|
#[derive(Debug, Default, Serialize, Deserialize)]
|
||||||
pub struct MakeBucketOptions {
|
pub struct MakeBucketOptions {
|
||||||
|
/// Enable object lock for the bucket.
|
||||||
pub lock_enabled: bool,
|
pub lock_enabled: bool,
|
||||||
|
/// Enable versioning for the bucket.
|
||||||
pub versioning_enabled: bool,
|
pub versioning_enabled: bool,
|
||||||
|
/// Force creation even if bucket already exists.
|
||||||
pub force_create: bool,
|
pub force_create: bool,
|
||||||
|
/// Optional creation timestamp.
|
||||||
pub created_at: Option<OffsetDateTime>,
|
pub created_at: Option<OffsetDateTime>,
|
||||||
|
/// Skip acquiring namespace lock.
|
||||||
pub no_lock: bool,
|
pub no_lock: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Operation to perform on a bucket during site replication delete.
|
||||||
#[derive(Debug, Default, Clone, PartialEq)]
|
#[derive(Debug, Default, Clone, PartialEq)]
|
||||||
pub enum SRBucketDeleteOp {
|
pub enum SRBucketDeleteOp {
|
||||||
|
/// No operation.
|
||||||
#[default]
|
#[default]
|
||||||
NoOp,
|
NoOp,
|
||||||
|
/// Mark the bucket for deletion.
|
||||||
MarkDelete,
|
MarkDelete,
|
||||||
|
/// Purge the bucket and all its contents.
|
||||||
Purge,
|
Purge,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Options for deleting a bucket.
|
||||||
#[derive(Debug, Default, Clone)]
|
#[derive(Debug, Default, Clone)]
|
||||||
pub struct DeleteBucketOptions {
|
pub struct DeleteBucketOptions {
|
||||||
|
/// Skip acquiring namespace lock.
|
||||||
pub no_lock: bool,
|
pub no_lock: bool,
|
||||||
|
/// Do not recreate bucket on failure.
|
||||||
pub no_recreate: bool,
|
pub no_recreate: bool,
|
||||||
|
/// Force deletion even if bucket is not empty.
|
||||||
pub force: bool,
|
pub force: bool,
|
||||||
|
/// Site replication delete operation.
|
||||||
pub srdelete_op: SRBucketDeleteOp,
|
pub srdelete_op: SRBucketDeleteOp,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Options for querying bucket information.
|
||||||
#[derive(Debug, Default, Serialize, Deserialize)]
|
#[derive(Debug, Default, Serialize, Deserialize)]
|
||||||
pub struct BucketOptions {
|
pub struct BucketOptions {
|
||||||
|
/// Include deleted buckets in results.
|
||||||
pub deleted: bool,
|
pub deleted: bool,
|
||||||
|
/// Use cached bucket information.
|
||||||
pub cached: bool,
|
pub cached: bool,
|
||||||
|
/// Skip loading bucket metadata.
|
||||||
pub no_metadata: bool,
|
pub no_metadata: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Information about a bucket.
|
||||||
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
|
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
|
||||||
pub struct BucketInfo {
|
pub struct BucketInfo {
|
||||||
|
/// Bucket name.
|
||||||
pub name: String,
|
pub name: String,
|
||||||
|
/// Creation timestamp.
|
||||||
pub created: Option<OffsetDateTime>,
|
pub created: Option<OffsetDateTime>,
|
||||||
|
/// Deletion timestamp (if deleted).
|
||||||
pub deleted: Option<OffsetDateTime>,
|
pub deleted: Option<OffsetDateTime>,
|
||||||
|
/// Whether versioning is enabled.
|
||||||
pub versioning: bool,
|
pub versioning: bool,
|
||||||
|
/// Whether object locking is enabled.
|
||||||
pub object_locking: bool,
|
pub object_locking: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -14,8 +14,13 @@
|
|||||||
|
|
||||||
//! Stable storage error contracts shared across storage consumers.
|
//! Stable storage error contracts shared across storage consumers.
|
||||||
|
|
||||||
|
/// Result type alias for storage operations.
|
||||||
pub type StorageResult<T, E = StorageErrorCode> = core::result::Result<T, E>;
|
pub type StorageResult<T, E = StorageErrorCode> = core::result::Result<T, E>;
|
||||||
|
|
||||||
|
/// Error codes for storage operations.
|
||||||
|
///
|
||||||
|
/// These codes provide a stable, cross-crate error classification
|
||||||
|
/// that can be serialized and transmitted between nodes.
|
||||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
|
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
|
||||||
pub enum StorageErrorCode {
|
pub enum StorageErrorCode {
|
||||||
Io,
|
Io,
|
||||||
|
|||||||
@@ -18,45 +18,68 @@ use serde::{Deserialize, Serialize};
|
|||||||
|
|
||||||
use crate::{CapabilitySnapshotError, CapabilityStatus};
|
use crate::{CapabilitySnapshotError, CapabilityStatus};
|
||||||
|
|
||||||
|
/// Snapshot of observability capabilities and state.
|
||||||
#[derive(Debug, Default, Clone, PartialEq, Eq, Serialize, Deserialize)]
|
#[derive(Debug, Default, Clone, PartialEq, Eq, Serialize, Deserialize)]
|
||||||
#[serde(deny_unknown_fields)]
|
#[serde(deny_unknown_fields)]
|
||||||
pub struct ObservabilitySnapshot {
|
pub struct ObservabilitySnapshot {
|
||||||
|
/// Runtime telemetry capabilities.
|
||||||
pub runtime_telemetry: CapabilityStatus,
|
pub runtime_telemetry: CapabilityStatus,
|
||||||
|
/// Userspace profiling capabilities.
|
||||||
pub userspace_profiling: UserspaceProfilingCapability,
|
pub userspace_profiling: UserspaceProfilingCapability,
|
||||||
|
/// Memory sampling state.
|
||||||
pub memory_sampling: MemorySamplingState,
|
pub memory_sampling: MemorySamplingState,
|
||||||
|
/// Platform support information.
|
||||||
pub platform: PlatformSupport,
|
pub platform: PlatformSupport,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Capabilities for userspace profiling.
|
||||||
#[derive(Debug, Default, Clone, PartialEq, Eq, Serialize, Deserialize)]
|
#[derive(Debug, Default, Clone, PartialEq, Eq, Serialize, Deserialize)]
|
||||||
#[serde(deny_unknown_fields)]
|
#[serde(deny_unknown_fields)]
|
||||||
pub struct UserspaceProfilingCapability {
|
pub struct UserspaceProfilingCapability {
|
||||||
|
/// CPU profiling capability.
|
||||||
pub cpu: CapabilityStatus,
|
pub cpu: CapabilityStatus,
|
||||||
|
/// Memory profiling capability.
|
||||||
pub memory: CapabilityStatus,
|
pub memory: CapabilityStatus,
|
||||||
|
/// Continuous CPU profiling capability.
|
||||||
pub continuous_cpu: CapabilityStatus,
|
pub continuous_cpu: CapabilityStatus,
|
||||||
|
/// Periodic CPU profiling capability.
|
||||||
pub periodic_cpu: CapabilityStatus,
|
pub periodic_cpu: CapabilityStatus,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// State of memory sampling capabilities.
|
||||||
#[derive(Debug, Default, Clone, PartialEq, Eq, Serialize, Deserialize)]
|
#[derive(Debug, Default, Clone, PartialEq, Eq, Serialize, Deserialize)]
|
||||||
#[serde(deny_unknown_fields)]
|
#[serde(deny_unknown_fields)]
|
||||||
pub struct MemorySamplingState {
|
pub struct MemorySamplingState {
|
||||||
|
/// Process-level memory sampling.
|
||||||
pub process: CapabilityStatus,
|
pub process: CapabilityStatus,
|
||||||
|
/// System-level memory sampling.
|
||||||
pub system: CapabilityStatus,
|
pub system: CapabilityStatus,
|
||||||
|
/// Cgroup-level memory sampling.
|
||||||
pub cgroup: CapabilityStatus,
|
pub cgroup: CapabilityStatus,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Platform support information.
|
||||||
#[derive(Debug, Default, Clone, PartialEq, Eq, Serialize, Deserialize)]
|
#[derive(Debug, Default, Clone, PartialEq, Eq, Serialize, Deserialize)]
|
||||||
#[serde(deny_unknown_fields)]
|
#[serde(deny_unknown_fields)]
|
||||||
pub struct PlatformSupport {
|
pub struct PlatformSupport {
|
||||||
|
/// Target triple (e.g., x86_64-unknown-linux-gnu).
|
||||||
pub target_triple: Option<String>,
|
pub target_triple: Option<String>,
|
||||||
|
/// Operating system.
|
||||||
pub os: Option<String>,
|
pub os: Option<String>,
|
||||||
|
/// Architecture.
|
||||||
pub arch: Option<String>,
|
pub arch: Option<String>,
|
||||||
|
/// Memory allocator capability.
|
||||||
pub allocator: CapabilityStatus,
|
pub allocator: CapabilityStatus,
|
||||||
|
/// eBPF support.
|
||||||
pub ebpf: CapabilityStatus,
|
pub ebpf: CapabilityStatus,
|
||||||
|
/// NUMA support.
|
||||||
pub numa: CapabilityStatus,
|
pub numa: CapabilityStatus,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Provider for observability snapshots.
|
||||||
#[async_trait::async_trait]
|
#[async_trait::async_trait]
|
||||||
pub trait ObservabilitySnapshotProvider: Send + Sync + Debug {
|
pub trait ObservabilitySnapshotProvider: Send + Sync + Debug {
|
||||||
|
/// Get a snapshot of observability capabilities and state.
|
||||||
async fn observability_snapshot(&self) -> Result<ObservabilitySnapshot, CapabilitySnapshotError>;
|
async fn observability_snapshot(&self) -> Result<ObservabilitySnapshot, CapabilitySnapshotError>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user