use crate::model::Params;
use crate::{ImageThumbs, ThumbsResult};
use object_store::gcp::{GoogleCloudStorage, GoogleCloudStorageBuilder};
use std::sync::Arc;
use tokio::sync::RwLock;
impl ImageThumbs<GoogleCloudStorage> {
#[doc = include_str!("../examples/image_thumbs.yaml")]
pub fn new(config: &str) -> ThumbsResult<Self> {
let client = GoogleCloudStorageBuilder::from_env()
.with_client_options(Self::client_options())
.build()?;
Ok(Self {
client: Arc::new(RwLock::new(client)),
settings: Arc::new(Self::settings(config)?),
})
}
pub fn new_with_settings(settings: Vec<Params>) -> ThumbsResult<Self> {
let client = GoogleCloudStorageBuilder::from_env()
.with_client_options(Self::client_options())
.build()?;
Ok(Self {
client: Arc::new(RwLock::new(client)),
settings: Arc::new(settings),
})
}
}