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

jallum / bedrock / ab2c6c3b5c2ca795449d60536259da9da850b9d0

01 Sep 2025 01:46PM UTC coverage: 63.428% (+0.08%) from 63.351%
ab2c6c3b5c2ca795449d60536259da9da850b9d0

push

github

jallum
Reworked tree balancing, Transaction processing

54 of 66 new or added lines in 3 files covered. (81.82%)

65 existing lines in 7 files now uncovered.

2990 of 4714 relevant lines covered (63.43%)

592.57 hits per line

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

14.29
/lib/bedrock/data_plane/commit_proxy/batch.ex
1
defmodule Bedrock.DataPlane.CommitProxy.Batch do
2
  @moduledoc false
3

4
  alias Bedrock.DataPlane.Transaction
5

6
  @type reply_fn :: ({:ok, Bedrock.version()} | {:error, :abort} -> :ok)
7

8
  @type t :: %__MODULE__{
9
          started_at: Bedrock.timestamp_in_ms(),
10
          finalized_at: Bedrock.timestamp_in_ms() | nil,
11
          last_commit_version: Bedrock.version(),
12
          commit_version: Bedrock.version(),
13
          n_transactions: non_neg_integer(),
14
          buffer: [{index :: non_neg_integer(), reply_fn(), Transaction.encoded()}]
15
        }
16
  defstruct started_at: nil,
17
            finalized_at: nil,
18
            last_commit_version: nil,
19
            commit_version: nil,
20
            n_transactions: 0,
21
            buffer: []
22

23
  @spec new_batch(
24
          Bedrock.timestamp_in_ms(),
25
          last_commit_version :: Bedrock.version(),
26
          commit_version :: Bedrock.version()
27
        ) :: t()
28
  def new_batch(started_at, last_commit_version, commit_version) do
29
    %__MODULE__{
×
30
      started_at: started_at,
31
      last_commit_version: last_commit_version,
32
      commit_version: commit_version,
33
      n_transactions: 0,
34
      buffer: []
35
    }
36
  end
37

38
  @spec transactions_in_order(t()) :: [
39
          {index :: non_neg_integer(), reply_fn(), Transaction.encoded()}
40
        ]
UNCOV
41
  def transactions_in_order(t), do: Enum.reverse(t.buffer)
×
42

43
  @spec all_callers(t()) :: [reply_fn()]
44
  def all_callers(t), do: Enum.map(t.buffer, &elem(&1, 1))
×
45

46
  @spec add_transaction(t(), Transaction.encoded(), reply_fn()) :: t()
47
  def add_transaction(t, transaction, reply_fn) when is_binary(transaction) do
48
    index = t.n_transactions
×
UNCOV
49
    %{t | buffer: [{index, reply_fn, transaction} | t.buffer], n_transactions: index + 1}
×
50
  end
51

52
  @spec transaction_count(t()) :: non_neg_integer()
53
  def transaction_count(t), do: t.n_transactions
21✔
54

55
  @spec set_finalized_at(t(), Bedrock.timestamp_in_ms()) :: t()
UNCOV
56
  def set_finalized_at(t, finalized_at), do: %{t | finalized_at: finalized_at}
×
57
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