Skip to main content

tatara_core/domain/
volume.rs

1//! Persistent volume types for tatara workloads.
2
3use serde::{Deserialize, Serialize};
4
5/// Type of volume backend.
6#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
7#[serde(rename_all = "snake_case")]
8pub enum VolumeType {
9    /// Locally-managed directory on the node.
10    Local,
11    /// Bind-mount to an existing host path.
12    HostPath,
13    /// NFS mount.
14    Nfs,
15}
16
17/// Volume source configuration.
18#[derive(Debug, Clone, Serialize, Deserialize)]
19#[serde(tag = "type", rename_all = "snake_case")]
20pub enum VolumeSource {
21    Local {
22        #[serde(default)]
23        size_mb: Option<u64>,
24    },
25    HostPath {
26        path: String,
27    },
28    Nfs {
29        server: String,
30        path: String,
31    },
32}
33
34/// A volume declaration in a task group.
35#[derive(Debug, Clone, Serialize, Deserialize)]
36pub struct VolumeSpec {
37    pub name: String,
38    pub source: VolumeSource,
39    #[serde(default)]
40    pub read_only: bool,
41}
42
43/// A volume mount in a task.
44#[derive(Debug, Clone, Serialize, Deserialize)]
45pub struct VolumeClaim {
46    pub volume_name: String,
47    pub mount_path: String,
48    #[serde(default)]
49    pub read_only: bool,
50}