types_volume - OmniCloudOrg/OmniOrchestrator GitHub Wiki

volume (src/types)

Path: src/types/volume.rs

Table of Contents

Public Items

struct VolumeMetadata

Definition

pub struct VolumeMetadata {
    creation_time: chrono::DateTime<chrono::Utc>,
    last_modified: chrono::DateTime<chrono::Utc>,
    status: VolumeStatus,
    labels: HashMap<String, String>, // For organization/selection
}

Documentation

Volume metadata for tracking volume details

struct QoSConfig

Definition

pub struct QoSConfig {
    iops_limit: Option<u32>,
    throughput_limit: Option<u64>, // bytes per second
    iops_guarantee: Option<u32>,
    throughput_guarantee: Option<u64>,
    burstable: Option<BurstConfig>,
}

Documentation

QoS configuration for controlling volume performance

struct BurstConfig

Definition

pub struct BurstConfig {
    duration: chrono::Duration,
    iops_multiplier: f32,
    throughput_multiplier: f32,
}

Documentation

Configuration for burstable QoS performance

struct SecurityConfig

Definition

pub struct SecurityConfig {
    encryption_enabled: bool,
    encryption_algorithm: Option<String>,
    key_management: Option<KeyManagementType>,
    access_policies: Vec<AccessPolicy>,
}

Documentation

Security configuration for volumes

enum KeyManagementType

Definition

pub enum KeyManagementType {
    Internal,
    External { provider: String, config: HashMap<String, String> },
    CustomerManaged,
    HardwareSecurityModule { hsm_id: String },
}

Documentation

Key management types for volume encryption

struct AccessPolicy

Definition

pub struct AccessPolicy {
    allowed_users: Vec<String>,
    allowed_groups: Vec<String>,
    allowed_operations: Vec<VolumeOperation>,
}

Documentation

Access policy for controlling volume operations

enum VolumeOperation

Definition

pub enum VolumeOperation {
    Read,
    Write,
    Snapshot,
    Delete,
    Expand,
    Clone,
}

Documentation

Possible operations that can be performed on a volume

struct BackupPolicy

Definition

pub struct BackupPolicy {
    schedule: String, // cron format
    retention: RetentionPolicy,
    consistency_type: ConsistencyType,
    target_location: String,
}

Documentation

Backup policy configuration

enum ConsistencyType

Definition

pub enum ConsistencyType {
    Crash,
    Filesystem,
    Application { pre_backup_hook: String, post_backup_hook: String },
}

Documentation

Types of consistency for backup operations

struct RetentionPolicy

Definition

pub struct RetentionPolicy {
    daily: u32,
    weekly: u32,
    monthly: u32,
    yearly: u32,
}

Documentation

Policy for retaining backups

enum Volume

Definition

pub enum Volume {
    /// Represents a temporary volume killed when the app instance is killed
    /// used for ephemeral storage within a single app instance.
    /// 
    /// In the event that multiple app instances are running on the same node,
    /// each instance will have its own version of the ephemeral volume, which
    /// is not shared with the other instances.
    /// 
    /// This allows for isolated storage for each app instance, ensuring that
    /// data is not inadvertently shared or corrupted between instances.
    /// This is useful for caching, temporary files, or any data that does not
    /// need to persist beyond the lifecycle of the app instance.
    Ephemeral(EphemeralVolume),
    /// Represents a persistent volume that can be shared across nodes in the cluster
    /// 
    /// This volume type is used for applications that require data to persist across
    /// app restarts or need to maintain state beyond the lifecycle of a single app
    /// instance. It is also used for applications that require data to be shared across
    /// multiple app instances running on different nodes in the cluster.
    /// 
    /// This volume type has a few different modes, each with its own characteristics:
    /// 
    /// Local Persistent Volumes are stored on worker node local disks but managed
    /// in a way that preserves the data even if the container using them is removed.
    /// These volumes offer excellent performance due to their local nature but are
    /// tied to a specific node. If that node fails, the volume becomes unavailable
    /// until the node recovers. This approach is suitable for workloads that
    /// prioritize performance over availability, or in clusters where node failures
    /// are rare.
    /// 
    /// Network-Attached Volumes are implemented via network storage protocols such
    /// as NFS, iSCSI, or specialized storage vendor APIs. These volumes can be
    /// accessed from any node in the cluster, allowing containers to be rescheduled
    /// freely without losing access to their data. The tradeoff is increased latency
    /// due to network communication, though modern networks and storage protocols can
    /// minimize this impact. Network-attached volumes are ideal for workloads that
    /// require flexibility in placement and moderate performance.
    /// 
    /// Distributed Volumes are spread across multiple physical nodes for redundancy
    /// and improved availability. Technologies like Ceph, GlusterFS, or Longhorn
    /// underpin these volumes, storing multiple copies of the data or using erasure
    /// coding to protect against node failures. Distributed volumes offer the best
    /// combination of availability and performance, though they typically require
    /// more resources due to the replication overhead. They're well-suited for
    /// mission-critical applications where both performance and reliability are
    /// important.
    Persistent(PersistentVolume),
    /// Represents a network-shared volume
    /// 
    /// This volume type is used for applications that require data to be shared
    /// across app instances running on different nodes in the cluster, and for applications
    // ... additional implementation
}

