• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

jallum / bedrock / 99249060abab715e2a5d7041cb8160f04e3f08ca

13 Aug 2025 02:53AM UTC coverage: 58.423%. First build
99249060abab715e2a5d7041cb8160f04e3f08ca

push

github

jallum
0.1.2

- Reworked and simplified documentation
- Increased test coverage
- Project housekeeping

1515 of 2481 new or added lines in 105 files covered. (61.06%)

2112 of 3615 relevant lines covered (58.42%)

828.68 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

50.0
/lib/bedrock/data_plane/commit_proxy.ex
1
defmodule Bedrock.DataPlane.CommitProxy do
2
  @moduledoc """
3
  Central coordinator of Bedrock's transaction commit process.
4

5
  The Commit Proxy batches transactions from multiple clients for efficient processing,
6
  orchestrates conflict resolution through Resolvers, and ensures durable persistence
7
  across all required log servers. It transforms individual transaction requests into
8
  efficiently processed batches while maintaining strict consistency guarantees.
9

10
  Transaction batching creates a fundamental trade-off between latency and throughput.
11
  The Commit Proxy manages this through configurable size and time limits that balance
12
  responsiveness against processing efficiency. This batching strategy enables
13
  intra-batch conflict detection and amortizes the fixed costs of conflict resolution
14
  and logging across multiple transactions while preserving the arrival order of
15
  transactions within each batch.
16

17
  The component uses a fail-fast recovery model where unrecoverable errors trigger
18
  process exit and Director-coordinated recovery. Commit Proxies start in locked mode
19
  and require explicit unlocking through `recover_from/3` before accepting transaction
20
  commits, ensuring proper coordination during cluster recovery scenarios.
21

22
  For detailed architectural concepts and design reasoning, see the
23
  [Commit Proxy documentation](../../../../docs/components/commit-proxy.md).
24
  """
25

26
  alias Bedrock.ControlPlane.Config.TransactionSystemLayout
27

28
  use Bedrock.Internal.GenServerApi, for: __MODULE__.Server
29

30
  @type ref :: pid() | atom() | {atom(), node()}
31

32
  @spec recover_from(
33
          commit_proxy_ref :: ref(),
34
          lock_token :: binary(),
35
          transaction_system_layout :: TransactionSystemLayout.t()
36
        ) :: :ok | {:error, :timeout} | {:error, :unavailable}
37
  def recover_from(commit_proxy, lock_token, transaction_system_layout),
NEW
38
    do: call(commit_proxy, {:recover_from, lock_token, transaction_system_layout}, :infinity)
×
39

40
  @spec commit(commit_proxy_ref :: ref(), transaction :: Bedrock.transaction()) ::
41
          {:ok, version :: Bedrock.version()} | {:error, :timeout | :unavailable}
42
  def commit(commit_proxy, transaction),
43
    do: call(commit_proxy, {:commit, transaction}, :infinity)
2✔
44
end
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc