schemas_v1_db_queries_storage - OmniCloudOrg/OmniOrchestrator GitHub Wiki
Path: src/schemas/v1/db/queries/storage.rs
- struct StorageClassFilter
- struct StorageVolumeFilter
- async fn list_storage_classes
- async fn get_storage_class_by_id
- async fn list_storage_volumes
- async fn count_storage_volumes_with_filter
- async fn get_volumes_by_storage_class
- async fn list_storage_qos_policies
- async fn get_volumes_by_write_concern
- async fn get_volumes_by_persistence_level
- struct RegionVolumes
- async fn get_volumes_for_region
- async fn count_volumes_for_region
- struct ProviderRegionVolumes
- async fn get_volumes_for_provider
- async fn count_volumes_for_provider
pub struct StorageClassFilter {
pub storage_type: Option<String>,
pub volume_binding_mode: Option<String>,
pub allow_volume_expansion: Option<bool>,
}
Storage class query filters
pub struct StorageVolumeFilter {
pub app_id: Option<i64>,
pub storage_class_id: Option<i64>,
pub status: Option<String>,
pub node_id: Option<i64>,
pub persistence_level: Option<String>,
pub write_concern: Option<String>,
}
Storage volume query filters
pub async fn list_storage_classes(
pool: &Pool<MySql>,
filter: StorageClassFilter,
) -> anyhow::Result<Vec<StorageClass>> {
// ... function body
}
Retrieves all storage classes with optional filtering
pub async fn get_storage_class_by_id(
pool: &Pool<MySql>,
id: i64,
) -> anyhow::Result<Option<StorageClass>> {
// ... function body
}
Retrieves a single storage class by ID
pub async fn list_storage_volumes(
pool: &Pool<MySql>,
filter: StorageVolumeFilter,
page: i64,
per_page: i64,
) -> anyhow::Result<Vec<StorageVolume>> {
// ... function body
}
Retrieves a paginated list of storage volumes with filtering
pub async fn count_storage_volumes_with_filter(
pool: &Pool<MySql>,
filter: &StorageVolumeFilter,
) -> anyhow::Result<i64> {
// ... function body
}
Counts storage volumes with the same filtering options
pub async fn get_volumes_by_storage_class(
pool: &Pool<MySql>,
storage_class_id: i64,
page: i64,
per_page: i64,
) -> anyhow::Result<Vec<StorageVolume>> {
// ... function body
}
Get volumes by storage class
pub async fn list_storage_qos_policies(
pool: &Pool<MySql>,
) -> anyhow::Result<Vec<StorageQosPolicy>> {
// ... function body
}
Get QoS policies
pub async fn get_volumes_by_write_concern(
pool: &Pool<MySql>,
write_concern: String,
page: i64,
per_page: i64,
) -> anyhow::Result<Vec<StorageVolume>> {
// ... function body
}
Get storage with specified write concern
pub async fn get_volumes_by_persistence_level(
pool: &Pool<MySql>,
persistence_level: String,
page: i64,
per_page: i64,
) -> anyhow::Result<Vec<StorageVolume>> {
// ... function body
}
Get volumes with specific persistence level
pub struct RegionVolumes {
pub region: Region,
pub volumes: Vec<StorageVolume>
}
Struct to represent a Region with its storage volumes
pub async fn get_volumes_for_region(
pool: &Pool<MySql>,
region_id: i64,
page: i64,
per_page: i64,
) -> anyhow::Result<RegionVolumes> {
// ... function body
}
Retrieves storage volumes for a specific region grouped by region with pagination
pub async fn count_volumes_for_region(
pool: &Pool<MySql>,
region_id: i64,
) -> anyhow::Result<i64> {
// ... function body
}
Counts the total number of storage volumes for a specific region
pub struct ProviderRegionVolumes {
pub provider: Provider,
pub regions: Vec<RegionVolumes>
}
pub async fn get_volumes_for_provider(
pool: &Pool<MySql>,
provider_id: i64,
page: i64,
per_page: i64,
) -> anyhow::Result<ProviderRegionVolumes> {
// ... function body
}
Retrieves storage volumes for a specific provider grouped by region with pagination
pub async fn count_volumes_for_provider(
pool: &Pool<MySql>,
provider_id: i64,
) -> anyhow::Result<i64> {
// ... function body
}
Counts the total number of storage volumes for a specific provider