def index.page.decode.root
mylsm-lsm-store@0.6.0.1 · src/scan/ByteBlockReader.bend:1539
import mylsm-lsm-store@0.6.0.1/src/scan/ByteBlockReader.bend as ByteBlockReader
import Base
import mylsm-lsm-store@0.6.0.1/src/scan/BlockIndexPolicy.bend as BlockIndexPolicy
import mylsm-lsm-store@0.6.0.1/src/hub_sha/sha256.bend as SHA
1539def index.page.decode.root(
1540 reader: IndexMeta,
1541 +offset: Nat,
1542 +remaining: Nat,
1543 actual_hash: SHA.Stream,
1544 root_result: Result<&1, &1, SHA.StreamError, SHA.Stream>
1545) -> Result<&1, &1, U32 & String, IndexPageData>:
1546 match root_result:
1547 case Fail{_}:
1548 Fail{resource_limit("SST root hash exceeds the SHA-256 input limit")}
1549 case Done{next_root_hash}:
1550 +page_size = BlockIndexPolicy.read_bytes(remaining)
1551 Done{IndexPageData{reader, Nat.add(offset, page_size),
1552 Nat.sub(remaining, page_size), actual_hash, next_root_hash}}