memory

package
v1.10.0 Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConfigStore

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

ConfigStore satisfies the dataplane.ConfigStore interface using in-memory storage for config, deploys, saved views, and services.

func NewConfigStore

func NewConfigStore(cfg *config.Config) *ConfigStore

NewConfigStore creates a ConfigStore with optional initial config.

func (*ConfigStore) AddDeploy

func (s *ConfigStore) AddDeploy(_ context.Context, deploy dataplane.DeployEvent) error

AddDeploy appends a deploy event.

func (*ConfigStore) DeleteView

func (s *ConfigStore) DeleteView(_ context.Context, id string) error

DeleteView removes the saved view with the given ID.

func (*ConfigStore) GetConfig

func (s *ConfigStore) GetConfig(_ context.Context) (*config.Config, error)

GetConfig returns the stored config.

func (*ConfigStore) ListDeploys

ListDeploys returns deploy events matching the filter.

func (*ConfigStore) ListServices

func (s *ConfigStore) ListServices(_ context.Context) ([]dataplane.ServiceEntry, error)

ListServices returns all registered services.

func (*ConfigStore) ListViews

func (s *ConfigStore) ListViews(_ context.Context) ([]dataplane.SavedView, error)

ListViews returns all saved views.

func (*ConfigStore) SaveView

func (s *ConfigStore) SaveView(_ context.Context, view dataplane.SavedView) error

SaveView adds or replaces a saved view (matched by ID).

func (*ConfigStore) SetConfig

func (s *ConfigStore) SetConfig(_ context.Context, cfg *config.Config) error

SetConfig replaces the stored config.

func (*ConfigStore) UpsertService

func (s *ConfigStore) UpsertService(_ context.Context, svc dataplane.ServiceEntry) error

UpsertService adds or updates a service entry (matched by Name).

type MetricStore

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

MetricStore wraps gateway.RequestStats and RequestLog to satisfy the dataplane.MetricReader and dataplane.MetricWriter interfaces for local mode.

func NewMetricStore

func NewMetricStore(stats *gateway.RequestStats, log *gateway.RequestLog) *MetricStore

NewMetricStore creates a MetricStore.

func (*MetricStore) Percentiles

func (s *MetricStore) Percentiles(_ context.Context, service, action string, window time.Duration) (*dataplane.LatencyPercentiles, error)

Percentiles returns latency percentiles for a service/action over the given window.

func (*MetricStore) Record

func (s *MetricStore) Record(_ context.Context, service, action string, latencyMs float64, statusCode int) error

Record records a metric sample and increments the request counter.

func (*MetricStore) ServiceStats

func (s *MetricStore) ServiceStats(_ context.Context, service string, window time.Duration) (*dataplane.ServiceMetrics, error)

ServiceStats returns aggregate metrics for a service over the given window.

type PreferenceStore

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

PreferenceStore satisfies the dataplane.PreferenceStore interface using in-memory storage.

func NewPreferenceStore

func NewPreferenceStore() *PreferenceStore

NewPreferenceStore creates an empty in-memory PreferenceStore.

func (*PreferenceStore) Delete

func (s *PreferenceStore) Delete(_ context.Context, namespace, key string) error

Delete removes a key from the given namespace.

func (*PreferenceStore) Get

func (s *PreferenceStore) Get(_ context.Context, namespace, key string) (json.RawMessage, error)

Get returns the value for the given namespace and key. Returns ErrNotFound if the key does not exist.

func (*PreferenceStore) ListByNamespace

func (s *PreferenceStore) ListByNamespace(_ context.Context, namespace string) (map[string]json.RawMessage, error)

ListByNamespace returns all key-value pairs for the given namespace. Returns an empty map if the namespace does not exist.

func (*PreferenceStore) Set

func (s *PreferenceStore) Set(_ context.Context, namespace, key string, value json.RawMessage) error

Set upserts a value for the given namespace and key.

type RequestStore

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

RequestStore wraps gateway.RequestLog to satisfy the dataplane.RequestReader and dataplane.RequestWriter interfaces for local (in-memory) mode.

func NewRequestStore

func NewRequestStore(log *gateway.RequestLog) *RequestStore

NewRequestStore creates a RequestStore wrapping the given gateway.RequestLog.

func (*RequestStore) GetByID

GetByID returns the request entry with the given ID.

func (*RequestStore) Query

Query returns request entries matching the filter.

func (*RequestStore) Write

Write adds a request entry to the log.

type SLOStore

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

SLOStore wraps gateway.SLOEngine to satisfy the dataplane.SLOStore interface for local (in-memory) mode.

func NewSLOStore

func NewSLOStore(engine *gateway.SLOEngine) *SLOStore

NewSLOStore creates an SLOStore wrapping the given gateway.SLOEngine.

func (*SLOStore) History

func (s *SLOStore) History(_ context.Context, _ int) ([]dataplane.SLORuleChange, error)

History returns SLO rule change history. In-memory mode has no history.

func (*SLOStore) Rules

func (s *SLOStore) Rules(_ context.Context) ([]config.SLORule, error)

Rules returns the configured SLO rules.

func (*SLOStore) SetRules

func (s *SLOStore) SetRules(_ context.Context, rules []config.SLORule) error

SetRules updates the SLO rules.

func (*SLOStore) Status

func (s *SLOStore) Status(_ context.Context) (*dataplane.SLOStatus, error)

Status returns the current SLO status.

type TopologyStore

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

TopologyStore satisfies the dataplane.TopologyStore interface using in-memory slices for nodes and edges.

func NewTopologyStore

func NewTopologyStore() *TopologyStore

NewTopologyStore creates an empty TopologyStore.

func (*TopologyStore) Downstream

func (s *TopologyStore) Downstream(_ context.Context, service string) ([]string, error)

Downstream returns all services that the given service calls.

func (*TopologyStore) GetTopology

func (s *TopologyStore) GetTopology(_ context.Context) (*dataplane.TopologyGraph, error)

GetTopology returns the full topology graph.

func (*TopologyStore) RecordEdge

func (s *TopologyStore) RecordEdge(_ context.Context, edge dataplane.ObservedEdge) error

RecordEdge upserts an edge. If an edge with the same Source, Target, and EdgeType already exists, its RequestCount is incremented. Otherwise, a new edge is appended and nodes are created as needed.

func (*TopologyStore) Upstream

func (s *TopologyStore) Upstream(_ context.Context, service string) ([]string, error)

Upstream returns all services that have an edge targeting the given service.

type TraceStore

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

TraceStore wraps gateway.TraceStore to satisfy the dataplane.TraceReader and dataplane.TraceWriter interfaces for local (in-memory) mode.

func NewTraceStore

func NewTraceStore(store *gateway.TraceStore) *TraceStore

NewTraceStore creates a TraceStore wrapping the given gateway.TraceStore.

func (*TraceStore) Get

func (s *TraceStore) Get(_ context.Context, traceID string) (*dataplane.TraceContext, error)

Get returns the trace with the given ID, converting from gateway types.

func (*TraceStore) Search

Search returns recent traces matching the filter.

func (*TraceStore) Timeline

func (s *TraceStore) Timeline(_ context.Context, traceID string) ([]dataplane.TimelineSpan, error)

Timeline returns a flattened waterfall view of the trace.

func (*TraceStore) WriteSpans

func (s *TraceStore) WriteSpans(_ context.Context, spans []*dataplane.Span) error

WriteSpans writes spans to the underlying trace store.

Jump to

Keyboard shortcuts

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