Documentation

Enum to represent the different types of volumes in OmniCloud. This enum defines the various volume types that can be used in OmniCloud, allowing for flexibility in how data is stored and accessed. The possible volume types include: - Ephemeral: A temporary volume that is killed when the app instance is killed, used for ephemeral storage within a single app instance. - Persistent: A persistent volume that can be shared across nodes in the cluster, used for applications that require data to persist across app restarts or need to maintain state beyond the lifecycle of a single app instance. - Shared: A network-shared volume that allows for data consistency and state management across app instances running on different nodes in the cluster.

WARNING

Each volume type has its own characteristics and limitations, and it is important to choose the right type based on the application's requirements for data persistence, availability, and performance.

struct EphemeralVolume

Definition

pub struct EphemeralVolume {
    id: Uuid,                // Unique identifier for the volume
    size: u64,               // Size in bytes
    name: String,            // Name of the volume
    metadata: VolumeMetadata, // Metadata for tracking volume status and details
    qos: Option<QoSConfig>,  // QoS settings for performance
    security: Option<SecurityConfig>, // Security settings
}

struct SharedVolume

Definition

pub struct SharedVolume {
    id: Uuid,                // Unique identifier for the volume
    size: u64,               // Size in bytes
    name: String,            // Name of the volume
    status: String,          // Status of the volume (e.g., "available", "in-use")
    nodes: Vec<String>,      // List of nodes sharing this volume
    access_mode: AccessMode, // Access mode (RWO, ROX, RWX)
    metadata: VolumeMetadata, // Metadata for tracking volume status and details
    qos: Option<QoSConfig>,  // QoS settings for performance
    security: Option<SecurityConfig>, // Security settings
    backup_policy: Option<BackupPolicy>, // Backup settings
}

enum PersistentVolume

Definition

pub enum PersistentVolume {
    Local {
        id: Uuid,                // Unique identifier for the volume
        size: u64,               // Size in bytes
        name: String,            // Name of the volume
        status: String,          // Status of the volume (e.g., "available", "in-use")
        host_mount_path: String, // Path where the volume is mounted
        metadata: VolumeMetadata, // Metadata for tracking volume status and details
        qos: Option<QoSConfig>,  // QoS settings for performance
        security: Option<SecurityConfig>, // Security settings
        backup_policy: Option<BackupPolicy>, // Backup settings
    },
    NetworkAttached {
        id: Uuid,             // Unique identifier for the volume
        size: u64,            // Size in bytes
        name: String,         // Name of the volume
        status: String,       // Status of the volume (e.g., "available", "in-use")
        network_path: String, // Network path to the volume
        metadata: VolumeMetadata, // Metadata for tracking volume status and details
        qos: Option<QoSConfig>,  // QoS settings for performance
        security: Option<SecurityConfig>, // Security settings
        backup_policy: Option<BackupPolicy>, // Backup settings
    },
    Distributed {
        id: Uuid,           // Unique identifier for the volume
        size: u64,          // Size in bytes
        name: String,       // Name of the volume
        status: String,     // Status of the volume (e.g., "available", "in-use")
        nodes: Vec<String>, // List of nodes sharing this volume
        metadata: VolumeMetadata, // Metadata for tracking volume status and details
        qos: Option<QoSConfig>,  // QoS settings for performance
        security: Option<SecurityConfig>, // Security settings
        backup_policy: Option<BackupPolicy>, // Backup settings
    },
}

Documentation

