pub struct Fs<F> {
pub dir: Arc<Path>,
pub format: F,
pub buffer: Arc<Mutex<Vec<u8>>>,
pub prev_retrieve_time: Arc<RwLock<SystemTime>>,
pub cached: Arc<RwLock<Config>>,
}
Expand description
Fields§
§dir: Arc<Path>
§format: F
§buffer: Arc<Mutex<Vec<u8>>>
§prev_retrieve_time: Arc<RwLock<SystemTime>>
§cached: Arc<RwLock<Config>>
Implementations§
Source§impl<F> Fs<F>where
F: ConfigFormat,
impl<F> Fs<F>where
F: ConfigFormat,
pub fn entrance_config_path(&self) -> PathBuf
pub async fn collect_config( &self, ) -> Result<Config, Box<dyn Error + Send + Sync>>
pub async fn save_config( &self, config: Config, ) -> Result<(), Box<dyn Error + Send + Sync>>
pub async fn collect_gateway_item_config( &self, gateway_name: &str, ) -> Result<Option<ConfigItem>, Box<dyn Error + Send + Sync>>
pub async fn retrieve_cached<M, T>( &self, map: M, ) -> Result<T, Box<dyn Error + Send + Sync>>
pub async fn modify_cached<M>( &self, map: M, ) -> Result<(), Box<dyn Error + Send + Sync>>
pub fn new<P>(dir: P, format: F) -> Fs<F>
pub async fn clear_cache(&self)
pub fn gateway_suffix(&self) -> OsString
pub fn gateway_dir(&self) -> PathBuf
pub fn gateway_main_config_path(&self, gateway_name: &str) -> PathBuf
pub fn routes_dir(&self, gateway_name: &str) -> PathBuf
pub fn route_path(&self, gateway_name: &str, route_name: &str) -> PathBuf
pub fn plugin_dir(&self) -> PathBuf
pub fn plugin_path(&self, id: &PluginInstanceId) -> PathBuf
pub fn extract_gateway_name_from_route_dir(&self, path: &Path) -> Option<String>
pub fn extract_route_name(&self, path: &Path) -> Option<(String, String)>
Trait Implementations§
Source§impl<F> Create for Fs<F>
impl<F> Create for Fs<F>
async fn create_plugin( &self, id: &PluginInstanceId, value: Value, ) -> Result<(), Box<dyn Error + Send + Sync>>
async fn create_config_item( &self, gateway_name: &str, item: ConfigItem, ) -> Result<(), Box<dyn Error + Send + Sync>>
async fn create_config_item_gateway( &self, gateway_name: &str, gateway: SgGateway, ) -> Result<(), Box<dyn Error + Send + Sync>>
async fn create_config_item_route( &self, gateway_name: &str, route_name: &str, route: SgHttpRoute, ) -> Result<(), Box<dyn Error + Send + Sync>>
fn create_config( &self, config: Config, ) -> impl Future<Output = Result<(), Box<dyn Error + Send + Sync>>> + Send
Source§impl<F> CreateListener for Fs<F>
impl<F> CreateListener for Fs<F>
Source§impl<F> Delete for Fs<F>
impl<F> Delete for Fs<F>
async fn delete_plugin( &self, id: &PluginInstanceId, ) -> Result<(), Box<dyn Error + Send + Sync>>
async fn delete_config_item_gateway( &self, gateway_name: &str, ) -> Result<(), Box<dyn Error + Send + Sync>>
async fn delete_config_item_route( &self, gateway_name: &str, route_name: &str, ) -> Result<(), Box<dyn Error + Send + Sync>>
async fn delete_config_item( &self, gateway_name: &str, ) -> Result<(), Box<dyn Error + Send + Sync>>
async fn delete_config_item_all_routes( &self, gateway_name: &str, ) -> Result<(), Box<dyn Error + Send + Sync>>
Source§impl<F> Retrieve for Fs<F>
impl<F> Retrieve for Fs<F>
async fn retrieve_all_plugins( &self, ) -> Result<Vec<PluginConfig>, Box<dyn Error + Send + Sync>>
async fn retrieve_plugin( &self, id: &PluginInstanceId, ) -> Result<Option<PluginConfig>, Box<dyn Error + Send + Sync>>
async fn retrieve_config_item_gateway( &self, gateway_name: &str, ) -> Result<Option<SgGateway>, Box<dyn Error + Send + Sync>>
async fn retrieve_config_item_route( &self, gateway_name: &str, route_name: &str, ) -> Result<Option<SgHttpRoute>, Box<dyn Error + Send + Sync>>
async fn retrieve_config_item_route_names( &self, name: &str, ) -> Result<Vec<String>, Box<dyn Error + Send + Sync>>
async fn retrieve_config_names( &self, ) -> Result<Vec<String>, Box<dyn Error + Send + Sync>>
async fn retrieve_config(&self) -> Result<Config, Box<dyn Error + Send + Sync>>
async fn retrieve_plugins_by_code( &self, code: &str, ) -> Result<Vec<PluginConfig>, Box<dyn Error + Send + Sync>>
fn retrieve_config_item_all_routes( &self, name: &str, ) -> impl Future<Output = Result<BTreeMap<String, SgHttpRoute>, Box<dyn Error + Send + Sync>>> + Send
fn retrieve_config_item( &self, name: &str, ) -> impl Future<Output = Result<Option<ConfigItem>, Box<dyn Error + Send + Sync>>> + Send
Source§impl<F> Update for Fs<F>
impl<F> Update for Fs<F>
async fn update_plugin( &self, id: &PluginInstanceId, value: Value, ) -> Result<(), Box<dyn Error + Send + Sync>>
async fn update_config_item_gateway( &self, gateway_name: &str, gateway: SgGateway, ) -> Result<(), Box<dyn Error + Send + Sync>>
async fn update_config_item_route( &self, gateway_name: &str, route_name: &str, route: SgHttpRoute, ) -> Result<(), Box<dyn Error + Send + Sync>>
async fn update_config_item( &self, gateway_name: &str, item: ConfigItem, ) -> Result<(), Box<dyn Error + Send + Sync>>
async fn update_config( &self, config: Config, ) -> Result<(), Box<dyn Error + Send + Sync>>
Auto Trait Implementations§
impl<F> Freeze for Fs<F>where
F: Freeze,
impl<F> !RefUnwindSafe for Fs<F>
impl<F> Send for Fs<F>where
F: Send,
impl<F> Sync for Fs<F>where
F: Sync,
impl<F> Unpin for Fs<F>where
F: Unpin,
impl<F> !UnwindSafe for Fs<F>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more