Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(rust): add one second cache for incoming and outgoing access control #7784

Merged
merged 2 commits into from
Mar 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions implementations/rust/ockam/ockam_api/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ storage = ["ockam/storage"]
aws-config = { version = "1.1.8", default-features = false, features = ["rustls"] }
base64-url = "2.0.2"
bytes = { version = "1.5.0", default-features = false, features = ["serde"] }
cfg-if = "1.0.0"
chrono = { version = "0.4" }
colorful = "0.2"
either = { version = "1.10.0", default-features = false }
Expand Down
11 changes: 10 additions & 1 deletion implementations/rust/ockam/ockam_api/src/nodes/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,16 @@ impl NodeManager {
authority,
)
.await?;
Ok(Arc::new(policy_access_control))

cfg_if::cfg_if! {
if #[cfg(feature = "std")] {
let cached_policy_access_control = ockam_core::access_control::CachedIncomingAccessControl::new(
Box::new(policy_access_control));
Ok(Arc::new(cached_policy_access_control))
} else {
Ok(Arc::new(policy_access_control))
}
}
} else {
warn! {
resource_name = resource_name_str,
Expand Down
4 changes: 4 additions & 0 deletions implementations/rust/ockam/ockam_core/src/access_control.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,17 @@ pub trait OutgoingAccessControl: Debug + Send + Sync + 'static {
mod all;
mod allow_all;
mod any;
#[cfg(feature = "std")]
mod cache;
mod deny_all;
mod onward;
mod source;

pub use all::*;
pub use allow_all::*;
pub use any::*;
#[cfg(feature = "std")]
pub use cache::*;
pub use deny_all::*;
pub use onward::*;
pub use source::*;
Loading
Loading