You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* refactor(object_store): PayloadView end-to-end; cross-store flushTo; atomic target swap
A consolidated refactor of the ObjectStore / DataEngine surface that
makes PayloadView the universal vocabulary for ownership of bytes
across the SDK, adds zero-copy cross-instance transfer of entries
between stores, and exposes an atomic target-swap primitive on the
plugin data host used to redirect writes between two stores at runtime.
ObjectStore + ObjectEntry
- ObjectEntry::payload is std::any holding either
std::shared_ptr<const std::vector<uint8_t>> (eager owned bytes,
counted against the retention budget) or
std::function<sdk::PayloadView()> (lazy resolver returning Span +
BufferAnchor; not counted, bytes owned upstream).
resolveEntry dispatches via std::any_cast; each branch handles its
own concrete type. No static_pointer_cast on the lazy anchor — its
type erasure (BufferAnchor = shared_ptr<const void>) is preserved
end-to-end so producers can anchor on any shared_ptr<T>.
- ResolvedObjectEntry consolidates on PayloadView (Span + anchor).
Removes the previous shared_ptr<const vector<uint8_t>> field,
which locked consumers to a concrete anchor type and required a
hidden static_pointer_cast in resolveEntry that would fail silently
for non-vector anchors.
- ObjectStore::flushTo(ObjectStore& dst): two-phase, atomic, zero-
copy bulk transfer of entries between two instances. Topics matched
by descriptor; monotonicity enforced strictly per series; failure
leaves both sides untouched. Each ObjectEntry is moved by value
via std::move; the std::any inside transfers its buffer intact.
- DataEngine::flushTo(DataEngine& dst): symmetric primitive for the
columnar scalar store. Each TopicStorage's sealed-chunk deque is
moved through to the destination; no chunk constructor invoked.
- sdk::makePayloadView(std::vector<uint8_t>) replaces
sdk::makeOwnedPayloadView. Wraps a vector into a shared_ptr that
serves as both the bytes backing and the BufferAnchor.
- ObjectBytesBox removed from plugin_data_host. The C-ABI toolbox
handle becomes a heap-allocated PayloadView directly.
plugin_data_host atomic target swap
- setTarget on engine and parser write hosts atomically swap which
engine/store receives subsequent writes. Safe under concurrent
ingest: in-flight writes complete on the previous target.
Version bump
- 0.4.0 -> 0.5.0. Source-incompatible: ResolvedObjectEntry::data
renamed to payload (PayloadView instead of shared_ptr<vector>).
Consumers migrate from entry->data->{data,size,empty}() to
entry->payload.bytes.{data,size,empty}(); from entry->data to
entry->payload.anchor for ownership retention.
* minor changes
---------
Co-authored-by: Davide Faconti <davide.faconti@gmail.com>
0 commit comments