store

package
v0.1.12 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 27, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Filter

type Filter interface {
	Match(flow *FlowMeta) bool
}

Filter determines whether a FlowMeta should be included in results.

type FlowData

type FlowData struct {
	RequestHeaders  http.Header
	RequestBody     []byte
	ResponseHeaders http.Header
	ResponseBody    []byte
	ProcessPID      int32
	ProcessCmdline  string
}

FlowData holds the full request/response headers and bodies.

type FlowID

type FlowID = string

FlowID is the unique identifier for a captured flow.

type FlowMeta

type FlowMeta struct {
	ID          FlowID
	Method      string
	StatusCode  int
	Host        string
	Path        string
	Duration    time.Duration
	SizeBytes   int64
	StartedAt   time.Time
	State       FlowState
	ContentType string
	Scheme      string
	Process     string
	ProcessPID  int32
}

FlowMeta holds the summary fields displayed in the list view.

type FlowState

type FlowState int

FlowState represents the lifecycle state of a flow.

const (
	StateInProgress FlowState = iota
	StateCompleted
	StateFailed
	StateBreakpoint
)

type RingBuffer

type RingBuffer struct {
	// contains filtered or unexported fields
}

RingBuffer is a thread-safe circular buffer for captured flows.

func New

func New(capacity int) *RingBuffer

New creates a RingBuffer with the given capacity.

func (*RingBuffer) Add

func (rb *RingBuffer) Add(meta FlowMeta)

Add inserts a flow into the buffer, evicting the oldest if full.

func (*RingBuffer) Get

func (rb *RingBuffer) Get(id FlowID) (*FlowMeta, *FlowData, error)

Get returns the FlowMeta and FlowData for the given ID.

func (*RingBuffer) Len

func (rb *RingBuffer) Len() int

Len returns the number of flows in the buffer.

func (*RingBuffer) List

func (rb *RingBuffer) List(filter Filter, offset, limit int) ([]FlowMeta, int)

List returns flows newest-first, filtered, with offset/limit pagination. The second return value is the total count matching the filter.

func (*RingBuffer) SetData

func (rb *RingBuffer) SetData(id FlowID, d *FlowData)

SetData replaces the FlowData for the given ID.

func (*RingBuffer) Update

func (rb *RingBuffer) Update(id FlowID, fn func(*FlowMeta))

Update applies fn to the FlowMeta with the given ID.

func (*RingBuffer) UpdateData added in v0.1.8

func (rb *RingBuffer) UpdateData(id FlowID, fn func(*FlowData))

UpdateData applies fn to the FlowData for the given ID, creating an empty FlowData if none exists yet.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL