mirror of
https://github.com/rustfs/rustfs.git
synced 2026-08-28 07:57:01 +00:00
Inject GlobalReadiness into HTTP server pipeline and gate traffic until FullReady (#1255)
This commit is contained in:
@@ -67,6 +67,13 @@ pub struct IamSys<T> {
|
||||
}
|
||||
|
||||
impl<T: Store> IamSys<T> {
|
||||
/// Create a new IamSys instance with the given IamCache store
|
||||
///
|
||||
/// # Arguments
|
||||
/// * `store` - An Arc to the IamCache instance
|
||||
///
|
||||
/// # Returns
|
||||
/// A new instance of IamSys
|
||||
pub fn new(store: Arc<IamCache<T>>) -> Self {
|
||||
tokio::spawn(async move {
|
||||
match opa::lookup_config().await {
|
||||
@@ -87,6 +94,11 @@ impl<T: Store> IamSys<T> {
|
||||
roles_map: HashMap::new(),
|
||||
}
|
||||
}
|
||||
|
||||
/// Check if the IamSys has a watcher configured
|
||||
///
|
||||
/// # Returns
|
||||
/// `true` if a watcher is configured, `false` otherwise
|
||||
pub fn has_watcher(&self) -> bool {
|
||||
self.store.api.has_watcher()
|
||||
}
|
||||
@@ -859,6 +871,11 @@ impl<T: Store> IamSys<T> {
|
||||
|
||||
self.get_combined_policy(&policies).await.is_allowed(args).await
|
||||
}
|
||||
|
||||
/// Check if the underlying store is ready
|
||||
pub fn is_ready(&self) -> bool {
|
||||
self.store.is_ready()
|
||||
}
|
||||
}
|
||||
|
||||
fn is_allowed_by_session_policy(args: &Args<'_>) -> (bool, bool) {
|
||||
|
||||
Reference in New Issue
Block a user