postgres

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

func NewPool

func NewPool(ctx context.Context, cfg config.PostgreSQLConfig) (*pgxpool.Pool, error)

NewPool creates a PostgreSQL connection pool from the given config.

Types

type ConfigStore

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

ConfigStore implements dataplane.ConfigStore against PostgreSQL.

func NewConfigStore

func NewConfigStore(pool *pgxpool.Pool) *ConfigStore

NewConfigStore creates a ConfigStore backed by the given pool.

func (*ConfigStore) AddDeploy

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

AddDeploy inserts a deploy event. The referenced service is upserted first to satisfy the FK constraint.

func (*ConfigStore) DeleteView

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

DeleteView removes a saved view by ID.

func (*ConfigStore) GetConfig

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

GetConfig assembles a Config by reading all key/value pairs from the config table.

func (*ConfigStore) ListDeploys

func (s *ConfigStore) ListDeploys(ctx context.Context, filter dataplane.DeployFilter) ([]dataplane.DeployEvent, error)

ListDeploys returns deploy events with optional service filter and limit.

func (*ConfigStore) ListServices

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

ListServices returns all services ordered by name.

func (*ConfigStore) ListViews

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

ListViews returns all saved views ordered by creation time.

func (*ConfigStore) SaveView

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

SaveView upserts a saved view.

func (*ConfigStore) SetConfig

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

SetConfig stores the config as individual key/value pairs using upsert.

func (*ConfigStore) UpsertService

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

UpsertService inserts or updates a service entry.

type PreferenceStore

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

PreferenceStore implements dataplane.PreferenceStore against PostgreSQL.

func NewPreferenceStore

func NewPreferenceStore(pool *pgxpool.Pool) *PreferenceStore

NewPreferenceStore creates a PreferenceStore backed by the given pool.

func (*PreferenceStore) Delete

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

Delete removes a key from the given namespace.

func (*PreferenceStore) Get

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

Get returns the value for the given namespace and key.

func (*PreferenceStore) ListByNamespace

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

ListByNamespace returns all key-value pairs for the given namespace.

func (*PreferenceStore) Set

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

Set upserts a value for the given namespace and key.

type SLOStore

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

SLOStore implements dataplane.SLOStore against PostgreSQL.

func NewSLOStore

func NewSLOStore(pool *pgxpool.Pool) *SLOStore

NewSLOStore creates an SLOStore backed by the given pool.

func (*SLOStore) History

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

History returns the most recent SLO rule changes.

func (*SLOStore) Rules

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

Rules returns all active SLO rules.

func (*SLOStore) SetRules

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

SetRules deactivates all current rules and inserts new ones in a transaction. History entries are recorded for each new rule.

func (*SLOStore) Status

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

Status returns a basic SLOStatus built from active rules. Real-time metrics come from the SLO engine at a higher level; here we return zero-value windows.

type TopologyStore

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

TopologyStore implements dataplane.TopologyStore against PostgreSQL.

func NewTopologyStore

func NewTopologyStore(pool *pgxpool.Pool) *TopologyStore

NewTopologyStore creates a TopologyStore backed by the given pool.

func (*TopologyStore) Downstream

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

Downstream returns all services that the given service calls.

func (*TopologyStore) GetTopology

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

GetTopology returns the full topology graph from services and edges.

func (*TopologyStore) RecordEdge

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

RecordEdge upserts an edge between two services. Source and target services are created automatically to satisfy FK constraints.

func (*TopologyStore) Upstream

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

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

Jump to

Keyboard shortcuts

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