ByteDurableDb.flush.stats.entries: def of mylsm-lsm-store@0.6.0.1 Import: import mylsm-lsm-store@0.6.0.1/src/ByteDurableDb.bend as ByteDurableDb Lines 632-645 of mylsm-lsm-store@0.6.0.1/src/ByteDurableDb.bend: https://jend.leeeet.dev/read.txt?path=mylsm-lsm-store@0.6.0.1/src/ByteDurableDb.bend&start_line=632&end_line=645 import Base import mylsm-lsm-store@0.6.0.1/src/ByteMemTable.bend as ByteMemTable import mylsm-lsm-store@0.6.0.1/src/scan/VisibleStats.bend as VisibleStats import bend-kit-bytes@0.3.2.0/bytes.bend as Bytes # Keeps the original state when SST or WAL checkpoint publication fails. # Counts the visible entries and payload bytes in the newly published SST. def flush.stats.entries( entries: List<&1, ByteMemTable.Entry>, current: VisibleStats.Stats ) -> VisibleStats.Stats: match entries: case Nil{}: current case Con{ByteMemTable.Entry{Bytes.Bytes{+key_len, _}, value}, tail}: match value: case None{}: flush.stats.entries(tail, current) case Some{Bytes.Bytes{+value_len, _}}: flush.stats.entries(tail, VisibleStats.result(VisibleStats.apply( current, U32.to_nat(key_len), None{}, Some{U32.to_nat(value_len)}))) Uses (8): https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=List https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Maybe https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32.to_nat https://jend.leeeet.dev/definition.txt?path=bend-kit-bytes@0.3.3.0/bytes.bend&name=Bytes https://jend.leeeet.dev/definition.txt?path=mylsm-lsm-store@0.6.0.1/src/ByteMemTable.bend&name=Entry https://jend.leeeet.dev/definition.txt?path=mylsm-lsm-store@0.6.0.1/src/scan/VisibleStats.bend&name=Stats https://jend.leeeet.dev/definition.txt?path=mylsm-lsm-store@0.6.0.1/src/scan/VisibleStats.bend&name=apply https://jend.leeeet.dev/definition.txt?path=mylsm-lsm-store@0.6.0.1/src/scan/VisibleStats.bend&name=result