Documentation
¶
Overview ¶
Package testutils links the L3B dataplane type constructors for shared-memory tests.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewStorage ¶
NewStorage loads the production L3B module and inert object types into a ready fixture without creating workers or active configuration.
func ReadModuleCounterIDs ¶
func ReadModuleCounterIDs(module ffi.ModuleConfig, count int) ([]uint64, error)
ReadModuleCounterIDs copies IDs from an idle, live unpublished module candidate.
Types ¶
type AllocationWitness ¶
type AllocationWitness struct {
Matches uint64
RegisteredCounters uint64
ReservedBlocks uint64
ReservedBytes uint64
Exhausted bool
}
AllocationWitness proves successful registration and complete arena exhaustion.
func WithRealServerAllocationFailure ¶
func WithRealServerAllocationFailure( service string, operation func() error, ) (witness AllocationWitness, err error)
WithRealServerAllocationFailure exhausts an idle arena after two real counters.
The operation must keep its agent alive and perform only synchronous candidate construction with two reals. Reservations are released before returning, even on panic; other users must not allocate or free from this arena concurrently.
type CounterFailure ¶
CounterFailure describes one semantic registration boundary and its prefix.
func RequiredCounterFailures ¶
func RequiredCounterFailures() []CounterFailure
RequiredCounterFailures selects every boundary for a service with two reals.
type CounterKey ¶
CounterKey distinguishes service counters from their module-link counters.
type CounterLink ¶
type CounterLink struct {
Device string
Pipeline string
Function string
Chain string
ModuleType string
Module string
}
CounterLink identifies the module-to-service relation wired by a test.
type CounterState ¶
CounterState records the published mapping and its per-worker values.
type CounterWitness ¶
CounterWitness proves the selected registry prefix reached one refusal.
func WithCounterFailure ¶
func WithCounterFailure( service string, failure CounterFailure, operation func() error, ) (witness CounterWitness, err error)
WithCounterFailure refuses one registration during a synchronous operation.
Thread-local state is cleared on every exit, including panics. Untargeted registrations use the production implementation; this is not allocator OOM.
type LookupWitness ¶
type LookupWitness struct {
Lookups []ServiceLookup
CounterLookups uint64
UnprotectedObjects uint64
UnprotectedCounters uint64
ProvenanceErrors uint64
RacingObjects uint64
}
LookupWitness records real lookup hits, missing protection and provenance errors.
func WithLinkedServiceLookup ¶
func WithLinkedServiceLookup( agent *ffi.Agent, operation func() error, ) (witness LookupWitness, err error)
WithLinkedServiceLookup observes a synchronous update without pinning its reads.
The caller keeps the agent alive. Thread-local observation is disarmed on every exit; unrelated threads and unarmed calls use the real implementation unchanged.
type PublishedCounterState ¶
type PublishedCounterState struct {
Service uintptr
Table uintptr
TableReferences uint64
ObjectStorage uintptr
LinkStorage uintptr
Counters map[CounterKey]CounterState
}
PublishedCounterState is a non-owning snapshot of a settled generation.
func ReadCounterState ¶
func ReadCounterState( executionContext uintptr, service string, link CounterLink, ) (PublishedCounterState, error)
ReadCounterState snapshots both registries without changing their ownership.
The caller must keep the worker generation alive and run no concurrent config updates or packets while reading its ordinary counter values.
type ServiceLookup ¶
type ServiceLookup struct {
Generation uintptr
GenerationNumber uint64
Object uintptr
CounterRegistry uintptr
CounterID uint64
// Racing marks a lookup diverted from the published generation by a
// concurrent publication while its reader still held the pin; the
// provenance fields above stay unset for it.
Racing bool
}
ServiceLookup binds a copied counter ID to its protected generation and object.
Addresses are identity values, not handles that may be dereferenced afterward.