Documentation
¶
Overview ¶
Package segments builds deterministic segment payloads and identifiers for use by streaming/connection tests.
The fakepool client (internal/testsupport/fakepool) returns whatever bytes you configure for a given message-ID; this package supplies a consistent naming scheme and a recoverable payload format so that a test which downloads segments through the streaming pipeline can verify that the reassembled bytes match what was injected.
Naming ¶
MessageID(i) returns "altmount-test-seg-NNNNNN@fake" — six-digit zero-padded so lexicographic sort matches segment order. Tests pin this format so the fakepool behaviors and the segment-range builder agree without sharing a channel.
Payload shape ¶
Payload(i, size) returns a deterministic byte slice of the requested size. The first 32 bytes encode the segment index in ASCII (left-justified, NUL padded), so a hexdump of any cached buffer instantly shows which segment it came from. The remaining bytes are a repeating pattern derived from i, cheap to generate and stable across runs.
File reassembly ¶
FileBytes(n, size) returns the concatenation of Payload(0..n-1, size). Tests that read a virtual file end-to-end through the streaming pipeline can compare the bytes they receive to this slice to catch ordering or boundary bugs.
Index ¶
Constants ¶
const MessageIDPrefix = "altmount-test-seg-"
MessageIDPrefix is the constant prefix used for all generated message-IDs. Exposed so fakepool setup loops can sanity-check inputs.
Variables ¶
This section is empty.
Functions ¶
func FileBytes ¶
FileBytes returns the concatenation of Payload(0..n-1, size). The result is the expected output of a sequential read across n segments.
Types ¶
This section is empty.