OLLMrpc.Bin


Description:

Binary wire serialization for RPC payloads.

The OLLMrpc.Bin namespace encodes and decodes Serializable GObjects on a per-connection Stream. Type aliases are process-wide ( register); property keys are JIT tokens on each Stream. Json converts between JSON trees and bin bytes for tests and HTTP tooling. Wire layout is documented in docs/bin-rpc-protocol.md.

Architecture Benefits

  • GObject-native: properties map to wire fields without hand schemas
  • Compact wire: short integers, JIT key tokens, typed object headers
  • Dual use: daemon sockets and JSON bridges share one codec
  • Extensible: override prop read/write for lists and custom shapes

Usage Examples

Register and round-trip

OLLMrpc.Bin.register("Pair", typeof(Pair));

var mem = new GLib.MemoryOutputStream.resizable();
var out_stream = new GLib.DataOutputStream(mem);
var write_bin = new OLLMrpc.Bin.Stream(null, out_stream);
write_bin.write(new Pair() { name = "alpha", count = 42 });
out_stream.close();

var read_bin = new OLLMrpc.Bin.Stream(
new GLib.DataInputStream(
new GLib.MemoryInputStream.from_bytes(mem.steal_as_bytes())),
null);
var parsed = read_bin.parse() as Pair;

JSON bridge

var json = new OLLMrpc.Bin.Json();
var node = json.from_gobject(pair);

Best Practices

  1. Register every alias before connect/listen (both peers)

    2. One Stream per connection for the channel lifetime

    3. Implement Serializable; override only non-scalar props

    4. Prefer Json.from_gobject over hand-rolled memory pipes

Content:

Interfaces:

Classes:

Enums:

Error domains:

Functions:

Fields: