Skip to content

Commit 280021e

Browse files
committed
Create a mithril-signed-entity-lockand a m̀ithril-transaction-preloader` modules
1 parent c7e97ba commit 280021e

File tree

29 files changed

+224
-50
lines changed

29 files changed

+224
-50
lines changed

Cargo.lock

Lines changed: 27 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ members = [
1414
"internal/mithril-metric",
1515
"internal/mithril-persistence",
1616
"internal/mithril-resource-pool",
17+
"internal/signed-entity/mithril-signed-entity-lock",
18+
"internal/signed-entity/mithril-transaction-preloader",
1719
"mithril-aggregator",
1820
"mithril-client",
1921
"mithril-client-cli",
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
[package]
2+
name = "mithril-signed-entity-lock"
3+
version = "0.0.1"
4+
description = "A non-blocking lock mechanism for signed entity type."
5+
authors = { workspace = true }
6+
edition = { workspace = true }
7+
homepage = { workspace = true }
8+
license = { workspace = true }
9+
repository = { workspace = true }
10+
11+
[lib]
12+
crate-type = ["lib", "cdylib", "staticlib"]
13+
14+
[dependencies]
15+
mithril-common = { path = "../../../mithril-common" }
16+
tokio = { version = "1.43.0" }
17+
18+
[dev-dependencies]
19+
tokio = { version = "1.43.0", features = ["macros"] }
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
.PHONY: all build test check doc
2+
3+
CARGO = cargo
4+
5+
all: test build
6+
7+
build:
8+
${CARGO} build --release
9+
10+
test:
11+
${CARGO} test
12+
13+
check:
14+
${CARGO} check --release --all-features --all-targets
15+
${CARGO} clippy --release --all-features --all-targets
16+
${CARGO} fmt --check
17+
18+
doc:
19+
${CARGO} doc --no-deps --open --features full
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Mithril-transaction-preloader
2+
3+
This crate provides a non-blocking lock mechanism for signed entity type.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#![warn(missing_docs)]
2+
3+
//! This module provides a non-blocking lock mechanism for signed entity types to prevent multiple
4+
//! modification on a same entity type at the same time.
5+
6+
mod signed_entity_type_lock;
7+
8+
pub use signed_entity_type_lock::*;

mithril-common/src/signed_entity_type_lock.rs renamed to internal/signed-entity/mithril-signed-entity-lock/src/signed_entity_type_lock.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use std::collections::BTreeSet;
77

88
use tokio::sync::RwLock;
99

10-
use crate::entities::SignedEntityTypeDiscriminants;
10+
use mithril_common::entities::SignedEntityTypeDiscriminants;
1111

1212
/// Non-blocking lock mechanism for signed entity types to prevent multiple
1313
/// modification on a same entity type at the same time.
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
[package]
2+
name = "mithril-transaction-preloader"
3+
version = "0.0.1"
4+
description = "A preload mechanism for Cardano Transaction signed entity."
5+
authors = { workspace = true }
6+
edition = { workspace = true }
7+
homepage = { workspace = true }
8+
license = { workspace = true }
9+
repository = { workspace = true }
10+
11+
[lib]
12+
crate-type = ["lib", "cdylib", "staticlib"]
13+
14+
[dependencies]
15+
anyhow = "1.0.95"
16+
async-trait = "0.1.86"
17+
mithril-common = { path = "../../../mithril-common", features = ["fs"] }
18+
mithril-signed-entity-lock = { path = "../mithril-signed-entity-lock" }
19+
slog = "2.7.0"
20+
tokio = { version = "1.43.0", features = ["sync"] }
21+
22+
[dev-dependencies]
23+
mithril-common = { path = "../../../mithril-common", features = ["test_tools"] }
24+
mockall = "0.13.1"
25+
slog-async = "2.8.0"
26+
slog-term = "2.9.1"
27+
tokio = { version = "1.43.0", features = ["macros"] }
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
.PHONY: all build test check doc
2+
3+
CARGO = cargo
4+
5+
all: test build
6+
7+
build:
8+
${CARGO} build --release
9+
10+
test:
11+
${CARGO} test
12+
13+
check:
14+
${CARGO} check --release --all-features --all-targets
15+
${CARGO} clippy --release --all-features --all-targets
16+
${CARGO} fmt --check
17+
18+
doc:
19+
${CARGO} doc --no-deps --open --features full
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Mithril-resource-pool
2+
3+
This crate provide a preload mechanism for Cardano Transaction signed entity.

0 commit comments

Comments
 (0)