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

Handle Sigkill signal to not lose in-memory jobs #91

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
Draft
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
39 changes: 37 additions & 2 deletions Cargo.lock

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

73 changes: 38 additions & 35 deletions zstor/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
[package]
name = "zstor_v2"
version = "0.3.0-rc.12"
authors = ["The Threefold Tech developers <[email protected]>"]
edition = "2021"
name = "zstor_v2"
repository = "https://github.com/threefoldtech/0-stor_v2"
version = "0.3.0-rc.12"

[[bin]]
name = "zstor_v2"
Expand All @@ -14,50 +14,53 @@ name = "test-zdb"
path = "src/test_zdb.rs"

[[bench]]
name = "aes_encryptor"
harness = false
name = "aes_encryptor"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[features]
vendored = ["openssl"]

[dependencies]
reed-solomon-erasure = "4"
rand = "0.7"
serde = { version = "1.0", features = ["derive"] }
toml = "0.5"
hex = "0.4"
aes-gcm = { version = "0.9", features = ["std"] }
snap = "1"
log = { version = "0.4", features = ["release_max_level_debug"] }
redis = { version = "0.20", default-features = false, features = ["aio", "tokio-comp", "connection-manager"] }
sha-1 = "0.9"
actix = "0.12"
actix-rt = "2.2"
aes-gcm = {version = "0.9", features = ["std"]}
async-trait = "0.1"
bincode = "1"
blake2 = "0.9"
chrono = "0.4"
futures = "0.3"
gray-codes = "0.1"
grid_explorer_client = {path = "../grid_explorer_client"}
hex = "0.4"
log = {version = "0.4", features = ["release_max_level_debug"]}
log4rs = {version = "1", default-features = false, features = ["rolling_file_appender", "threshold_filter", "fixed_window_roller", "size_trigger", "compound_policy"]}
nix = "0.22"
openssl = {version = "0.10", features = ["vendored"], optional = true}
path-clean = "0.1.0"
pretty_env_logger = "0.4"
prometheus = "0.12"
rand = "0.7"
redis = {version = "0.20", default-features = false, features = ["aio", "tokio-comp", "connection-manager"]}
reed-solomon-erasure = "4"
rustbreak = {version = "2.0.0", features = ["ron_enc"]}
serde = {version = "1.0", features = ["derive"]}
serde_json = "1"
sha-1 = "0.9"
signal-hook = "0.3.14"
simple_logger = "1.11" # TODO: remove this
pretty_env_logger = "0.4"
structopt = "0.3"
tokio = { version = "1", features = ["rt", "macros", "fs"] }
futures = "0.3"
blake2 = "0.9"
gray-codes = "0.1"
log4rs = { version = "1", default-features = false, features = ["rolling_file_appender", "threshold_filter", "fixed_window_roller", "size_trigger", "compound_policy"] }
async-trait = "0.1"
bincode = "1"
openssl = { version = "0.10", features = ["vendored"], optional = true }
actix = "0.12"
actix-rt = "2.2"
tokio-util = "0.6"
grid_explorer_client = { path = "../grid_explorer_client" }
chrono = "0.4"
serde_json = "1"
prometheus = "0.12"
tide = "0.16"
nix = "0.22"
path-clean = "0.1.0"
snap = "1"
structopt = "0.3"
tide = "0.16"
tokio = {version = "1", features = ["rt", "macros", "fs"]}
tokio-util = "0.6"
toml = "0.5"
uuid = {version = "1.1.2", features = ["v4"]}

[build-dependencies]
bindgen = "0.59"

[dev-dependencies]
rand = "0.7"
criterion = "0.3"
testutils = { path = "testutils" }
rand = "0.7"
testutils = {path = "testutils"}
15 changes: 15 additions & 0 deletions zstor/src/actors/zstor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,21 @@ pub struct Store {
pub blocking: bool,
}

/// Store objects can be Saved to the Disk with a DB implements this trait
pub trait StorePersist {
/// Returned Err
type Error;
/// Insert Store
/// Returns store's Id
fn insert(&self, store: Store) -> u128;
/// Delete Store By the returned Id
fn delete(&self, id: u128);
/// Return the content into Vector without consuming the handle
fn vectored_content(&self) -> Vec<Store>;
/// Persist the content
fn save(&self) -> Result<(), Self::Error>;
}

#[derive(Serialize, Deserialize, Debug, Message, Clone)]
#[rtype(result = "Result<(), ZstorError>")]
/// Message for the retrieve command of zstor.
Expand Down
Loading