Expand description
Wire codec and sink trait sub-modules. Consumers implementing a
custom Sink or reading/writing envelopes on the wire previously
had to depend on obs-core directly; obs-kit re-exports these so
obs-kit = "0.2" is the only runtime dep needed. Spec § 5.1.
Sinks consume ScrubbedEnvelope and ship it to a destination
(stdout, NDJSON file, OTLP, ClickHouse, etc.).
Phase-3 surface (impl-plan tasks 3.7 / 3.12 + 3.1 worker pool):
Sinktrait +flush/shutdownlifecycle.NoopSink,InMemorySink(test harness).StdoutSinkwith all fourFormatterStyles.NdjsonFileSinkoverRollingFileWriter.MakeWriterfamily:StdoutWriter,StderrWriter,LevelSplitWriter,TeeWriter,RollingFileWriter,NonBlockingWriter.
Modules§
- fanout
FanOutSink— deliver one envelope to N child sinks.
Structs§
- Erased
Writer - Erased
Box<dyn Write + Send>soLevelSplitWriter::Writercan be a single concrete type (the trait associated type is fixed, can’t bematch-ed at the type level). - FanOut
Sink - Multiplex a single tier’s output across N sinks.
- InMemory
Handle - Stable handle to an
InMemorySink. Clone-safe; share across threads. - InMemory
Sink - Test sink: collects envelopes into a bounded ring buffer.
- Level
Split Writer - Composes two writers — INFO+ goes through
low, WARN+ throughhigh. The conventional shape for cargo binaries. - Ndjson
File Sink - File sink that writes envelopes as JSON lines to the underlying
MakeWriter. Buffers aMutex<ErasedWriter>per batch to avoid re-opening files for every event. - NonBlocking
Handle - Per-batch handle. Buffers bytes, flushes to the bg sender on
flush()/Drop. - NonBlocking
Writer - Wraps a
MakeWriterwith a background thread + boundedmpsc::SyncSenderchannel. Overflow drops the line and increments the dropped counter. Spec 20 § 3.5. - Noop
Sink - A sink that drops every envelope.
- Rolling
File Handle - Handle returned per-batch by
RollingFileWriter. Eachwrite_allrotates if the policy demands it. - Rolling
File Writer - Rolling file writer with size + time policies. Spec 20 § 3.4.
- Rolling
File Writer Builder - Builder for
RollingFileWriter. - Stderr
Writer - Writes to stderr.
- Stdout
Sink - Stdout / writer-backed sink.
- Stdout
Writer - Writes to stdout.
- TeeWriter
- Tee writer — writes to both branches.
- Worker
Guard - Returned alongside
NonBlockingWriter; flushes + joins the bg thread on drop.
Enums§
- Formatter
Style - Output style for
StdoutSink. See spec 20 § 3.6. - Rolling
Policy - Rolling policy. Spec 20 § 3.4.
Traits§
- Make
Writer - A factory that yields one
io::Writeper batch. Cheap to call. Spec 20 § 3.3. - Sink
- A delivery destination. Called from per-tier worker tasks, never on the emit thread.
Type Aliases§
- SinkFut
- Pinned future returned by
Sink::flush/Sink::shutdown. Spec 11 § 4.