MCPcopy Create free account
hub / github.com/apache/maka / buildImmutableRuntimePrefix

Function buildImmutableRuntimePrefix

packages/core/src/runtime-boundary.ts:68–86  ·  view source on GitHub ↗
(
  identity: RuntimePrefixIdentityV1,
  rows: readonly RuntimePrefixRowV1[],
)

Source from the content-addressed store, hash-verified

66}
67
68export function buildImmutableRuntimePrefix(
69 identity: RuntimePrefixIdentityV1,
70 rows: readonly RuntimePrefixRowV1[],
71): ImmutableRuntimePrefixV1 {
72 const canonicalRows = canonicalizePrefixRows(identity, rows);
73 const last = canonicalRows.at(-1);
74 if (!last) throw new Error('immutable RuntimeEvent prefix is empty');
75 return {
76 protocol: 'immutable_runtime_prefix_v1',
77 identity: { ...identity },
78 position: {
79 lastEventSeq: last.eventSeq,
80 eventCount: canonicalRows.length,
81 lastEventId: last.event.id,
82 },
83 prefixDigest: digestCanonicalRuntimePrefix(identity, canonicalRows),
84 events: canonicalRows.map((row) => row.event),
85 };
86}
87
88export function digestRuntimePrefix(
89 identity: RuntimePrefixIdentityV1,

Callers 12

continuationSourcePrefixFunction · 0.90
continuationFunction · 0.90
immutablePrefixFunction · 0.90
immutablePrefixFunction · 0.90
runtimePrefixSegmentFunction · 0.85
boundaryForRunsFunction · 0.85

Calls 2

canonicalizePrefixRowsFunction · 0.85

Tested by 7

continuationSourcePrefixFunction · 0.72
continuationFunction · 0.72
immutablePrefixFunction · 0.72
immutablePrefixFunction · 0.72
boundaryForRunsFunction · 0.68