Skip to content

Commit

Permalink
feat(rust): add one second cache for incoming and outgoing access con…
Browse files Browse the repository at this point in the history
…trol
  • Loading branch information
davide-baldo committed Mar 20, 2024
1 parent b562b8c commit ccc1175
Show file tree
Hide file tree
Showing 6 changed files with 368 additions and 1 deletion.
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 Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ inherits = "test"
debug = 1
strip = "none"
inherits = "release"
force-frame-pointers = "yes"

# compromise: minimal optimization on selected dependencies
# to reduce cli bootstrap time by ~5x
Expand Down
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

0 comments on commit ccc1175

Please sign in to comment.