Enum to represent persistent volumes in the cluster. This enum defines the different types of persistent volumes that can be used in the cluster, allowing for flexibility in how data is stored and accessed. The possible persistent volume types include: - Local: A volume that is stored on the local node, typically used for applications that require data to persist across restarts or need to maintain state beyond the lifecycle of a single app instance. - NetworkAttached: A volume that is shared across nodes in the cluster, allowing for data consistency and state management across app instances running on different nodes. - Distributed: A volume that is distributed across multiple nodes in the cluster, providing high availability and fault tolerance for applications that require data to be available even in the event of a node failure. This enum is used in the Volume struct to define the type of persistent volume that is being used in the cluster.

WARNING

Each persistent volume type has its own characteristics and limitations, and it is important to choose the right type based on the application's requirements for data persistence, availability, and performance. Additionally, care should be taken to manage the lifecycle of persistent volumes to avoid data loss or inconsistency, especially in the event of node failures or network partitions.

enum VolumeStatus

Definition

pub enum VolumeStatus {
    Available,
    InUse {
        node_id: Uuid, // ID of the node using the volume
    },
    Offline {
        last_seen: chrono::DateTime<chrono::Utc>, // Last time the volume was seen online
    },
    Blocked,
    Error,
}

Documentation

Enum to represent the status of a volume. This enum defines the different states a volume can be in, allowing for better management and monitoring of the volume's lifecycle. The possible statuses include: - Available: The volume is ready for use and not currently in use by any node. - InUse: The volume is currently being used by a node, identified by its node ID. - Offline: The volume is not currently accessible, with a timestamp indicating the last time it was seen online. - Blocked: The volume is blocked and cannot be used, possibly due to a failure or misconfiguration. - Error: The volume is in an error state, indicating a problem with the volume or its configuration.

enum AccessMode

Definition

pub enum AccessMode {
    ReadWriteOnce,
    ReadOnlyMany,
    ReadWriteMany,
}

Documentation

Enum to represent access modes for shared volumes. This enum defines the different access modes that can be applied to shared volumes, allowing for flexibility in how volumes are accessed by different nodes. The access modes include: - ReadWriteOnce (RWO): The volume can be mounted as read-write by a single node. - ReadOnlyMany (ROX): The volume can be mounted as read-only by many nodes. - ReadWriteMany (RWX): The volume can be mounted as read-write by many nodes. This enum is used in the SharedVolume struct to define how the volume can be accessed by different nodes in the cluster.

struct VolumeSnapshot

Definition

pub struct VolumeSnapshot {
    id: Uuid,
    source_volume_id: Uuid,
    name: String,
    creation_time: chrono::DateTime<chrono::Utc>,
    size: u64,
    consistency_type: ConsistencyType,
}

Documentation

Snapshot of a volume at a point in time

enum VolumeError

Definition

pub enum VolumeError {
    NotFound,
    AlreadyExists,
    InsufficientCapacity,
    AccessDenied,
    InvalidState,
    ValidationFailed(String),
    DriverFailed(String),
    Timeout,
    Internal(String),
}

Documentation

Error type for volume operations

struct VolumeConfig

Definition

pub struct VolumeConfig {
    name: String,
    size: u64,
    volume_type: String,
    access_mode: Option<AccessMode>,
    qos: Option<QoSConfig>,
    security: Option<SecurityConfig>,
    backup_policy: Option<BackupPolicy>,
    labels: HashMap<String, String>,
}

Documentation

Configuration for creating a new volume

fn create

Definition

    pub fn create(config: VolumeConfig) -> Result<Self, VolumeError> {
        // Implementation would go here
        unimplemented!("Volume creation not yet implemented")
    }

    /// Deletes this volume
    pub fn delete(&self) -> Result<(), VolumeError> {
    // ... function body
}

Documentation

Creates a new volume based on the provided configuration

fn delete

Definition

    pub fn delete(&self) -> Result<(), VolumeError> {
        // Implementation would go here
        unimplemented!("Volume deletion not yet implemented")
    }

    /// Attaches this volume to a specified node
    pub fn attach(&mut self, node_id: &str) -> Result<(), VolumeError> {
    // ... function body
}

Documentation

Deletes this volume

fn attach

Definition

    pub fn attach(&mut self, node_id: &str) -> Result<(), VolumeError> {
        // Implementation would go here
        unimplemented!("Volume attachment not yet implemented")
    }

    /// Detaches this volume from its current node
    pub fn detach(&mut self) -> Result<(), VolumeError> {
    // ... function body
}

Documentation

