Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
wsdb_schedule.hpp File Reference

Helpers that wrap a handler's work in the per-fork scheduler. More...

#include "barretenberg/wsdb/generated/wsdb_dispatch.hpp"
#include "barretenberg/wsdb/wsdb_request.hpp"
#include "barretenberg/wsdb/wsdb_scheduler.hpp"
#include <cstdint>
#include <exception>
#include <string>
#include <utility>

Go to the source code of this file.

Namespaces

namespace  bb
 Entry point for Barretenberg command-line interface.
 
namespace  bb::wsdb
 
namespace  bb::wsdb::detail
 

Functions

template<typename Resp , typename Fn >
std::function< void()> bb::wsdb::detail::wrap (Responder< Resp > respond, Fn &&logic)
 
template<typename Resp , typename Fn >
void bb::wsdb::schedule_read (WsdbRequest &ctx, uint64_t fork, bool committed, Responder< Resp > respond, Fn &&logic)
 Run a read on fork and respond. committed true => independent snapshot, never ordered; false => waits behind an in-flight write on the fork.
 
template<typename Resp , typename Fn >
void bb::wsdb::schedule_write (WsdbRequest &ctx, uint64_t fork, Responder< Resp > respond, Fn &&logic)
 Run a write on fork (exclusive on that fork) and respond.
 

Detailed Description

Helpers that wrap a handler's work in the per-fork scheduler.

A handler declares its own ordering by which helper it calls — schedule_read (concurrent; committed reads bypass ordering entirely) or schedule_write (exclusive on its fork) — and supplies the fork it touches plus a logic lambda returning the typed response. The helper runs logic on the scheduler (inline when idle, else a pool thread), turning a return value into respond.ok(...) and any thrown exception into respond.error(...), so handler bodies stay free of threading and error-frame boilerplate.

Definition in file wsdb_schedule.hpp.