Skip to content

Commit

Permalink
Move assignments into sqd-messages (#27)
Browse files Browse the repository at this point in the history
  • Loading branch information
denisbsu authored Nov 14, 2024
1 parent c5285c5 commit 851ca47
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 337 deletions.
12 changes: 9 additions & 3 deletions Cargo.lock

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

6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ tracing-subscriber = { version = "0.3.18", features = ["env-filter"] }
url = "2.5.2"
walkdir = "2.5.0"

sqd-contract-client = { git = "https://github.com/subsquid/sqd-network.git", rev = "106bd6c", version = "1.1.0" }
sqd-messages = { git = "https://github.com/subsquid/sqd-network.git", rev = "106bd6c", version = "2.0.0", features = ["bitstring"] }
sqd-network-transport = { git = "https://github.com/subsquid/sqd-network.git", rev = "106bd6c", version = "2.0.0", features = ["worker", "metrics"] }
sqd-contract-client = { git = "https://github.com/subsquid/sqd-network.git", rev = "459dc92", version = "1.1.0" }
sqd-messages = { git = "https://github.com/subsquid/sqd-network.git", rev = "459dc92", version = "2.0.0", features = ["bitstring", "assignment_reader"] }
sqd-network-transport = { git = "https://github.com/subsquid/sqd-network.git", rev = "459dc92", version = "2.0.0", features = ["worker", "metrics"] }
sqd-query = { git = "https://github.com/subsquid/data.git", rev = "f7f39e4", features = ["parquet"] }
sqd-polars = { git = "https://github.com/subsquid/data.git", rev = "f7f39e4" }

Expand Down
8 changes: 5 additions & 3 deletions src/controller/p2p.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,11 @@ use crate::{
query::result::{QueryError, QueryResult},
run_all,
storage::datasets_index::DatasetsIndex,
util::{assignment::Assignment, timestamp_now_ms, UseOnce},
util::{timestamp_now_ms, UseOnce},
};

use sqd_messages::assignments::Assignment;

use super::worker::Worker;

const WORKER_VERSION: &str = env!("CARGO_PKG_VERSION");
Expand Down Expand Up @@ -219,15 +221,15 @@ impl<EventStream: Stream<Item = WorkerEvent>> P2PController<EventStream> {
};
let peer_id = self.worker_id;
let calculated_chunks =
match assignment.dataset_chunks_for_peer_id(peer_id.to_string()) {
match assignment.dataset_chunks_for_peer_id(&peer_id.to_string()) {
Some(chunks) => chunks,
None => {
error!("Can not get assigned chunks.");
return;
}
};
let headers =
match assignment.headers_for_peer_id(peer_id.to_string(), &self.private_key) {
match assignment.headers_for_peer_id(&peer_id.to_string(), &self.private_key) {
Ok(headers) => headers,
Err(error) => {
error!("Can not get assigned headers: {error:?}");
Expand Down
2 changes: 1 addition & 1 deletion src/storage/datasets_index.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ impl DatasetsIndex {
})
}
pub fn from(
assigned_data: Vec<crate::util::assignment::Dataset>,
assigned_data: Vec<sqd_messages::assignments::Dataset>,
headers: BTreeMap<String, String>,
assignment_id: String,
) -> Self {
Expand Down
290 changes: 0 additions & 290 deletions src/util/assignment.rs

This file was deleted.

2 changes: 0 additions & 2 deletions src/util/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ pub mod iterator;
mod once;
#[macro_use]
pub mod run_all;
pub mod assignment;
pub mod signature;
pub mod tests;
pub mod timestamp;

Expand Down
Loading

0 comments on commit 851ca47

Please sign in to comment.