The Eclipse Zenoh: Zero Overhead Pub/sub, Store/Query and Compute.
Zenoh (pronounce /zeno/) unifies data in motion, data at rest and computations. It carefully blends traditional pub/sub with geo-distributed storages, queries and computations, while retaining a level of time and space efficiency that is well beyond any of the mainstream stacks.
Check the website zenoh.io and the roadmap for more detailed information.
This repository contains the Go bindings for Zenoh.
Before building and running the examples, you need to have the following dependencies installed:
- Zenoh-C: The C implementation of the Zenoh protocol.
Zenoh-C is included as a git submodule. It must be built and installed before building the Go examples, with unstable API support enabled (-DZENOHC_BUILD_WITH_UNSTABLE_API=ON).
You can also follow the upstream instructions in the Zenoh-C repository.
This project includes several examples located in the examples directory. Each example is in a subdirectory prefixed with z_. You can build all the examples using the provided Makefile.
The Go bindings use CGo and need the installed Zenoh-C headers and libraries on the include/link path. Run the commands below in order from the repository root.
# 1. Initialize and update the zenoh-c submodule
git submodule init
git submodule update
# 2. Configure and build zenoh-c; install into ./build/ (gitignored)
mkdir -p build && cd build
cmake ../zenoh-c \
-DZENOHC_BUILD_WITH_UNSTABLE_API=ON \
-DCMAKE_INSTALL_PREFIX="$PWD"
cmake --build . --target install --config Release
cd ..
# 3. Point CGo at the installed zenoh-c, then build all examples
export CGO_CFLAGS="-I$(pwd)/build/include"
export CGO_LDFLAGS="-L$(pwd)/build/lib"
export LD_LIBRARY_PATH="$(pwd)/build/lib"
make allZenoh-C is installed under build/ (build/include, build/lib).
To build a specific example, use the example's name. For instance, to build the z_pub example:
make z_pubAfter building the examples, you can run them from the bin directory.
Description of each example can be found here.
To run a specific example, navigate to the bin directory and execute the binary. For example, to run the z_pub example:
./bin/z_pubYou can also run the examples directly using go run without building the binaries. For example, to run the z_sub example:
go run examples/z_pub/z_pub.goexamples/: This directory contains all the example subdirectories. Each example has its own subdirectory prefixed withz_.bin/: This directory will contain the compiled binaries for the examples.build/: Local install prefix for zenoh-c (headers and libraries) after building the submodule.
The provided Makefile includes the following targets:
all: Builds all the examples.fmt: Formats the source code usinggo fmt.clean: Cleans up all generated binaries.
- Build all binaries:
make all - Build specific binary:
make <example_name> - Format the source code:
make fmt - Clean up binaries:
make clean
