FastMM documentation
FastMM C++ API 0.6.0
Public headers, tier 1 and tier 2
Loading...
Searching...
No Matches
store_thread.hpp File Reference

StoreThread: drains the engine's record ring into a Backend, on its own thread. More...

#include "fastmm/core/msg_ring.hpp"
#include "fastmm/store/backend.hpp"
#include <atomic>
#include <cstddef>
#include <cstdint>
#include <memory>
#include <thread>

Go to the source code of this file.

Classes

struct  fastmm::store::StoreThreadOptions
 
struct  fastmm::store::StoreThreadStats
 
class  fastmm::store::StoreThread
 

Namespaces

namespace  fastmm
 
namespace  fastmm::store
 

Detailed Description

StoreThread: drains the engine's record ring into a Backend, on its own thread.

The mirror of JournalFileWriter: the engine writes into an SPSC MsgRing and never waits, this side batches what it finds into one backend transaction. A pass over the ring commits every max_batch records and whatever is left at its end, and the thread sleeps 2 ms when the ring is empty; so a busy session does not commit per fill and an idle one commits within 2 ms.

It never signals the engine. A backend that fails counts the error and keeps going; a ring that fills drops records on the engine side (EngineStats::records_dropped). Both are logged when the session ends and stored in the session's row; neither stops trading (docs/reference/storage.md).