MCPcopy Create free account
hub / github.com/clockworklabs/SpacetimeDB / seek_buffer

Function seek_buffer

crates/core/src/database_logger.rs:556–559  ·  view source on GitHub ↗

Allocate a buffer to use with [seek_to]. We assume a log line is typically around 150 bytes long, and allocate space to fit `num_lines` in one read. The max size of the buffer is 64KiB.

(num_lines: u32)

Source from the content-addressed store, hash-verified

554/// We assume a log line is typically around 150 bytes long, and allocate space
555/// to fit `num_lines` in one read. The max size of the buffer is 64KiB.
556fn seek_buffer(num_lines: u32) -> Vec<u8> {
557 let chunk_size = std::cmp::min((num_lines as u64 * 150).next_power_of_two(), 0x10_000);
558 vec![0; chunk_size as usize]
559}
560
561/// Set `file`'s position such that reading to the end will yield `num_lines`.
562///

Callers 3

tail_streamMethod · 0.85
read_latest_on_diskMethod · 0.85
read_linesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…