Skip to main content

Crate dre_protocol

Crate dre_protocol 

Source
Expand description

The DRE plugin protocol, version 0.

Plugins ship in packages: one executable, dre-plugin-<package>, serving every plugin the package provides (a single plugin may also be named dre-<kind>-<name>). It talks to DRE core over stdin/stdout in length-prefixed frames. Each frame is a JSON control message or an Arrow IPC stream; stderr is the plugin’s log channel. See docs/protocol.md in the repository for the public contract.

  • frame: the wire format.
  • msg: every control message.
  • host: the core side: spawning a plugin, the handshake, requests.
  • plugin: the SDK plugin authors use to serve requests.
  • options: the options a plugin declares, and how they’re checked.
  • conformance: checks any plugin binary against the protocol.
  • sessions: OAuth sessions plugins keep in ~/.dre/oauth_sessions.json.

Modules§

conformance
The protocol conformance suite. Every first-party plugin runs it in its tests; third-party plugin authors can run it too. It only checks protocol behaviour common to every plugin kind; each plugin’s own tests cover what it does with real data. A package executable (dre-plugin-<package>) is checked once per plugin it provides.
frame
Frames: a 4-byte big-endian length, then that many bytes. The first body byte is the frame type: J (0x4A) for a UTF-8 JSON control message, A (0x41) for an Arrow IPC stream holding a schema and zero or more record batches.
host
Core’s side of the protocol: spawn a plugin, negotiate a version, send requests.
msg
Control messages. Every JSON frame is an object with a type field.
options
Plugin options: the keys a report’s config block for a plugin may hold (a format’s output: keys, a destination entry’s keys), declared once by the plugin and checked by the SDK.
plugin
The plugin SDK: implement one of Source, Format or Destination and call the matching serve_* function from main. The SDK owns stdin/stdout, the handshake, framing, error replies and panics; plugins log with eprintln!.
sessions
~/.dre/oauth_sessions.json: OAuth sessions plugins keep between runs.
util
Small helpers shared by core and first-party plugins, so each rule has one implementation.

Structs§

PluginId
One plugin: its kind and name. Written <kind>/<name> (destination/s3), in messages as well as in dre.lock.

Enums§

Kind

Constants§

CAP_CHECK
Capability: can verify a statement without executing it.
CAP_LOAD
Source: loads rows into a temporary table on the session (load), for large lookups.
CAP_MULTI_FILE
Capability (destinations): takes every file of one output in a single deliver.
CAP_READ_ONLY
Capability: can open a connection read-only.
CAP_SESSIONS
Capability: can hold one session (and its temp objects) across requests.
CAP_VALIDATE
Answers validate (checks a config block of options). The Rust SDK always advertises it.
CRATE_VERSION
This crate’s version (its own, not DRE’s); the fixture plugins report it.
MAX_VERSION
MIN_VERSION
Protocol versions this build speaks.

Functions§

executable_name
The executable file name for a single plugin on this platform.
package_executable_name
The executable file name for a package on this platform: dre-plugin-<package>.
parse_executable_name
Parse dre-<kind>-<name>[.exe] into its kind and name. Names are [a-z0-9_]+.
parse_package_executable_name
Parse dre-plugin-<package>[.exe] into the package name.
valid_name
Whether name is a valid plugin or package name: [a-z0-9_]+.