dora_message/
lib.rs

1//! Enable serialisation and deserialisation of capnproto messages
2//!
3
4#![allow(clippy::missing_safety_doc)]
5
6pub use uhlc;
7
8pub mod common;
9pub mod config;
10pub mod descriptor;
11pub mod id;
12pub mod metadata;
13
14pub mod coordinator_to_daemon;
15pub mod daemon_to_coordinator;
16
17pub mod daemon_to_daemon;
18
19pub mod daemon_to_node;
20pub mod node_to_daemon;
21
22pub mod cli_to_coordinator;
23pub mod coordinator_to_cli;
24
25pub use arrow_data;
26pub use arrow_schema;
27
28pub type DataflowId = uuid::Uuid;
29
30fn current_crate_version() -> semver::Version {
31    let crate_version_raw = env!("CARGO_PKG_VERSION");
32    let crate_version = semver::Version::parse(crate_version_raw).unwrap();
33    crate_version
34}
35
36fn versions_compatible(
37    crate_version: &semver::Version,
38    specified_version: &semver::Version,
39) -> Result<bool, String> {
40    let req = semver::VersionReq::parse(&crate_version.to_string()).map_err(|error| {
41        format!("failed to parse crate version `{crate_version}` as `VersionReq`: {error}")
42    })?;
43    let specified_dora_req = semver::VersionReq::parse(&specified_version.to_string())
44        .map_err(|error| {
45            format!(
46                "failed to parse specified dora version `{specified_version}` as `VersionReq`: {error}",
47            )
48        })?;
49    let matches = req.matches(&specified_version) || specified_dora_req.matches(crate_version);
50    Ok(matches)
51}