Attaches this volume to a specified node

fn detach

Definition

    pub fn detach(&mut self) -> Result<(), VolumeError> {
        // Implementation would go here
        unimplemented!("Volume detachment not yet implemented")
    }

    /// Expands this volume to a new size
    pub fn expand(&mut self, new_size: u64) -> Result<(), VolumeError> {
    // ... function body
}

Documentation

Detaches this volume from its current node

fn expand

Definition

    pub fn expand(&mut self, new_size: u64) -> Result<(), VolumeError> {
        // Implementation would go here
        unimplemented!("Volume expansion not yet implemented")
    }

    /// Creates a snapshot of this volume
    pub fn snapshot(&self, name: &str) -> Result<VolumeSnapshot, VolumeError> {
    // ... function body
}

Documentation

Expands this volume to a new size

fn snapshot

Definition

    pub fn snapshot(&self, name: &str) -> Result<VolumeSnapshot, VolumeError> {
        // Implementation would go here
        unimplemented!("Volume snapshot not yet implemented")
    }

    /// Restores this volume from a snapshot
    pub fn restore_from_snapshot(&mut self, snapshot: &VolumeSnapshot) -> Result<(), VolumeError> {
    // ... function body
}

Documentation

Creates a snapshot of this volume

fn restore_from_snapshot

Definition

    pub fn restore_from_snapshot(&mut self, snapshot: &VolumeSnapshot) -> Result<(), VolumeError> {
        // Implementation would go here
        unimplemented!("Volume restore not yet implemented")
    }

    /// Creates a clone of this volume
    pub fn clone(&self, name: &str) -> Result<Self, VolumeError> {
    // ... function body
}

Documentation

Restores this volume from a snapshot

fn clone

Definition

    pub fn clone(&self, name: &str) -> Result<Self, VolumeError> {
        // Implementation would go here
        unimplemented!("Volume cloning not yet implemented")
    }

    /// Transforms this volume to a different type
    pub fn transform(&self, to_type: String) -> Result<Self, VolumeError> {
    // ... function body
}

Documentation

Creates a clone of this volume

fn transform

Definition

    pub fn transform(&self, to_type: String) -> Result<Self, VolumeError> {
        // Implementation would go here
        unimplemented!("Volume transformation not yet implemented")
    }

    /// Checks the integrity of this volume
    pub fn check_integrity(&self) -> Result<bool, VolumeError> {
    // ... function body
}

Documentation

Transforms this volume to a different type

fn check_integrity

Definition

    pub fn check_integrity(&self) -> Result<bool, VolumeError> {
        // Implementation would go here
        unimplemented!("Volume integrity checking not yet implemented")
    }

    /// Repairs this volume if possible
    pub fn repair(&mut self) -> Result<(), VolumeError> {
    // ... function body
}

Documentation

Checks the integrity of this volume

fn repair

Definition

    pub fn repair(&mut self) -> Result<(), VolumeError> {
        // Implementation would go here
        unimplemented!("Volume repair not yet implemented")
    }

    /// Updates the QoS configuration for this volume
    pub fn update_qos(&mut self, qos: QoSConfig) -> Result<(), VolumeError> {
    // ... function body
}

Documentation

Repairs this volume if possible

fn update_qos

Definition

    pub fn update_qos(&mut self, qos: QoSConfig) -> Result<(), VolumeError> {
        // Implementation would go here
        unimplemented!("QoS update not yet implemented")
    }

    /// Updates the security configuration for this volume
    pub fn update_security(&mut self, security: SecurityConfig) -> Result<(), VolumeError> {
    // ... function body
}

Documentation

Updates the QoS configuration for this volume

fn update_security

Definition

    pub fn update_security(&mut self, security: SecurityConfig) -> Result<(), VolumeError> {
        // Implementation would go here
        unimplemented!("Security update not yet implemented")
    }

    /// Updates the backup policy for this volume
    pub fn update_backup_policy(&mut self, policy: BackupPolicy) -> Result<(), VolumeError> {
    // ... function body
}

Documentation

Updates the security configuration for this volume

fn update_backup_policy

Definition

    pub fn update_backup_policy(&mut self, policy: BackupPolicy) -> Result<(), VolumeError> {
        // Implementation would go here
        unimplemented!("Backup policy update not yet implemented")
    }
    // ... function body
}

Documentation

Updates the backup policy for this volume

⚠️ **GitHub.com Fallback** ⚠️