use crate::api::rest_api::RESTApi;
use crate::catalog::Identifier;
use crate::table::snapshot_commit::{RESTSnapshotCommit, SnapshotCommit};
use std::sync::Arc;
#[derive(Clone)]
pub struct RESTEnv {
identifier: Identifier,
uuid: String,
api: Arc<RESTApi>,
}
impl std::fmt::Debug for RESTEnv {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.debug_struct("RESTEnv")
.field("identifier", &self.identifier)
.field("uuid", &self.uuid)
.finish()
}
}
impl RESTEnv {
pub fn new(identifier: Identifier, uuid: String, api: Arc<RESTApi>) -> Self {
Self {
identifier,
uuid,
api,
}
}
pub fn snapshot_commit(&self) -> Arc<dyn SnapshotCommit> {
Arc::new(RESTSnapshotCommit::new(
self.api.clone(),
self.identifier.clone(),
self.uuid.clone(),
))
}
}