def file.root

mylsm-lsm-store@0.6.0.1 · src/ByteSstFile.bend:152

import mylsm-lsm-store@0.6.0.1/src/ByteSstFile.bend as ByteSstFile
import Base
import mylsm-lsm-store@0.6.0.1/src/hub_sha/sha256.bend as SHA
import bend-kit-bytes@0.3.2.0/bytes.bend as Bytes

152# Adds the root footer after hashing header, block digest, and index metadata.
153def file.root(
154  header_output: Bytes.Bytes,
155  header_hash: Bytes.Bytes,
156  block: Bytes.Bytes,
157  block_root: Bytes.Bytes,
158  index_output: Bytes.Bytes,
159  index_hash: Bytes.Bytes,
160  index_length: U32,
161  +total: U32
162) -> Result<&1, &1, Error, Bytes.Bytes>:
163  file.emit(header_output, block, index_output,
164    Bytes.concat([footer.magic(), u32.bytes(total), u32.bytes(index_length),
165      SHA.sha256_packed_bytes(Bytes.concat([header_hash, block_root, index_hash]))]))

Uses (10)

Used by (1)