-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refacto: move records into their own crate
This commit creates the package `zenoh-flow-records`. The central structure is the `DataFlowRecord`: a data flow that is ready to be instantiated. All nodes are mapped to a runtime and the required connectors were added. The preferred way to create a `DataFlowRecord` is to call the method `complete_mapping_and_connect` on a `FlattenedDataFlowDescriptor` instance. This commit was also the opportunity to: - remove the `runtime` field from all the descriptors / records, - the remaining `String` were transformed into `Arc<str>`, Signed-off-by: Julien Loudet <julien.loudet@zettascale.tech>
- Loading branch information
Showing
33 changed files
with
989 additions
and
288 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// | ||
// Copyright (c) 2021 - 2023 ZettaScale Technology | ||
// | ||
// This program and the accompanying materials are made available under the | ||
// terms of the Eclipse Public License 2.0 which is available at | ||
// http://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0 | ||
// which is available at https://www.apache.org/licenses/LICENSE-2.0. | ||
// | ||
// SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 | ||
// | ||
// Contributors: | ||
// ZettaScale Zenoh Team, <zenoh@zettascale.tech> | ||
// | ||
|
||
use crate::{RuntimeId, SharedMemoryParameters}; | ||
use serde::{Deserialize, Serialize}; | ||
|
||
#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Eq, Hash)] | ||
pub struct RuntimeContext { | ||
pub id: RuntimeId, | ||
pub shared_memory: SharedMemoryParameters, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
// | ||
// Copyright (c) 2021 - 2023 ZettaScale Technology | ||
// | ||
// This program and the accompanying materials are made available under the | ||
// terms of the Eclipse Public License 2.0 which is available at | ||
// http://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0 | ||
// which is available at https://www.apache.org/licenses/LICENSE-2.0. | ||
// | ||
// SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 | ||
// | ||
// Contributors: | ||
// ZettaScale Zenoh Team, <zenoh@zettascale.tech> | ||
// | ||
|
||
use std::fmt::Display; | ||
|
||
use crate::deserialize::{deserialize_size, deserialize_time}; | ||
use serde::{Deserialize, Serialize}; | ||
|
||
#[derive(Serialize, Deserialize, Debug, Default, Clone, PartialEq, Eq, Hash)] | ||
pub struct SharedMemoryConfiguration { | ||
pub(crate) number_elements: Option<usize>, | ||
#[serde(deserialize_with = "deserialize_size")] | ||
pub(crate) element_size: Option<usize>, | ||
#[serde(deserialize_with = "deserialize_time")] | ||
pub(crate) backoff: Option<u64>, | ||
} | ||
|
||
// TODO@J-Loudet | ||
impl Display for SharedMemoryConfiguration { | ||
fn fmt(&self, _f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | ||
todo!() | ||
} | ||
} | ||
|
||
#[derive(Serialize, Deserialize, Debug, Default, Clone, PartialEq, Eq, Hash)] | ||
pub struct SharedMemoryParameters { | ||
pub number_elements: usize, | ||
// Size, in bytes, of a single element. | ||
pub element_size: usize, | ||
// Duration, in nanoseconds, to wait before retrying the last operation. | ||
pub backoff: u64, | ||
} | ||
|
||
// TODO@J-Loudet | ||
impl Display for SharedMemoryParameters { | ||
fn fmt(&self, _f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | ||
todo!() | ||
} | ||
} | ||
|
||
impl SharedMemoryParameters { | ||
pub fn from_configuration(configuration: &SharedMemoryConfiguration, default: &Self) -> Self { | ||
Self { | ||
number_elements: configuration | ||
.number_elements | ||
.unwrap_or(default.number_elements), | ||
element_size: configuration.element_size.unwrap_or(default.element_size), | ||
backoff: configuration.backoff.unwrap_or(default.backoff), | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.