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

Draft
wants to merge 7 commits into
base: main
Choose a base branch
from
128 changes: 127 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
Expand Up @@ -54,12 +54,14 @@ bytes = "1.5"
bytesize = "1.3"
chrono = { version = "0.4.35", default-features = false }
clap = "4"
moka = "0.12.10"
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"
futures = "0.3.30"
futures-util = "0.3"
Expand Down Expand Up @@ -203,3 +205,6 @@ osv = { git = "https://github.com/ctron/osv", rev = "b53f1590bbbdc663e3efe405f1f
# to pickup fix: https://github.com/Abraxas-365/langchain-rust/pull/246
# and fix: https://github.com/Abraxas-365/langchain-rust/pull/250
langchain-rust = { git = "https://github.com/chirino/langchain-rust", branch = "main" }

# 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
Expand Up @@ -15,6 +15,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 }
Expand Down
3 changes: 2 additions & 1 deletion common/src/cpe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use cpe::{
cpe::Cpe as _,
uri::{OwnedUri, Uri},
};
use deepsize::DeepSizeOf;
use serde::{
de::{Error, Visitor},
Deserialize, Deserializer, Serialize, Serializer,
Expand All @@ -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,
}
Expand Down
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::{
Expand Down Expand Up @@ -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>,
Expand Down
1 change: 1 addition & 0 deletions entity/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ trustify-cvss = { workspace = true }

async-graphql = { workspace = true, features = ["uuid", "time"] }
cpe = { workspace = true }
deepsize = { workspace = true }
schemars = { workspace = true }
sea-orm = { workspace = true, features = [
"sqlx-postgres",
Expand Down
2 changes: 2 additions & 0 deletions entity/src/relationship.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use deepsize::DeepSizeOf;
use sea_orm::{DeriveActiveEnum, EnumIter};
use std::fmt;

Expand All @@ -17,6 +18,7 @@ use std::fmt;
)]
#[sea_orm(rs_type = "i32", db_type = "Integer")]
#[serde(rename_all = "snake_case")]
#[derive(DeepSizeOf)]
// When adding a new variant, also add this to the "relationship" table.
pub enum Relationship {
#[sea_orm(num_value = 0)]
Expand Down
2 changes: 2 additions & 0 deletions modules/analysis/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ actix-http = { workspace = true }
actix-web = { workspace = true }
anyhow = { workspace = true }
cpe = { workspace = true }
deepsize = { workspace = true, features = ["cpe", "petgraph"] }
log = { workspace = true }
moka = { workspace = true, features = ["sync"] }
parking_lot = { workspace = true }
petgraph = { workspace = true }
sea-orm = { workspace = true }
Expand Down
Loading