Heka Sandbox Interface
1. Overview
This document describes the 1.0 release of the Heka sandbox API built on the Generic Sandbox Interface. The 1.0 release is a refined implementation of its predecessor which was developed in Heka. The goal is to decouple it from Go and make it easily embeddable in any language. The Go version of Heka has been deprecated and replaced by Hindsight.
2. Sandbox API Changes from the Go Heka Sandbox
There are a few intentional changes between tho original Heka sandbox and this version.
2.1. Changes
2.1.1. Input Sandbox
inject_message
accepts a numeric or string checkpoint as the second argumentprocess_message
receives the checkpoint value as the first argument (if it was provided byinject_message
).
2.1.2. Output Sandbox
process_message
receives a sequence_id as the first argument (if it was provided byupdate_checkpoint
). Extended return codes have been added to support skipping, retrying, batching, and asynchronous output.
2.1.3. Analysis/Output Sandbox
read_message
- returns
nil
for optional header fields if they don't exist instead of an empty string or zero - added a
framed
parameter to retrieve the raw message with stream framing - added a
size
parameter to retrieve size of the raw message without having to copy it down
- returns
timer_event
has a second parametershutdown
that is set to true when the sandbox is exiting.
2.2. Additions
2.2.1. Input Sandbox
- create_stream_reader function was added.
- is_running function was added.
2.2.2. Output Sandbox
- update_checkpoint was added for batch and asynchronous processing.
- create_message_matcher function was added.
2.3. Removals
- The
write_message
API was removed; messages are immutable and this API broke that rule. - The
read_next_field
API was removed; instead the raw message should be decoded and the Lua table iterated.
2.4. Notes
- The
read_config
API in unchanged but now has access to the entire sandbox configuration.