reduct_base/msg/replication_api.rs
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67
// Copyright 2024 ReductSoftware UG
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at https://mozilla.org/MPL/2.0/.
use crate::msg::diagnostics::Diagnostics;
use crate::Labels;
use serde::{Deserialize, Serialize};
/// Replication settings
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Default)]
pub struct ReplicationSettings {
/// Source bucket
pub src_bucket: String,
/// Destination bucket
pub dst_bucket: String,
/// Destination host URL (e.g. https://reductstore.com)
pub dst_host: String,
/// Destination access token
#[serde(default)]
pub dst_token: String,
/// Entries to replicate. If empty, all entries are replicated. Wildcards are supported.
#[serde(default)]
pub entries: Vec<String>,
/// Labels to include
#[serde(default)]
pub include: Labels,
/// Labels to exclude
#[serde(default)]
pub exclude: Labels,
/// Replication each N-th record
#[serde(default)]
pub each_n: Option<u64>,
/// Replication a record every S seconds
#[serde(default)]
pub each_s: Option<f64>,
}
/// Replication info
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
pub struct ReplicationInfo {
/// Replication name
pub name: String,
/// Remote instance is available and replication is active
pub is_active: bool,
/// Replication is provisioned
pub is_provisioned: bool,
/// Number of records pending replication
pub pending_records: u64,
}
/// Replication list
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Default)]
pub struct ReplicationList {
/// Replication list
pub replications: Vec<ReplicationInfo>,
}
/// Replication settings
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
pub struct FullReplicationInfo {
/// Info
pub info: ReplicationInfo,
/// Settings
pub settings: ReplicationSettings,
/// Diagnostics
pub diagnostics: Diagnostics,
}