Add "LeafMeta" struct to leaf

This commit is contained in:
Michael Mikovsky
2026-05-31 10:26:57 -06:00
parent 0a44bc93de
commit f595b5aa98
11 changed files with 1576 additions and 374 deletions
+33
View File
@@ -5,6 +5,9 @@ use crossbeam_channel::{Receiver, Sender};
use crate::protocol::{Endpoint, Leaf, Packet};
#[cfg(feature = "interface")]
use crate::protocol::LeafMeta;
use super::{
codec::{decode_block_chunk, decode_child_summary, decode_u32},
constants::{
@@ -96,6 +99,16 @@ impl Leaf for MockConnectionLeaf {
LEAF_MOCK_CONNECTION
}
#[cfg(feature = "interface")]
fn get_meta(&self) -> LeafMeta {
LeafMeta {
name: "Merke Connection Leaf",
identifier: "dev.unshell.test.merkle.connection",
version: "v0",
authors: vec!["ASTATIN3"],
}
}
fn update(&mut self, endpoint: &mut Endpoint) {
if !self.started {
endpoint
@@ -126,6 +139,16 @@ impl Leaf for MerkleCallerLeaf {
LEAF_MERKLE_CALLER
}
#[cfg(feature = "interface")]
fn get_meta(&self) -> LeafMeta {
LeafMeta {
name: "Merke Caller Leaf",
identifier: "dev.unshell.test.merkle.caller",
version: "v0",
authors: vec!["ASTATIN3"],
}
}
fn update(&mut self, endpoint: &mut Endpoint) {
self.receive_responses(endpoint);
self.dispatch_next_request(endpoint);
@@ -137,6 +160,16 @@ impl Leaf for MerkleRespondentLeaf {
LEAF_MERKLE_RESPONDENT
}
#[cfg(feature = "interface")]
fn get_meta(&self) -> LeafMeta {
LeafMeta {
name: "Merke Respondent Leaf",
identifier: "dev.unshell.test.merkle.respondent",
version: "v0",
authors: vec!["ASTATIN3"],
}
}
fn update(&mut self, endpoint: &mut Endpoint) {
self.open_stream_from_request(endpoint);
self.send_one_response_frame(endpoint);
+23
View File
@@ -1,5 +1,8 @@
use crate::protocol::{Endpoint, Leaf, Packet};
#[cfg(feature = "interface")]
use crate::protocol::LeafMeta;
use alloc::{boxed::Box, format, vec, vec::Vec};
use super::support::{CommsLeaf, ENDPOINT_A, ENDPOINT_B, assert_hook_present, assert_hook_removed};
@@ -82,6 +85,16 @@ impl Leaf for StreamCallerLeaf {
LEAF_STREAM_CALLER
}
#[cfg(feature = "interface")]
fn get_meta(&self) -> LeafMeta {
LeafMeta {
name: "Stream Caller Leaf",
identifier: "dev.unshell.test.stream_caller_leaf",
version: "v0",
authors: vec!["ASTATIN3"],
}
}
fn update(&mut self, endpoint: &mut Endpoint) {
if self.has_run {
return;
@@ -98,6 +111,16 @@ impl Leaf for StreamRespondentLeaf {
LEAF_STREAM_RESPONDENT
}
#[cfg(feature = "interface")]
fn get_meta(&self) -> LeafMeta {
LeafMeta {
name: "Stream Respondant Leaf",
identifier: "dev.unshell.test.stream_respondent_leaf",
version: "v0",
authors: vec!["ASTATIN3"],
}
}
fn update(&mut self, endpoint: &mut Endpoint) {
self.open_stream_from_pending_request(endpoint);
self.send_next_frame(endpoint);
+33
View File
@@ -1,5 +1,8 @@
use crate::protocol::{Endpoint, Leaf, Packet};
#[cfg(feature = "interface")]
use crate::protocol::LeafMeta;
use alloc::{vec, vec::Vec};
use crossbeam_channel::{Receiver, Sender};
@@ -112,6 +115,16 @@ impl Leaf for ControllerLeaf {
LEAF_CONTROLLER
}
#[cfg(feature = "interface")]
fn get_meta(&self) -> LeafMeta {
LeafMeta {
name: "Controller Leaf",
identifier: "dev.unshell.test.controller_leaf",
version: "v0",
authors: vec!["ASTATIN3"],
}
}
fn update(&mut self, endpoint: &mut Endpoint) {
if !self.has_run {
// The controller starts exactly one request so the end-to-end test can
@@ -129,6 +142,16 @@ impl Leaf for CommsLeaf {
LEAF_COMMS
}
#[cfg(feature = "interface")]
fn get_meta(&self) -> LeafMeta {
LeafMeta {
name: "Comms Leaf",
identifier: "dev.unshell.test.comms_leaf",
version: "v0",
authors: vec!["ASTATIN3"],
}
}
fn update(&mut self, endpoint: &mut Endpoint) {
if !self.started {
endpoint
@@ -160,6 +183,16 @@ impl Leaf for ResponderLeaf {
LEAF_RESPONDER
}
#[cfg(feature = "interface")]
fn get_meta(&self) -> LeafMeta {
LeafMeta {
name: "Responder Leaf",
identifier: "dev.unshell.test.responder_leaf",
version: "v0",
authors: vec!["ASTATIN3"],
}
}
fn update(&mut self, endpoint: &mut Endpoint) {
let local_id = endpoint.path.last().cloned().unwrap_or(0);
let mut packets = Vec::new();