### Start Advanced Publisher Example Source: https://github.com/eclipse-zenoh/zenoh/blob/main/zenoh-ext/examples/examples/README.md Basic command to start the z_advanced_pub example. This example demonstrates advanced publishing with local caching. ```bash z_advanced_pub ``` -------------------------------- ### Start Group Management Example Source: https://github.com/eclipse-zenoh/zenoh/blob/main/zenoh-ext/examples/examples/README.md Basic command to start the z_member example. This example demonstrates joining a group and observing group events and views. ```bash z_member ``` -------------------------------- ### Start Group View Size Synchronization Example Source: https://github.com/eclipse-zenoh/zenoh/blob/main/zenoh-ext/examples/examples/README.md Basic command to start the z_view_size example. This example demonstrates joining a group and waiting for a specific number of members in the group view. ```bash z_view_size ``` -------------------------------- ### Start zenohd for Queryable Example Source: https://github.com/eclipse-zenoh/zenoh/blob/main/plugins/zenoh-plugin-rest/README.md Start the zenohd router to run the z_queryable example, making a topic available for queries. ```bash cargo run --example z_queryable -- -k foo/bar ``` -------------------------------- ### Start Advanced Subscriber Example Source: https://github.com/eclipse-zenoh/zenoh/blob/main/zenoh-ext/examples/examples/README.md Basic command to start the z_advanced_sub example. This example demonstrates advanced subscribing with history query and retransmission capabilities. ```bash z_advanced_sub ``` -------------------------------- ### Run z_pong example Source: https://github.com/eclipse-zenoh/zenoh/blob/main/examples/README.md Starts the pong application which waits for samples and replies. It needs to start first to avoid missing messages from z_ping. ```bash z_pong ``` -------------------------------- ### Run Zenoh Get Example Source: https://github.com/eclipse-zenoh/zenoh/blob/main/README.md Executes the zenoh get example using Cargo. This command is used to test or demonstrate performing a 'get' operation in Zenoh. ```bash cargo run --example z_get ``` -------------------------------- ### Run Zenoh Release Example Source: https://github.com/eclipse-zenoh/zenoh/blob/main/zenoh-ext/examples/examples/README.md Command to run a Zenoh example built in release mode. Use the -h flag for help. ```bash ./target/release/example/ ``` -------------------------------- ### Start Advanced Publisher with History Source: https://github.com/eclipse-zenoh/zenoh/blob/main/zenoh-ext/examples/examples/README.md Command to start the z_advanced_pub example with a specified history size. This configures the number of cached data samples per resource. ```bash z_advanced_pub --history 10 ``` -------------------------------- ### Run Zenoh Publisher Example Source: https://github.com/eclipse-zenoh/zenoh/blob/main/README.md Executes the zenoh publisher example using Cargo. This command is used to test or demonstrate the publisher functionality of Zenoh. ```bash cargo run --example z_pub ``` -------------------------------- ### Run Zenoh Subscriber Example Source: https://github.com/eclipse-zenoh/zenoh/blob/main/README.md Executes the zenoh subscriber example using Cargo. This command is used to test or demonstrate the subscriber functionality of Zenoh. ```bash cargo run --example z_sub ``` -------------------------------- ### Run TCP Performance Tests (Subscriber) Source: https://github.com/eclipse-zenoh/zenoh/wiki/Performance Execute the Zenoh subscriber example using TCP transport. This command starts a subscriber that listens for incoming connections. ```bash # run the subscriber $ cargo run --release --example zn_sub_thr ``` -------------------------------- ### Run Zenoh Example with Docker Source: https://github.com/eclipse-zenoh/zenoh/blob/main/zenoh-ext/examples/examples/README.md Command to run a Zenoh example when testing against a Zenoh router in Docker. Includes the necessary transport option for Docker environments. ```bash -e tcp/localhost:7447 ``` -------------------------------- ### Run Zenoh Queryable Example Source: https://github.com/eclipse-zenoh/zenoh/blob/main/README.md Executes the zenoh queryable example using Cargo. This command is used to test or demonstrate setting up a queryable endpoint in Zenoh. ```bash cargo run --example z_queryable ``` -------------------------------- ### Run z_sub_liveliness example Source: https://github.com/eclipse-zenoh/zenoh/blob/main/examples/README.md Subscribes to liveliness changes (tokens becoming alive or dropped) matching a key expression. Does not receive info about tokens alive before its start. ```bash z_sub_liveliness ``` ```bash z_sub_liveliness -k 'group1/**' ``` -------------------------------- ### Shared Memory Pub/Sub Example Source: https://github.com/eclipse-zenoh/zenoh/blob/main/examples/README.md Pub/sub example using Zenoh's shared-memory feature. Uses the standard z_sub for the subscriber. ```bash z_sub ``` ```bash z_pub_shm ``` -------------------------------- ### Retrieve Data using Zenoh Get Source: https://github.com/eclipse-zenoh/zenoh/blob/main/plugins/zenoh-plugin-storage-manager/README.md Query the stored data using the 'z_get' example with the corresponding key expression. ```bash cargo run --example z_get -- -s "demo/memory/test" ``` -------------------------------- ### Subscribe to a Zenoh Topic Source: https://github.com/eclipse-zenoh/zenoh/blob/main/plugins/zenoh-plugin-rest/README.md Example of a subscriber using the z_sub example to listen for messages on a specific topic. ```bash cargo run --example z_sub -- -k foo/bar ``` -------------------------------- ### Run z_get_liveliness example Source: https://github.com/eclipse-zenoh/zenoh/blob/main/examples/README.md Queries currently alive liveliness tokens matching a key expression. Tokens are typically declared by the z_liveliness example. ```bash z_get_liveliness ``` ```bash z_get_liveliness -k 'group1/**' ``` -------------------------------- ### Configure Storage Manager Plugin Source: https://github.com/eclipse-zenoh/zenoh/blob/main/plugins/zenoh-plugin-storage-manager/README.md Example configuration for the storage manager plugin in zenohd's config.json. It demonstrates setting up two storages: one using the 'memory' backend and another using a custom 'example' backend. ```json { "plugins": { "storage_manager": { "volumes": { "example": { "__path__": ["target/debug/libzenoh_backend_example.so","target/debug/libzenoh_backend_example.dylib"] } }, "storages": { "memory": { "volume": "memory", "key_expr": "demo/memory/**" }, "example": { "volume": "example", "key_expr": "demo/example/**" } } } } } ``` -------------------------------- ### Run Zenohd Router with Storage Manager Source: https://github.com/eclipse-zenoh/zenoh/blob/main/plugins/zenoh-plugin-storage-manager/README.md Start the zenohd router with the specified configuration and adminspace write permissions. RUST_LOG=info is crucial for plugin logging. ```bash RUST_LOG=info cargo run -- --config DEFAULT_CONFIG.json5 --adminspace-permissions rw ``` -------------------------------- ### Zenoh SHM Allocation Example Source: https://github.com/eclipse-zenoh/zenoh/blob/main/examples/README.md Shows how to allocate shared memory (SHM) buffers. ```bash z_alloc_shm ``` -------------------------------- ### Zenoh ZBytes Serialization Example Source: https://github.com/eclipse-zenoh/zenoh/blob/main/examples/README.md Demonstrates serializing various message types into ZBytes and deserializing them back. ```bash z_bytes ``` -------------------------------- ### Request Data with Zenoh Source: https://github.com/eclipse-zenoh/zenoh/blob/main/zenoh/README.md Example of requesting data for a specific key expression using the Zenoh Rust API. It involves opening a session and then using the `get` method to receive replies. ```rust use futures::prelude::*; #[tokio::main] async fn main() { let session = zenoh::open(zenoh::Config::default()).await.unwrap(); let replies = session.get("key/expression").await.unwrap(); while let Ok(reply) = replies.recv_async().await { println!(">> Received {:?}", reply.result()); } } ``` -------------------------------- ### Zenoh SHM Buffer Example Source: https://github.com/eclipse-zenoh/zenoh/blob/main/examples/README.md Illustrates working with SHM buffers, including mutable and constant access, and buffer ownership concepts. ```bash z_bytes_shm ``` -------------------------------- ### Start zenohd with REST Plugin Enabled Source: https://github.com/eclipse-zenoh/zenoh/blob/main/plugins/zenoh-plugin-rest/README.md Start the zenohd router with the REST plugin enabled by passing the --rest-http-port argument. This makes the REST API accessible on the specified port. ```bash cargo run -- --config DEFAULT_CONFIG.json5 --rest-http-port 8000 ``` -------------------------------- ### Run z_pub_shm_thr example Source: https://github.com/eclipse-zenoh/zenoh/blob/main/examples/README.md Publisher for throughput tests using shared memory. It performs put operations that are received by the z_sub_thr subscriber. ```bash z_pub_shm_thr ``` -------------------------------- ### Run TCP Performance Tests (Publisher) Source: https://github.com/eclipse-zenoh/zenoh/wiki/Performance Execute the Zenoh publisher example using TCP transport with a specified payload size. Replace with the desired byte count. ```bash # run the publisher with (1024 below) $ cargo run --release --example zn_pub_thr 1024 ``` -------------------------------- ### Run UDP Performance Tests (Publisher) Source: https://github.com/eclipse-zenoh/zenoh/wiki/Performance Run the Zenoh publisher example over UDP with a specified payload size, listening on an OS-assigned port. This configuration is useful for testing UDP throughput. ```bash # run the publisher with (1024 below) and listen on an OS-assigned UDP port $ cargo run --release --example zn_pub_thr 1024 -l udp/0.0.0.0:0 ``` -------------------------------- ### Run z_liveliness example Source: https://github.com/eclipse-zenoh/zenoh/blob/main/examples/README.md Declares a liveliness token on a given key expression. The token is visible to z_get_liveliness and z_sub_liveliness until dropped. ```bash z_liveliness ``` ```bash z_liveliness -k 'group1/member1' ``` -------------------------------- ### Queryable Responding to Query Source: https://github.com/eclipse-zenoh/zenoh/blob/main/plugins/zenoh-plugin-rest/README.md The output from the z_queryable example when it receives a query and prepares a response. ```bash >> [Queryable ] Received Query 'foo/bar' >> [Queryable ] Responding ('foo/bar': 'Queryable from Rust!') ``` -------------------------------- ### Run z_ping example Source: https://github.com/eclipse-zenoh/zenoh/blob/main/examples/README.md Performs a put operation and waits for a reply to measure roundtrip time. Accepts an optional argument for payload size. ```bash z_ping 1024 ``` -------------------------------- ### Build Zenoh Source: https://github.com/eclipse-zenoh/zenoh/blob/main/README.md Builds the Zenoh project with release optimizations and all targets. Ensure Rust and Cargo are installed and up-to-date. ```bash cargo build --release --all-targets ``` -------------------------------- ### Run z_sub_thr example Source: https://github.com/eclipse-zenoh/zenoh/blob/main/examples/README.md Subscriber for throughput tests involving shared memory. It receives notifications from a publisher performing put operations. ```bash z_sub_thr ``` -------------------------------- ### Run UDP Performance Tests (Subscriber) Source: https://github.com/eclipse-zenoh/zenoh/wiki/Performance Run the Zenoh subscriber example over UDP, listening on an OS-assigned port. This allows Zenoh to operate without a fixed port, suitable for dynamic environments. ```bash # run the subscriber and listen (i.e., accept connections) on an OS-assigned UDP port $ cargo run --release --example zn_sub_thr -- -l udp/0.0.0.0:0 ``` -------------------------------- ### Store Data using Zenoh Put Source: https://github.com/eclipse-zenoh/zenoh/blob/main/plugins/zenoh-plugin-storage-manager/README.md Use the 'z_put' example to store data with a specific key expression and payload. ```bash cargo run --example z_put -- -k demo/memory/test -p 'Hello from zenoh put' ``` -------------------------------- ### Delete Example Storage Source: https://github.com/eclipse-zenoh/zenoh/blob/main/plugins/zenoh-plugin-storage-manager/README.md Remove a specific storage configuration by sending a DELETE request to its corresponding path in the admin space. ```bash curl -X DELETE http://localhost:8080/@/local/router/config/plugins/storage_manager/storages/example ``` -------------------------------- ### Retrieve Data via REST GET Source: https://github.com/eclipse-zenoh/zenoh/blob/main/plugins/zenoh-plugin-storage-manager/README.md Use curl to send a GET request to retrieve data stored via the REST API. ```bash curl http://localhost:8080/demo/memory/test ``` -------------------------------- ### Query Data via REST GET Operation Source: https://github.com/eclipse-zenoh/zenoh/blob/main/plugins/zenoh-plugin-rest/README.md Use a curl command to send a GET request to the REST API to query data from the 'foo/bar' topic. ```bash curl http://localhost:8080/foo/bar ``` -------------------------------- ### Get Data with a Query Source: https://github.com/eclipse-zenoh/zenoh/blob/main/examples/README.md Sends a query message for a selector. Queryables with matching paths will reply. Can specify a selector. ```bash z_get ``` ```bash z_get -s 'demo/**' ``` -------------------------------- ### Get Zenoh Session Information Source: https://github.com/eclipse-zenoh/zenoh/blob/main/examples/README.md Retrieves information about the current Zenoh session. No arguments needed for typical usage. ```bash z_info ``` -------------------------------- ### Publish Data with Zenoh Source: https://github.com/eclipse-zenoh/zenoh/blob/main/zenoh/README.md Example of publishing a key-value pair using the Zenoh Rust API. Requires opening a Zenoh session and then calling the `put` method. ```rust #[tokio::main] async fn main() { let session = zenoh::open(zenoh::Config::default()).await.unwrap(); session.put("key/expression", "value").await.unwrap(); session.close().await.unwrap(); } ``` -------------------------------- ### Subscriber Receiving PUT Operation Source: https://github.com/eclipse-zenoh/zenoh/blob/main/plugins/zenoh-plugin-rest/README.md The output from the z_sub example when it receives a PUT operation via the REST API. ```bash >> [Subscriber] Received PUT ('foo/bar': '"Hello World!"') ``` -------------------------------- ### Enable Shared Memory Feature Source: https://github.com/eclipse-zenoh/zenoh/blob/main/README.md Example of how to enable the 'shared-memory' feature for the zenoh crate in Cargo.toml. This is necessary for using shared memory functionalities. ```toml zenoh = {version = "1.5.1", features = ["shared-memory"]} ``` -------------------------------- ### Subscribe to Data with Zenoh Source: https://github.com/eclipse-zenoh/zenoh/blob/main/zenoh/README.md Example of subscribing to data on a specific key expression using the Zenoh Rust API. It involves declaring a subscriber and then continuously receiving and printing samples. ```rust use futures::prelude::*; #[tokio::main] async fn main() { let session = zenoh::open(zenoh::Config::default()).await.unwrap(); let subscriber = session.declare_subscriber("key/expression").await.unwrap(); while let Ok(sample) = subscriber.recv_async().await { println!("Received: {:?}", sample); }; } ``` -------------------------------- ### Declare a Queryable Function Source: https://github.com/eclipse-zenoh/zenoh/blob/main/examples/README.md Declares a queryable function with a path. This function is triggered by get calls. Can specify key and value. ```bash z_queryable ``` ```bash z_queryable -k demo/example/queryable -v 'This is the result' ``` -------------------------------- ### Declare a Queryable with Zenoh Source: https://github.com/eclipse-zenoh/zenoh/blob/main/zenoh/README.md Example of declaring a queryable endpoint for a key expression using the Zenoh Rust API. This allows the node to receive and reply to queries. ```rust #[tokio::main] async fn main() { let session = zenoh::open(zenoh::Config::default()).await.unwrap(); let queryable = session.declare_queryable("key/expression").await.unwrap(); while let Ok(query) = queryable.recv_async().await { query.reply("key/expression", "value").await.unwrap(); } } ``` -------------------------------- ### Zenoh Plugin Trait Definition Source: https://github.com/eclipse-zenoh/zenoh/blob/main/plugins/README.md Defines the common plugin library API for implementing, loading, starting, and stopping plugins in Zenoh. ```rust pub trait ZenohPlugin: Plugin {} ``` -------------------------------- ### REST GET Response for Query Source: https://github.com/eclipse-zenoh/zenoh/blob/main/plugins/zenoh-plugin-rest/README.md The output received by curl when querying data via the REST API. It shows the key, encoded value, and encoding type. ```bash [{"key":"foo/bar","value":"UXVlcnlhYmxlIGZyb20gUnVzdCE=","encoding":"zenoh/bytes","timestamp":null}] ``` -------------------------------- ### Run Zenohd Router with Configuration Source: https://github.com/eclipse-zenoh/zenoh/blob/main/README.md Execute the Zenohd router using Cargo, passing a specific configuration file. Ensure you use '--' to separate Cargo arguments from zenohd arguments. ```bash cargo run -- --config DEFAULT_CONFIG.json5 ``` -------------------------------- ### Custom Zenoh Configurations for Listener and Connector Source: https://github.com/eclipse-zenoh/zenoh/blob/main/commons/zenoh-test/README.md Demonstrates customizing Zenoh configurations for both listener and connector sessions. This allows setting specific modes like Router or Client before opening sessions. ```rust let mut test_sessions = TestSessions::new(); let mut config = test_sessions.get_listener_config("tcp/127.0.0.1:0", 1); config.set_mode(Some(WhatAmI::Router)).unwrap(); let router = test_sessions.open_listener_with_cfg(config).await; let mut config = test_sessions.get_connector_config(); config.set_mode(Some(WhatAmI::Client)).unwrap(); let client = test_sessions.open_connector_with_cfg(config).await; test_sessions.close().await; ``` -------------------------------- ### Simple Peer-to-Peer Session Opening Source: https://github.com/eclipse-zenoh/zenoh/blob/main/commons/zenoh-test/README.md Opens a pair of peer sessions for basic peer-to-peer communication. Ensure to close the sessions using test_sessions.close() afterwards. ```rust let mut test_sessions = TestSessions::new(); let (peer01, peer02) = test_sessions.open_pairs().await; // … run assertions … test_sessions.close().await; ``` -------------------------------- ### Build Zenoh in Release Mode Source: https://github.com/eclipse-zenoh/zenoh/wiki/Performance Build Zenoh using cargo, ensuring to use the --release flag for performance testing. ```bash $ cargo build --release $ cargo build --release --examples ``` -------------------------------- ### Pre-allocating Free TCP Port (Not Recommended) Source: https://github.com/eclipse-zenoh/zenoh/blob/main/commons/zenoh-test/README.md Pre-allocates a free TCP port before creating a Zenoh session. This method is susceptible to TOCTOU race conditions and is generally not recommended. ```rust let locator = format!("tcp/127.0.0.1:{}", get_free_tcp_port()); let node = Node { listen: vec![locator.clone()], // … }; ``` -------------------------------- ### Advanced Zenoh Publisher Configuration Source: https://github.com/eclipse-zenoh/zenoh/blob/main/zenoh-ext/README.md Configures an advanced Zenoh publisher with caching and sample miss detection using zenoh_ext extensions. ```rust use zenoh_ext::{AdvancedPublisherBuilderExt, CacheConfig, MissDetectionConfig}; let session = zenoh::open(zenoh::Config::default()).await.unwrap(); let publisher = session .declare_publisher("key/expression") .cache(CacheConfig::default().max_samples(10)) .sample_miss_detection( MissDetectionConfig::default().heartbeat(std::time::Duration::from_secs(1)) ) .publisher_detection() .await .unwrap(); publisher.put("Value").await.unwrap(); ``` -------------------------------- ### View Current Storages Source: https://github.com/eclipse-zenoh/zenoh/blob/main/plugins/zenoh-plugin-storage-manager/README.md Use this command to list all currently active storages configured in the Zenoh system. It queries the admin space for storage information. ```bash curl -s 'http://localhost:8080/@/local/router/**/storages/*' | jq ``` -------------------------------- ### Zenoh Serialization and Deserialization Source: https://github.com/eclipse-zenoh/zenoh/blob/main/zenoh-ext/README.md Demonstrates how to serialize and deserialize data using the z_serialize and z_deserialize functions from the zenoh_ext crate. ```rust use zenoh_ext::*; let zbytes = z_serialize(&(42i32, vec![1u8, 2, 3])); assert_eq!(z_deserialize::<(i32, Vec)>(&zbytes).unwrap(), (42i32, vec![1u8, 2, 3])); ``` -------------------------------- ### Manual Topology with Dynamic Port Discovery Source: https://github.com/eclipse-zenoh/zenoh/blob/main/commons/zenoh-test/README.md Manually interconnects multiple listeners using free functions to discover assigned ports. This is useful for complex topologies where direct configuration is needed. ```rust use zenoh_test::{get_tcp_locator, get_locators_from_session}; let router = { let mut c = zenoh_config::Config::default(); c.listen.endpoints.set(vec!["tcp/127.0.0.1:0".parse().unwrap()]).unwrap(); c.scouting.multicast.set_enabled(Some(false)).unwrap(); let _ = c.set_mode(Some(WhatAmI::Router)); ztimeout!(zenoh::open(c)).unwrap() }; // Get the actual assigned endpoint let router_endpoint = get_tcp_locator(&router).await; // Use it to configure another session let mut c2 = zenoh_config::Config::default(); c2.connect.endpoints.set(vec![router_endpoint]).unwrap(); // … ``` -------------------------------- ### One Listener, Multiple Connectors Session Opening Source: https://github.com/eclipse-zenoh/zenoh/blob/main/commons/zenoh-test/README.md Opens one listener session and multiple connector sessions. Connectors automatically link to the most recently opened listener. Remember to close all sessions. ```rust let mut test_sessions = TestSessions::new(); let session1 = test_sessions.open_listener().await; let session2 = test_sessions.open_connector().await; let session3 = test_sessions.open_connector().await; test_sessions.close().await; ``` -------------------------------- ### Clone Zenoh Repository Source: https://github.com/eclipse-zenoh/zenoh/wiki/Performance Clone the Zenoh repository and checkout the rust-master branch to begin. ```bash $ git clone git@github.com:eclipse-zenoh/zenoh.git $ cd zenoh $ git checkout rust-master ``` -------------------------------- ### Configure Storage Manager Plugin Source: https://github.com/eclipse-zenoh/zenoh/blob/main/plugins/zenoh-plugin-storage-manager/README.md Uncomment the storage_manager section in DEFAULT_CONFIG.json5 to enable the plugin. Ensure timestamping is enabled or mode is set to 'router'. ```json "plugins|": { "rest": { "__config__": "./plugins/zenoh-plugin-rest/config.json5", }, "storage_manager": { "__config__": "./plugins/zenoh-plugin-storage-manager/config.json5", } }, ``` -------------------------------- ### Advanced Zenoh Subscriber Configuration Source: https://github.com/eclipse-zenoh/zenoh/blob/main/zenoh-ext/README.md Configures an advanced Zenoh subscriber with history and recovery mechanisms using zenoh_ext extensions, including a sample miss listener. ```rust use zenoh_ext::{AdvancedSubscriberBuilderExt, HistoryConfig, RecoveryConfig}; let session = zenoh::open(zenoh::Config::default()).await.unwrap(); let subscriber = session .declare_subscriber("key/expression") .history(HistoryConfig::default().detect_late_publishers()) .recovery(RecoveryConfig::default().heartbeat()) .subscriber_detection() .await .unwrap(); let miss_listener = subscriber.sample_miss_listener().await.unwrap(); loop { tokio::select! { sample = subscriber.recv_async() => { if let Ok(sample) = sample { // ... } }, miss = miss_listener.recv_async() => { if let Ok(miss) = miss { // ... } }, } } ``` -------------------------------- ### Publish Data Periodically Source: https://github.com/eclipse-zenoh/zenoh/blob/main/examples/README.md Declares a key and publisher, then periodically writes values. Data is received by matching subscribers. Can specify key and value. ```bash z_pub ``` ```bash z_pub -k demo/example/test -v 'Hello World' ``` -------------------------------- ### Generate HTML Coverage Report Source: https://github.com/eclipse-zenoh/zenoh/blob/main/commons/zenoh-codec/README.md Generates an HTML code coverage report focused on Zenoh source trees, hiding Rust standard library and registry dependencies. Requires LLVM tools from the nightly toolchain. ```sh LLVM_BIN="$(dirname "$(rustc +nightly --print target-libdir)")/bin" "$LLVM_BIN/llvm-cov" show \ target/x86_64-unknown-linux-gnu/coverage/x86_64-unknown-linux-gnu/release/transport_message \ -instr-profile=coverage/transport_message/coverage.profdata \ --format=html \ --output-dir=coverage/transport_message/html \ --ignore-filename-regex='^/rustc/|^.*/.cargo/registry' \ ../src \ ../../zenoh-protocol/src \ ../../zenoh-buffers/src ``` -------------------------------- ### Run Fuzz Targets Source: https://github.com/eclipse-zenoh/zenoh/blob/main/commons/zenoh-codec/README.md Executes the fuzzing targets for transport, network, and scouting messages using the nightly toolchain. Run from the commons/zenoh-codec/fuzz directory. ```sh cargo +nightly fuzz run transport_message ``` ```sh cargo +nightly fuzz run network_message ``` ```sh cargo +nightly fuzz run scouting_message ``` -------------------------------- ### Verify Fuzzing Corpus Source: https://github.com/eclipse-zenoh/zenoh/blob/main/commons/zenoh-codec/README.md Optionally verifies that the generated fuzzing corpus matches the current encoder. Run from the commons/zenoh-codec/fuzz directory. ```sh cargo run --bin verify_all_corpora ``` -------------------------------- ### Add Zenoh and Pinned Dependencies to Cargo.toml Source: https://github.com/eclipse-zenoh/zenoh/blob/main/commons/zenoh-pinned-deps-1-75/README.md Add these lines to your Cargo.toml file to ensure Rust 1.75 compatibility when using the zenoh crate. This approach avoids dependency conflicts by providing a separate crate with locked versions of zenoh's dependencies. ```toml zenoh = "1.5.1" zenoh-pinned-deps-1-75 = "1.5.1" ``` -------------------------------- ### Continuously Query Zenoh Source: https://github.com/eclipse-zenoh/zenoh/blob/main/examples/README.md Continuously sends query messages for a selector. Queryables with matching paths will reply. Can specify a selector. ```bash z_querier ``` ```bash z_querier -s 'demo/**' ``` -------------------------------- ### Run Fuzz Target Source: https://github.com/eclipse-zenoh/zenoh/blob/main/commons/zenoh-protocol/README.md Executes the fuzz target for the endpoint_from_str function using cargo-fuzz. ```sh # Run the fuzz target cargo +nightly fuzz run endpoint_from_str ``` -------------------------------- ### Add New Memory Storage Source: https://github.com/eclipse-zenoh/zenoh/blob/main/plugins/zenoh-plugin-storage-manager/README.md Dynamically add a new memory storage by sending a PUT request to the admin space. This configures a new storage with the specified key expression and volume. ```bash curl -X PUT -H 'content-type:application/json' \ -d '{"key_expr":"demo/sensors/**","volume":"memory"}' \ http://localhost:8080/@/local/router/config/plugins/storage_manager/storages/sensors ``` -------------------------------- ### Scout Zenoh Peers and Routers Source: https://github.com/eclipse-zenoh/zenoh/blob/main/examples/README.md Scouts for available Zenoh peers and routers on the network. No arguments needed for typical usage. ```bash z_scout ``` -------------------------------- ### Subscribe to Zenoh Data Source: https://github.com/eclipse-zenoh/zenoh/blob/main/examples/README.md Declares a key expression and a subscriber to receive notifications for puts and deletes. Can specify a key expression. ```bash z_sub ``` ```bash z_sub -k 'demo/**' ``` -------------------------------- ### Put Data into Zenoh Source: https://github.com/eclipse-zenoh/zenoh/blob/main/examples/README.md Puts a key/value pair into Zenoh. Data is received by matching subscribers. Can specify key and value. ```bash z_put ``` ```bash z_put -k demo/example/test -v 'Hello World' ``` -------------------------------- ### Pub/Sub Throughput Test Source: https://github.com/eclipse-zenoh/zenoh/blob/main/examples/README.md Performs throughput measurements between a publisher and subscriber. Subscriber uses z_sub_thr, publisher uses z_pub_thr with a size argument. ```bash z_sub_thr ``` ```bash z_pub_thr 1024 ``` -------------------------------- ### Generate Fuzzing Corpora Source: https://github.com/eclipse-zenoh/zenoh/blob/main/commons/zenoh-codec/README.md Generates the deterministic seed corpus for fuzzing targets. Run from the commons/zenoh-codec/fuzz directory. ```sh cargo run --bin gen_all_corpora ``` -------------------------------- ### Generate Text Coverage Report Source: https://github.com/eclipse-zenoh/zenoh/blob/main/commons/zenoh-codec/README.md Generates a text-based code coverage report, hiding Rust standard library and registry dependencies. Requires LLVM tools from the nightly toolchain. ```sh LLVM_BIN="$(dirname "$(rustc +nightly --print target-libdir)")/bin" "$LLVM_BIN/llvm-cov" report \ target/x86_64-unknown-linux-gnu/coverage/x86_64-unknown-linux-gnu/release/transport_message \ -instr-profile=coverage/transport_message/coverage.profdata \ --ignore-filename-regex='^/rustc/|^.*/.cargo/registry' ``` -------------------------------- ### In-Memory Zenoh Storage Source: https://github.com/eclipse-zenoh/zenoh/blob/main/examples/README.md Implements in-memory storage by declaring a subscriber and queryable on the same selector. Stores received data and answers queries. ```bash z_storage ``` ```bash z_storage -k 'demo/**' ``` -------------------------------- ### Analyze Specific Fuzz Input Source: https://github.com/eclipse-zenoh/zenoh/blob/main/commons/zenoh-codec/README.md Analyzes a specific input for a fuzz target without running the full fuzz loop, useful for understanding input behavior. Run from the commons/zenoh-codec/fuzz directory. ```sh cargo run --bin analyze_transport_message -- "[2, 220, 11, 13, 0]" ``` ```sh cargo run --bin analyze_network_message -- "[29, 0, 1, 2]" ``` ```sh cargo run --bin analyze_scouting_message -- "[1, 1, 10]" ``` -------------------------------- ### Verify Fuzzing Corpus Source: https://github.com/eclipse-zenoh/zenoh/blob/main/commons/zenoh-protocol/README.md Optionally verifies that the generated fuzzing corpus matches the current parser behavior. ```sh # Optional: verify the generated corpus matches the current parser behavior cargo run --bin verify_endpoint_corpus ``` -------------------------------- ### Pull Data from Zenoh Source: https://github.com/eclipse-zenoh/zenoh/blob/main/examples/README.md Declares a key expression and a pull subscriber to receive the last N puts or deletes. Can specify key expression and size. ```bash z_pull ``` ```bash z_pull -k demo/** --size 3 ``` -------------------------------- ### Configure REST Plugin HTTP Port Source: https://github.com/eclipse-zenoh/zenoh/blob/main/plugins/zenoh-plugin-rest/README.md Configure the HTTP port for the REST plugin within the zenohd configuration file. This allows customization of the API endpoint. ```json { "plugins": { "rest": { "http_port": 8000, } } } ``` -------------------------------- ### Publish Data via REST PUT Operation Source: https://github.com/eclipse-zenoh/zenoh/blob/main/plugins/zenoh-plugin-rest/README.md Use a curl command to send a PUT request to the REST API, publishing data to the 'foo/bar' topic. The subscriber will receive this message. ```bash curl -X PUT -d '"Hello World!"' http://localhost:8080/foo/bar ``` -------------------------------- ### Analyze Fuzz Input Source: https://github.com/eclipse-zenoh/zenoh/blob/main/commons/zenoh-protocol/README.md Analyzes a specific input string without running the full fuzz loop, useful for debugging. ```sh # Analyze one input without running the fuzz loop cargo run --bin analyze_endpoint_from_str -- "tcp/127.0.0.1:7447?b=2;a=1#B=2;A=1" ``` -------------------------------- ### Collect Fuzz Target Coverage Source: https://github.com/eclipse-zenoh/zenoh/blob/main/commons/zenoh-codec/README.md Collects code coverage data from the fuzzing corpus for a specific target. Use '-s none' to disable sanitizers during collection. Run from the commons/zenoh-codec/fuzz directory. ```sh cargo +nightly fuzz coverage -s none transport_message corpus/transport_message ``` -------------------------------- ### Generate Fuzzing Seed Corpus Source: https://github.com/eclipse-zenoh/zenoh/blob/main/commons/zenoh-protocol/README.md Generates the deterministic seed corpus for fuzzing the endpoint_from_str function. ```sh # Generate the deterministic seed corpus cargo run --bin gen_endpoint_corpus ``` -------------------------------- ### Rerun Specific Fuzz Input Source: https://github.com/eclipse-zenoh/zenoh/blob/main/commons/zenoh-codec/README.md Reruns a specific fuzz target with a given input artifact, useful for debugging crashes. Run from the commons/zenoh-codec/fuzz directory. ```sh cargo +nightly fuzz run transport_message artifacts/transport_message/crash-xxxx ``` ```sh cargo +nightly fuzz run network_message artifacts/network_message/crash-xxxx ``` ```sh cargo +nightly fuzz run scouting_message artifacts/scouting_message/crash-xxxx ``` -------------------------------- ### Store Data via REST PUT Source: https://github.com/eclipse-zenoh/zenoh/blob/main/plugins/zenoh-plugin-storage-manager/README.md Use curl to send a PUT request to store data via the REST API. Specify Content-Type and use a JSON encoded string for the value. ```bash curl -X PUT -d '"Hello from REST"' -H "Content-Type: application/json" http://localhost:8080/demo/memory/test ``` -------------------------------- ### Adjust UDP Buffer Size on Linux Source: https://github.com/eclipse-zenoh/zenoh/wiki/Performance Increase the maximum and default UDP receive buffer sizes on Linux systems to improve performance in high-throughput scenarios. This is recommended when using UDP as a transport protocol. ```bash $ sysctl -w net.core.rmem_max=4194304 $ sysctl -w net.core.rmem_default=4194304 ``` -------------------------------- ### Rerun Specific Fuzz Input Source: https://github.com/eclipse-zenoh/zenoh/blob/main/commons/zenoh-protocol/README.md Allows rerunning a specific input that caused a crash or issue during fuzzing. ```sh # Only rerun a certain input cargo +nightly fuzz run endpoint_from_str artifacts/endpoint_from_str/crash-xxxx ``` -------------------------------- ### Delete Data via REST DELETE Source: https://github.com/eclipse-zenoh/zenoh/blob/main/plugins/zenoh-plugin-storage-manager/README.md Use curl to send a DELETE request to remove data associated with a specific key via the REST API. ```bash curl -X DELETE http://localhost:8080/demo/memory/test ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.