Documentation
¶
Overview ¶
Package backendtest provides a shared conformance suite that every backend.Backend implementation must pass, proving the implementations are interchangeable (DESIGN.md §2: "backends are interchangeable behind backend.Backend").
Index ¶
Constants ¶
const Unknown = int64(-1)
Unknown is the free-bytes/free-inodes value that makes a Capacity report backend.ErrSpaceUnknown for that axis, modeling a backend without the capability.
Variables ¶
This section is empty.
Functions ¶
func AtomicConditionalPut ¶ added in v0.33.0
AtomicConditionalPut wraps an S3-compatible test server's handler, serializing every request that carries an If-None-Match or If-Match precondition. Real S3 evaluates a conditional PUT atomically; the embeddable go-faster/fs server (as of v0.3.0) checks the precondition and performs the write as two separate steps, so two concurrent "If-None-Match: *" PUTs can both observe the key absent and both succeed — a TOCTOU race the conformance suite's single-winner CAS test rightly rejects. Serializing just the conditional requests restores real-S3 semantics for the tests without patching the fake. (Worth fixing upstream; this wrapper is then a no-op.)
Types ¶
type Capacity ¶ added in v0.40.0
Capacity wraps a backend with a settable capacity report, so a test can put an engine on a full disk or an exhausted inode table without needing a real one. The two axes are set independently: a filesystem with terabytes free can still fail every create, and a test must be able to say so.
Like github.com/oteldb/storage/backend/faultbackend it forwards no other optional capability — each has a mandatory fallback, so a wrapped backend runs the same code, only slower.
func WithCapacity ¶ added in v0.40.0
WithCapacity wraps b reporting freeBytes bytes and freeInodes inodes available (Unknown for an axis the backend cannot report).
func (*Capacity) FreeInodes ¶ added in v0.40.0
FreeInodes implements backend.InodeReporter.
func (*Capacity) FreeSpace ¶ added in v0.40.0
FreeSpace implements backend.SpaceReporter.
func (*Capacity) SetFreeBytes ¶ added in v0.40.0
SetFreeBytes changes the reported free bytes — the disk filling up, or being emptied.
func (*Capacity) SetFreeInodes ¶ added in v0.40.0
SetFreeInodes changes the reported free inodes.