forked from snxraven/peardock
Ship remaining roadmap items: encrypted registry vault, peer invite/revoke, Swarm/plugins behind flags, binary streams, engine create validation, deploy rollback, schema validation, fleet/access UI, metrics, fuzz/load/soak tests, systemd packaging, and release tooling. Mark ROADMAP fully complete.
43 lines
1.2 KiB
JavaScript
43 lines
1.2 KiB
JavaScript
/**
|
|
* Value encodings for protomux-rpc.
|
|
*
|
|
* Default: compact-encoding JSON (stable, human-debuggable).
|
|
* Binary path: chunked base64 via push:binaryChunk / binaryStream* methods.
|
|
*
|
|
* Hyperschema migration path:
|
|
* - SCHEMA_VERSION negotiated in handshake (shared/schema.js)
|
|
* - MethodSchemas document field shapes
|
|
* - Future: swap valueEncoding per-method to hyperschema structs while
|
|
* keeping method names stable (PROTOCOL_VERSION bump when required)
|
|
*/
|
|
import c from 'compact-encoding'
|
|
import { SCHEMA_VERSION } from './schema.js'
|
|
|
|
/** Default encoding for all peardock RPC methods and pushes. */
|
|
export const json = c.json
|
|
|
|
/** Raw buffer passthrough when needed (future hyperschema binary). */
|
|
export const raw = c.raw
|
|
|
|
/** Empty / none encoding. */
|
|
export const none = c.none
|
|
|
|
export const encodings = {
|
|
valueEncoding: json,
|
|
requestEncoding: json,
|
|
responseEncoding: json,
|
|
}
|
|
|
|
/**
|
|
* Encoding profile advertised to clients.
|
|
* When hyperschema lands, profile becomes 'hyperschema' without changing method names.
|
|
*/
|
|
export const ENCODING_PROFILE = {
|
|
name: 'json+chunked-binary',
|
|
schemaVersion: SCHEMA_VERSION,
|
|
binary: 'push:binaryChunk + binaryStreamOpen/Chunk/Close',
|
|
future: 'hyperschema per-method valueEncoding',
|
|
}
|
|
|
|
export { SCHEMA_VERSION }
|