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

Replace GraphMap’s map with a moka::sync::Cache #1224

Merged
merged 1 commit into from
Feb 4, 2025
Merged
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
130 changes: 129 additions & 1 deletion Cargo.lock

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

5 changes: 5 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -54,12 +54,14 @@ bytes = "1.5"
bytesize = "1.3"
chrono = { version = "0.4.35", default-features = false }
clap = "4"
moka = "0.12.10"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

have you consider also exposing moka expiration policies TTL and TTI as env vars ? I was hoping that we can control both time and mem dimensions ... Moka looks great!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah was considering it. But at least as this PR is, we should be able to avoid blowing up the memory usage which was the main goal of this PR.

concat-idents = "1"
cpe = "0.1.5"
criterion = "0.5.1"
csaf = { version = "0.5.0", default-features = false }
csaf-walker = { version = "0.10.0", default-features = false }
cve = "0.3.1"
deepsize = "0.2.0"
env_logger = "0.11.0"
fixedbitset = "0.5.7"
futures = "0.3.30"
@@ -207,3 +209,6 @@ langchain-rust = { git = "https://github.com/chirino/langchain-rust", branch = "

# to pickup fix: https://github.com/eikendev/sectxt/issues/21
sectxtlib = { git = "https://github.com/ctron/sectxt", branch = "feature/fix_deps_1" }

# to pickup feat: https://github.com/Aeledfyr/deepsize/pull/41
deepsize = { git = "https://github.com/chirino/deepsize", branch = "main" }
1 change: 1 addition & 0 deletions common/Cargo.toml
Original file line number Diff line number Diff line change
@@ -18,6 +18,7 @@ bytesize = { workspace = true, features = ["serde"] }
chrono = { workspace = true }
clap = { workspace = true, features = ["derive", "env"] }
cpe = { workspace = true }
deepsize = { workspace = true }
hex = { workspace = true }
human-date-parser = { workspace = true }
itertools = { workspace = true }
3 changes: 2 additions & 1 deletion common/src/cpe.rs
Original file line number Diff line number Diff line change
@@ -2,6 +2,7 @@ use cpe::{
cpe::Cpe as _,
uri::{OwnedUri, Uri},
};
use deepsize::DeepSizeOf;
use serde::{
de::{Error, Visitor},
Deserialize, Deserializer, Serialize, Serializer,
@@ -17,7 +18,7 @@ use utoipa::{
};
use uuid::Uuid;

#[derive(Clone, Hash, Eq, PartialEq)]
#[derive(Clone, Hash, Eq, PartialEq, DeepSizeOf)]
pub struct Cpe {
uri: OwnedUri,
}
3 changes: 2 additions & 1 deletion common/src/purl.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use deepsize::DeepSizeOf;
use packageurl::PackageUrl;
use percent_encoding::{utf8_percent_encode, AsciiSet, CONTROLS};
use serde::{
@@ -25,7 +26,7 @@ pub enum PurlErr {
Package(#[from] packageurl::Error),
}

#[derive(Clone, PartialEq, Eq, Hash)]
#[derive(Clone, PartialEq, Eq, Hash, DeepSizeOf)]
pub struct Purl {
pub ty: String,
pub namespace: Option<String>,
Loading