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

Function readStateRootComposition

packages/storage/src/state-root-composition.ts:86–103  ·  view source on GitHub ↗
(root: string)

Source from the content-addressed store, hash-verified

84}
85
86async function readStateRootComposition(root: string): Promise<StateRootCompositionRecord> {
87 return withCompositionIoFailure(async () => {
88 const contents = await readBoundedMarkerFile({
89 path: join(root, STATE_ROOT_COMPOSITION_FILE),
90 maxBytes: MAX_STATE_ROOT_COMPOSITION_BYTES,
91 invalidFile,
92 });
93 let value: unknown;
94 try {
95 value = JSON.parse(contents) as unknown;
96 } catch (error) {
97 throw invalidFile(error);
98 }
99 if (!isExactCompositionRecord(value)) throw invalidFile();
100 requireCompositionId(value.compositionId);
101 return value;
102 });
103}
104
105function assertMatchingComposition(
106 record: StateRootCompositionRecord,

Callers 2

bindStateRootCompositionFunction · 0.85

Calls 5

withCompositionIoFailureFunction · 0.85
readBoundedMarkerFileFunction · 0.85
invalidFileFunction · 0.85
isExactCompositionRecordFunction · 0.85
requireCompositionIdFunction · 0.85

Tested by

no test coverage detected