Documentation
¶
Index ¶
- Constants
- Variables
- func MetadataPath(path string) string
- func Replay(path string) ([][]byte, error)
- func ReplayContext(ctx context.Context, path string) ([][]byte, error)
- func ReplayEachContext(ctx context.Context, path string, submit func([]byte) error) error
- func ReplaySegments(path string, submit func([]byte) error) error
- func Validate(path string) error
- func ValidateContext(ctx context.Context, path string) error
- type Direction
- type FrameMetadata
- type FrameRecorder
- type Recorder
- type SegmentOptions
- type SegmentedRecorder
Constants ¶
const ( MaxFrameSize = 64 << 20 MaxCaptureSize = 256 << 20 MaxCaptureFrames = 1 << 20 )
Variables ¶
var ( ErrRecorderClosed = errors.New("capture recorder is closed") ErrFrameTooLarge = errors.New("capture frame exceeds size limit") ErrCaptureTooLarge = errors.New("capture exceeds aggregate size limit") ErrTooManyFrames = errors.New("capture exceeds frame count limit") ErrRecorderFailed = errors.New("capture recorder entered failed state") ErrCaptureInUse = errors.New("capture path is already owned by another recorder") )
var ( ErrCaptureBackpressure = errors.New("capture writer queue is full") ErrInsufficientDisk = errors.New("capture minimum free disk threshold reached") ErrCloseDrainTimeout = errors.New("capture writer close drain budget exceeded") ErrCorruptRecord = errors.New("capture record failed integrity validation") )
Functions ¶
func MetadataPath ¶
func ReplayContext ¶
ReplayContext validates the complete capture before allocating or returning frames. The aggregate limits bound the memory retained by the legacy Replay API; callers that need to process larger captures should use ReplayEachContext.
func ReplayEachContext ¶
ReplayEachContext snapshots and validates the entire source before invoking submit. This guarantees that a corrupt source never results in partial frame submission while keeping memory use bounded to one frame.
func ReplaySegments ¶ added in v0.0.2
ReplaySegments validates every record before submitting it.
Types ¶
type FrameMetadata ¶
type FrameMetadata struct {
Index uint64 `json:"index"`
Direction Direction `json:"direction"`
Timestamp time.Time `json:"timestamp"`
Size uint32 `json:"size"`
}
func ReplayMetadata ¶
func ReplayMetadata(path string) ([]FrameMetadata, error)
type FrameRecorder ¶ added in v0.0.2
type SegmentOptions ¶ added in v0.0.2
type SegmentOptions struct {
SegmentMaxBytes uint64
RetainSegments int
MinFreeBytes uint64
QueueDepth int
CloseDrain time.Duration
}
SegmentOptions controls the bounded, crash-detectable capture writer.
type SegmentedRecorder ¶ added in v0.0.2
type SegmentedRecorder struct {
// contains filtered or unexported fields
}
SegmentedRecorder accepts owned copies of frames and serializes them on a bounded background writer. Segment files are published only after sync.
func StartSegmented ¶ added in v0.0.2
func StartSegmented(path string, options SegmentOptions) (*SegmentedRecorder, error)
func (*SegmentedRecorder) Close ¶ added in v0.0.2
func (r *SegmentedRecorder) Close() error
func (*SegmentedRecorder) Write ¶ added in v0.0.2
func (r *SegmentedRecorder) Write(frame []byte) error