Skip to content

Update build for cross-platform builds and add github workflow. Close #2#3

Merged
JEnoch merged 4 commits into
eclipse-zenoh:masterfrom
atolab:master
Apr 9, 2020
Merged

Update build for cross-platform builds and add github workflow. Close #2#3
JEnoch merged 4 commits into
eclipse-zenoh:masterfrom
atolab:master

Conversation

@JEnoch

@JEnoch JEnoch commented Apr 9, 2020

Copy link
Copy Markdown
Member

No description provided.

JEnoch added 4 commits April 9, 2020 15:14
Signed-off-by: Julien Enoch <julien.enoch@adlinktech.com>
Signed-off-by: Julien Enoch <julien.enoch@adlinktech.com>
…nly. Ref: eclipse-zenoh#2

Signed-off-by: Julien Enoch <julien.enoch@adlinktech.com>
@JEnoch
JEnoch merged commit 5f8d6e0 into eclipse-zenoh:master Apr 9, 2020
milyin added a commit that referenced this pull request Jul 16, 2026
zenoh-flat-jni is the shared tier reused by both zenoh-java and zenoh-kotlin,
so the pure-JVM conversion logic moves there (EncodingCodec, ZenohId.zidString
— next to the generated constants they are built from). io.zenoh.bytes.Encoding
shrinks to a thin facade: the established constants and API delegating to the
shared codec, zero logic.

Drop PinnedEncoding and the selector-tuple wire helper: with the publisher's
default encoding set natively at declare time, the hot publish loop crosses no
encoding data at all, and per-call overrides crossing (id, schema) cost only a
short string decode — not worth a resource class in the public API. Encoding
params revert to the plain (present, id, schema) crossing.

jvmTest: 106 tests, 0 failures (correspondence suites now exercise the shared
codec; PublisherEncodingTest verifies the native declare-time default +
per-put override end-to-end). CI pins: zenoh-flat-jni 9bc155b, zenoh-flat
main (6d22091, #3 merged).
milyin added a commit that referenced this pull request Jul 16, 2026
…put override (#484)

* Make Encoding and ZenohId.toString pure JVM values

An encoding IS its (id, schema) pair — Zenoh's own representation; the
textual form is derived from a fixed table. With the id<->name table already
JVM-side (the generated ENCODING_* constants) and the companion
zenoh-flat-jni change crossing Encoding by value in both directions, the SDK
Encoding becomes a plain immutable value: no native handle, no native calls,
no lazy caches, no locking, nothing to close. This also removes a native
memory leak: received Sample/Query/ReplyError previously retained a cloned
Encoding handle with no close path.

- Encoding.kt: immutable (id, schema); from()/toString()/withSchema()
  implement Zenoh's exact conversion rules (incl. the custom-encoding
  name-preserving withSchema and the render-only CUSTOM<->"" table row);
  equality on (id, schema), matching Zenoh core.
- ZenohId.toString: the little-endian lowercase-hex rule in pure Kotlin.
- Callback/fromParts leaves follow the new (encId, encSchema) decomposition;
  outbound sites pass .id/.schema directly.
- Correspondence tests (EncodingCorrespondenceTest, ZenohIdCorrespondenceTest)
  verify the pure implementations against the native ones across the whole
  predefined id range, parse/render edge shapes, and random ids — the
  contract for any JVM-side reimplementation of zenoh-flat API. One test
  caught and fixed a real divergence (custom-encoding withSchema).

Pairs with ZettaScaleLabs/zenoh-flat-jni#4 (CI pin bumped). jvmTest: 105
tests, 0 failures.

* Publisher default encoding at declare + PinnedEncoding per-put override

Two encoding fast paths over the dual-arm expansion (prebindgen#80,
zenoh-flat#3, zenoh-flat-jni#4):

- The publisher's default encoding is set NATIVELY once at declare time
  (PublisherOptions.encoding -> declarePublisher's encoding arm); plain
  put(payload) passes absent (sel -1), so no encoding data crosses per call.
  Previously the JVM tier re-sent (id, schema) on every put.
- PinnedEncoding (Encoding.pinned()) preallocates the native form; passing it
  in PutOptions/ReplyOptions/GetOptions crosses only a borrowed handle (native
  clone = Arc bump) — no schema-string traffic in hot publish loops. close()
  releases the handle (falls back to the plain (id, schema) arm); a finalizer
  backstops leaks. A PinnedEncoding equals its plain counterpart.
- All outbound sites route through one Encoding?.forWire() helper emitting the
  selector tuple (-1 absent / 0 value / 1 pinned handle).

Tests: PinnedEncodingTest (publisher-default applies natively end-to-end;
pinned override reused across puts; post-close fallback), correspondence
tests updated to the dual-arm newWithSchema. jvmTest: 107 tests, 0 failures.
CI pins: zenoh-flat-jni cbbca40, zenoh-flat d792547.

* Move encoding/zid logic to the shared bindings tier; drop pinning

zenoh-flat-jni is the shared tier reused by both zenoh-java and zenoh-kotlin,
so the pure-JVM conversion logic moves there (EncodingCodec, ZenohId.zidString
— next to the generated constants they are built from). io.zenoh.bytes.Encoding
shrinks to a thin facade: the established constants and API delegating to the
shared codec, zero logic.

Drop PinnedEncoding and the selector-tuple wire helper: with the publisher's
default encoding set natively at declare time, the hot publish loop crosses no
encoding data at all, and per-call overrides crossing (id, schema) cost only a
short string decode — not worth a resource class in the public API. Encoding
params revert to the plain (present, id, schema) crossing.

jvmTest: 106 tests, 0 failures (correspondence suites now exercise the shared
codec; PublisherEncodingTest verifies the native declare-time default +
per-put override end-to-end). CI pins: zenoh-flat-jni 9bc155b, zenoh-flat
main (6d22091, #3 merged).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant