MCPcopy Index your code
hub / github.com/CovenantSQL/CovenantSQL / newBlockRange

Function newBlockRange

cmd/cql-fuse/block.go:64–73  ·  view source on GitHub ↗

newBlockRange returns the block range for 'size' bytes from 'from'.

(from, length uint64)

Source from the content-addressed store, hash-verified

62
63// newBlockRange returns the block range for 'size' bytes from 'from'.
64func newBlockRange(from, length uint64) blockRange {
65 end := from + length
66 return blockRange{
67 start: int(from / BlockSize),
68 startOffset: from % BlockSize,
69 startLength: min(length, BlockSize-(from%BlockSize)),
70 last: int(end / BlockSize),
71 lastLength: end % BlockSize,
72 }
73}
74
75// shrink resizes the data to a smaller length.
76// Requirement: from > to.

Callers 5

TestBlockInfoFunction · 0.85
shrinkFunction · 0.85
growFunction · 0.85
readFunction · 0.85
writeFunction · 0.85

Calls 1

minFunction · 0.85

Tested by 1

TestBlockInfoFunction · 0.68