MCPcopy Create free account
hub / github.com/NodeDB-Lab/nodedb / handle_begin

Function handle_begin

nodedb/src/control/server/native/dispatch/transaction.rs:18–27  ·  view source on GitHub ↗
(ctx: &DispatchCtx<'_>, seq: u64)

Source from the content-addressed store, hash-verified

16use super::{DispatchCtx, error_to_native};
17
18pub(crate) fn handle_begin(ctx: &DispatchCtx<'_>, seq: u64) -> NativeResponse {
19 let snapshot_lsn = {
20 let next = ctx.state.wal.next_lsn();
21 crate::types::Lsn::new(next.as_u64().saturating_sub(1))
22 };
23 match ctx.sessions.begin(ctx.peer_addr, snapshot_lsn) {
24 Ok(()) => NativeResponse::status_row(seq, "BEGIN"),
25 Err(msg) => NativeResponse::error(seq, "25P02", msg),
26 }
27}
28
29pub(crate) async fn handle_commit(ctx: &DispatchCtx<'_>, seq: u64) -> NativeResponse {
30 // Snapshot isolation conflict check.

Callers 2

handle_requestMethod · 0.85
handle_sqlFunction · 0.85

Calls 3

next_lsnMethod · 0.45
as_u64Method · 0.45
beginMethod · 0.45

Tested by

no test coverage detected