repos

package
v0.0.1-dev.137 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Snapshot repository — namespaced CRUD over types.Snapshot.

Package repos — StorageClass and Volume repositories.

Volume repository — namespaced CRUD over types.Volume.

Index

Constants

View Source
const TokenSecretPrefix = "rune_"

TokenSecretPrefix is the human-visible prefix on every Rune token secret. It exists so the secrets are easy to spot in the wild (logs, screenshots, terraform output, leaked configs) and so that secret scanners (gitleaks, GitHub secret scanning, etc.) can match on a stable, distinctive marker. The prefix is mandatory: tokens presented without it are rejected at validation time.

Variables

This section is empty.

Functions

func HashSecret

func HashSecret(secret string) string

HashSecret exposes the canonical secret hashing used for token storage so callers outside this package (e.g. the refresh manager) can match a presented secret against stored hashes without re-implementing it.

func MakeAuditRef

func MakeAuditRef(namespace, name string) string

MakeRef returns the canonical "<namespace>/<name>" string used as ResourceRef in audit events. Returns just the name when namespace is empty.

Types

type AlertRuleRepo

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

AlertRuleRepo persists RuneSight alert rules.

func NewAlertRuleRepo

func NewAlertRuleRepo(core store.Store) *AlertRuleRepo

func (*AlertRuleRepo) Delete

func (r *AlertRuleRepo) Delete(ctx context.Context, name string) error

func (*AlertRuleRepo) Get

func (r *AlertRuleRepo) Get(ctx context.Context, name string) (*types.AlertRule, error)

func (*AlertRuleRepo) List

func (r *AlertRuleRepo) List(ctx context.Context) ([]*types.AlertRule, error)

List returns every rule, sorted by name for stable display.

func (*AlertRuleRepo) Save

func (r *AlertRuleRepo) Save(ctx context.Context, rule *types.AlertRule) (*types.AlertRule, error)

Save upserts a rule by name, preserving creation identity on update.

type AuditFilter

type AuditFilter struct {
	Resource    string    // exact match on Resource
	ResourceRef string    // exact match on ResourceRef ("ns/name")
	Namespace   string    // exact match on Namespace
	Actor       string    // exact match on Actor
	Action      string    // exact match on Action
	Since       time.Time // events with Timestamp >= Since
	Until       time.Time // events with Timestamp < Until (zero = no bound)
}

AuditFilter narrows a List query. Zero-value fields are ignored.

type AuditRepo

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

AuditRepo provides append-only persistence and query access for audit events.

Events are stored under the reserved namespace "system" with names of the form "<rfc3339nano-ts>-<uuid>" so that the natural list order from the underlying store is roughly chronological. The id field on the event is the authoritative identifier; the storage name is an implementation detail.

func NewAuditRepo

func NewAuditRepo(core store.Store) *AuditRepo

NewAuditRepo constructs an audit repository backed by the given store.

func (*AuditRepo) Append

func (r *AuditRepo) Append(ctx context.Context, evt *types.AuditEvent) error

Append persists an audit event. ID and Timestamp are populated if unset. Append never errors out the caller's request path on failure; callers should log the error and continue. Returning the error here lets callers decide.

func (*AuditRepo) List

func (r *AuditRepo) List(ctx context.Context, f AuditFilter, limit int) ([]*types.AuditEvent, error)

List returns audit events matching the filter, newest first, capped at limit. A limit of 0 or less applies a default cap of 200.

type BaseRepo

type BaseRepo[T any] struct {
	// contains filtered or unexported fields
}

BaseRepo provides common CRUD over the core store for a specific resource type. T is the typed payload struct (e.g., *types.Service, *types.Secret).

func NewBaseRepo

func NewBaseRepo[T any](core store.Store, rt types.ResourceType) *BaseRepo[T]

func (*BaseRepo[T]) Core

func (r *BaseRepo[T]) Core() store.Store

func (*BaseRepo[T]) Create

func (r *BaseRepo[T]) Create(ctx context.Context, namespace, name string, obj *T) error

func (*BaseRepo[T]) CreateRef

func (r *BaseRepo[T]) CreateRef(ctx context.Context, ref string, obj *T) error

Ref-based helpers

func (*BaseRepo[T]) Delete

func (r *BaseRepo[T]) Delete(ctx context.Context, namespace, name string) error

func (*BaseRepo[T]) DeleteRef

func (r *BaseRepo[T]) DeleteRef(ctx context.Context, ref string) error

func (*BaseRepo[T]) Get

func (r *BaseRepo[T]) Get(ctx context.Context, namespace, name string) (*T, error)

func (*BaseRepo[T]) GetHistory

func (r *BaseRepo[T]) GetHistory(ctx context.Context, ref string) ([]store.HistoricalVersion, error)

func (*BaseRepo[T]) GetRef

func (r *BaseRepo[T]) GetRef(ctx context.Context, ref string) (*T, error)

func (*BaseRepo[T]) GetVersion

func (r *BaseRepo[T]) GetVersion(ctx context.Context, ref string, version string) (*T, error)

func (*BaseRepo[T]) List

func (r *BaseRepo[T]) List(ctx context.Context, namespace string) ([]*T, error)

List returns typed list within a namespace

func (*BaseRepo[T]) Update

func (r *BaseRepo[T]) Update(ctx context.Context, namespace, name string, obj *T, opts ...store.UpdateOption) error

func (*BaseRepo[T]) UpdateRef

func (r *BaseRepo[T]) UpdateRef(ctx context.Context, ref string, obj *T, opts ...store.UpdateOption) error

func (*BaseRepo[T]) Watch

func (r *BaseRepo[T]) Watch(ctx context.Context, namespace string) (<-chan store.WatchEvent, error)

Watch proxies to the core store

type ChannelRepo

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

ChannelRepo persists notification channels.

func NewChannelRepo

func NewChannelRepo(core store.Store) *ChannelRepo

func (*ChannelRepo) Delete

func (r *ChannelRepo) Delete(ctx context.Context, name string) error

func (*ChannelRepo) Get

func (r *ChannelRepo) Get(ctx context.Context, name string) (*types.Channel, error)

func (*ChannelRepo) List

func (r *ChannelRepo) List(ctx context.Context) ([]*types.Channel, error)

List returns every channel, sorted by name.

func (*ChannelRepo) Save

func (r *ChannelRepo) Save(ctx context.Context, c *types.Channel) (*types.Channel, error)

Save upserts a channel by name.

type ConfigOption

type ConfigOption func(*ConfigmapRepo)

func WithConfigLimits

func WithConfigLimits(limits store.Limits) ConfigOption

type ConfigmapRepo

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

func NewConfigRepo

func NewConfigRepo(core store.Store, opts ...ConfigOption) *ConfigmapRepo

func (*ConfigmapRepo) Create

func (r *ConfigmapRepo) Create(ctx context.Context, ref string, c *types.Configmap) error

func (*ConfigmapRepo) Delete

func (r *ConfigmapRepo) Delete(ctx context.Context, namespace, name string) error

func (*ConfigmapRepo) Get

func (r *ConfigmapRepo) Get(ctx context.Context, namespace, name string) (*types.Configmap, error)

func (*ConfigmapRepo) GetVersionN

func (r *ConfigmapRepo) GetVersionN(ctx context.Context, namespace, name string, version int) (*types.Configmap, error)

GetVersionN returns a specific historical version by its user-facing integer Version (not the opaque store version ID).

func (*ConfigmapRepo) List

func (r *ConfigmapRepo) List(ctx context.Context, namespace string) ([]*types.Configmap, error)

List returns configs in a namespace

func (*ConfigmapRepo) ListVersions

func (r *ConfigmapRepo) ListVersions(ctx context.Context, namespace, name string) ([]*types.Configmap, error)

ListVersions returns every historical version of a configmap, newest first. The core store keeps each Update as a distinct version row (the same machinery that backs `rune secret versions`), so this just reads that history — configmaps are plaintext, so no decryption is involved.

func (*ConfigmapRepo) Rollback

func (r *ConfigmapRepo) Rollback(ctx context.Context, namespace, name string, toVersion int, opts ...store.UpdateOption) (*types.Configmap, error)

Rollback rewrites the configmap to the data of a prior version, producing a NEW version (head+1). History is retained.

func (*ConfigmapRepo) Update

func (r *ConfigmapRepo) Update(ctx context.Context, namespace, name string, c *types.Configmap, opts ...store.UpdateOption) error

type InstanceOption

type InstanceOption func(*InstanceRepo)

type InstanceRepo

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

func NewInstanceRepo

func NewInstanceRepo(core store.Store, opts ...InstanceOption) *InstanceRepo

func (*InstanceRepo) Core

func (r *InstanceRepo) Core() store.Store

Core returns the underlying store

func (*InstanceRepo) CountByService

func (r *InstanceRepo) CountByService(ctx context.Context, namespace, serviceID string) (int, error)

CountByService returns the count of instances for a specific service

func (*InstanceRepo) CountByStatus

func (r *InstanceRepo) CountByStatus(ctx context.Context, namespace string, status types.InstanceStatus) (int, error)

CountByStatus returns the count of instances with a specific status

func (*InstanceRepo) Create

func (r *InstanceRepo) Create(ctx context.Context, i *types.Instance) error

Create using fields on instance (no ref required)

func (*InstanceRepo) CreateRef

func (r *InstanceRepo) CreateRef(ctx context.Context, ref string, i *types.Instance) error

func (*InstanceRepo) Delete

func (r *InstanceRepo) Delete(ctx context.Context, ref string) error

func (*InstanceRepo) Get

func (r *InstanceRepo) Get(ctx context.Context, ref string) (*types.Instance, error)

func (*InstanceRepo) GetByInstanceID

func (r *InstanceRepo) GetByInstanceID(ctx context.Context, namespace, instanceID string) (*types.Instance, error)

GetByInstanceID retrieves an instance by its ID (not name)

func (*InstanceRepo) GetByName

func (r *InstanceRepo) GetByName(ctx context.Context, namespace, name string) (*types.Instance, error)

GetByName retrieves an instance by name and namespace

func (*InstanceRepo) GetHistory

func (r *InstanceRepo) GetHistory(ctx context.Context, ref string) ([]store.HistoricalVersion, error)

GetHistory returns version history for an instance

func (*InstanceRepo) GetServiceInstances

func (r *InstanceRepo) GetServiceInstances(ctx context.Context, serviceID string) ([]*types.Instance, error)

GetServiceInstances returns all instances for a service across all namespaces

func (*InstanceRepo) GetVersion

func (r *InstanceRepo) GetVersion(ctx context.Context, ref string, version string) (*types.Instance, error)

GetVersion returns a specific version of an instance

func (*InstanceRepo) IncrementRestartCount

func (r *InstanceRepo) IncrementRestartCount(ctx context.Context, ref string) error

IncrementRestartCount increments the restart count for an instance

func (*InstanceRepo) List

func (r *InstanceRepo) List(ctx context.Context, namespace string) ([]*types.Instance, error)

func (*InstanceRepo) ListByNode

func (r *InstanceRepo) ListByNode(ctx context.Context, namespace, nodeID string) ([]*types.Instance, error)

ListByNode returns all instances running on a specific node

func (*InstanceRepo) ListByService

func (r *InstanceRepo) ListByService(ctx context.Context, namespace, serviceID string) ([]*types.Instance, error)

ListByService returns all instances belonging to a specific service

func (*InstanceRepo) ListByServiceName

func (r *InstanceRepo) ListByServiceName(ctx context.Context, namespace, serviceName string) ([]*types.Instance, error)

ListByServiceName returns all instances belonging to a service by name

func (*InstanceRepo) ListByStatus

func (r *InstanceRepo) ListByStatus(ctx context.Context, namespace string, status types.InstanceStatus) ([]*types.Instance, error)

ListByStatus returns instances with the given status

func (*InstanceRepo) ListFailed

func (r *InstanceRepo) ListFailed(ctx context.Context, namespace string) ([]*types.Instance, error)

ListFailed returns all failed instances in a namespace

func (*InstanceRepo) ListPending

func (r *InstanceRepo) ListPending(ctx context.Context, namespace string) ([]*types.Instance, error)

ListPending returns all pending instances in a namespace

func (*InstanceRepo) ListRunning

func (r *InstanceRepo) ListRunning(ctx context.Context, namespace string) ([]*types.Instance, error)

ListRunning returns all running instances in a namespace

func (*InstanceRepo) MarkForDeletion

func (r *InstanceRepo) MarkForDeletion(ctx context.Context, ref string) error

MarkForDeletion marks an instance for deletion

func (*InstanceRepo) Update

func (r *InstanceRepo) Update(ctx context.Context, ref string, i *types.Instance, opts ...store.UpdateOption) error

func (*InstanceRepo) UpdateContainerID

func (r *InstanceRepo) UpdateContainerID(ctx context.Context, ref string, containerID string) error

UpdateContainerID updates only the container ID of an instance

func (*InstanceRepo) UpdateIP

func (r *InstanceRepo) UpdateIP(ctx context.Context, ref string, ip string) error

UpdateIP updates only the IP address of an instance

func (*InstanceRepo) UpdatePID

func (r *InstanceRepo) UpdatePID(ctx context.Context, ref string, pid int) error

UpdatePID updates only the process ID of an instance

func (*InstanceRepo) UpdateStatus

func (r *InstanceRepo) UpdateStatus(ctx context.Context, ref string, status types.InstanceStatus, statusMessage string) error

UpdateStatus updates only the status of an instance

func (*InstanceRepo) Watch

func (r *InstanceRepo) Watch(ctx context.Context, namespace string) (<-chan store.WatchEvent, error)

Watch proxies to the base store

type NamespaceOption

type NamespaceOption func(*NamespaceRepo)

type NamespaceRepo

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

func NewNamespaceRepo

func NewNamespaceRepo(core store.Store, opts ...NamespaceOption) *NamespaceRepo

func (*NamespaceRepo) BootstrapDefaultNamespaces

func (r *NamespaceRepo) BootstrapDefaultNamespaces(ctx context.Context) error

BootstrapDefaultNamespaces creates the default and system namespaces if they don't exist

func (*NamespaceRepo) Create

func (r *NamespaceRepo) Create(ctx context.Context, ns *types.Namespace) error

Create creates a new namespace

func (*NamespaceRepo) CreateBuiltIns

func (r *NamespaceRepo) CreateBuiltIns(ctx context.Context, ns *types.Namespace) error

CreateBuiltIns creates a new namespace

func (*NamespaceRepo) Delete

func (r *NamespaceRepo) Delete(ctx context.Context, name string) error

Delete removes a namespace

func (*NamespaceRepo) Exists

func (r *NamespaceRepo) Exists(ctx context.Context, name string) (bool, error)

Exists checks if a namespace exists

func (*NamespaceRepo) Get

func (r *NamespaceRepo) Get(ctx context.Context, name string) (*types.Namespace, error)

Get retrieves a namespace by name

func (*NamespaceRepo) List

func (r *NamespaceRepo) List(ctx context.Context) ([]*types.Namespace, error)

List returns all namespaces

func (*NamespaceRepo) Update

func (r *NamespaceRepo) Update(ctx context.Context, ns *types.Namespace) error

Update updates an existing namespace

func (*NamespaceRepo) Watch

func (r *NamespaceRepo) Watch(ctx context.Context) (<-chan store.WatchEvent, error)

Watch watches for namespace changes

type PolicyRepo

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

func NewPolicyRepo

func NewPolicyRepo(st store.Store) *PolicyRepo

func (*PolicyRepo) Create

func (r *PolicyRepo) Create(ctx context.Context, p *types.Policy) error

func (*PolicyRepo) Delete

func (r *PolicyRepo) Delete(ctx context.Context, name string) error

func (*PolicyRepo) Get

func (r *PolicyRepo) Get(ctx context.Context, name string) (*types.Policy, error)

func (*PolicyRepo) List

func (r *PolicyRepo) List(ctx context.Context) ([]types.Policy, error)

func (*PolicyRepo) Update

func (r *PolicyRepo) Update(ctx context.Context, p *types.Policy) error

type ReleaseRepo

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

ReleaseRepo persists stateful runeset releases (RUNESET_STATEFUL_RELEASES.md). A release is the tracked, revisioned record of what a `rune cast` installed.

func NewReleaseRepo

func NewReleaseRepo(core store.Store) *ReleaseRepo

func (*ReleaseRepo) Core

func (r *ReleaseRepo) Core() store.Store

Core returns the underlying store.

func (*ReleaseRepo) Create

func (r *ReleaseRepo) Create(ctx context.Context, rel *types.Release) error

Create persists a new release record. Callers (the cast reconcile loop) supply Name/Namespace and the planned Owns set; this sets timestamps and sensible defaults.

func (*ReleaseRepo) Delete

func (r *ReleaseRepo) Delete(ctx context.Context, namespace, name string) error

Delete hard-removes the release record (used by `--purge`; soft uninstall instead sets Status=uninstalled via SetStatus — Decision D4).

func (*ReleaseRepo) Get

func (r *ReleaseRepo) Get(ctx context.Context, ref string) (*types.Release, error)

Get retrieves a release by resource ref (e.g. "release:name.namespace.rune").

func (*ReleaseRepo) GetByName

func (r *ReleaseRepo) GetByName(ctx context.Context, namespace, name string) (*types.Release, error)

GetByName retrieves a release by name within a namespace.

func (*ReleaseRepo) GetVersion

func (r *ReleaseRepo) GetVersion(ctx context.Context, ref, version string) (*types.Release, error)

GetVersion returns a specific historical revision of a release.

func (*ReleaseRepo) History

func (r *ReleaseRepo) History(ctx context.Context, ref string) ([]store.HistoricalVersion, error)

History returns the revision history of a release for rollback/diff.

func (*ReleaseRepo) List

func (r *ReleaseRepo) List(ctx context.Context, namespace string) ([]*types.Release, error)

List returns releases within a namespace.

func (*ReleaseRepo) ListAll

func (r *ReleaseRepo) ListAll(ctx context.Context) ([]*types.Release, error)

ListAll returns releases across all namespaces (for `rune release list`).

func (*ReleaseRepo) SetStatus

func (r *ReleaseRepo) SetStatus(ctx context.Context, namespace, name string, status types.ReleaseStatus) error

SetStatus updates only the status of a release.

func (*ReleaseRepo) Update

func (r *ReleaseRepo) Update(ctx context.Context, rel *types.Release, opts ...store.UpdateOption) error

Update persists changes to an existing release, refreshing UpdatedAt. Revision is owned by the reconcile loop, not bumped here.

func (*ReleaseRepo) Watch

func (r *ReleaseRepo) Watch(ctx context.Context, namespace string) (<-chan store.WatchEvent, error)

Watch proxies to the base store.

type SavedViewRepo

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

SavedViewRepo persists RuneSight saved views (named Log Explorer queries).

func NewSavedViewRepo

func NewSavedViewRepo(core store.Store) *SavedViewRepo

func (*SavedViewRepo) Delete

func (r *SavedViewRepo) Delete(ctx context.Context, name string) error

func (*SavedViewRepo) Get

func (r *SavedViewRepo) Get(ctx context.Context, name string) (*types.SavedView, error)

func (*SavedViewRepo) List

func (r *SavedViewRepo) List(ctx context.Context) ([]*types.SavedView, error)

List returns every saved view, pinned first, then newest-updated first.

func (*SavedViewRepo) Save

Save upserts a view by name: create when absent, update (preserving CreatedAt/CreatedBy) when present. The dashboard's "Save view" is an upsert — re-saving an existing name updates the query rather than erroring.

type SecretOption

type SecretOption func(*SecretRepo)

func WithKEKBytes

func WithKEKBytes(key []byte) SecretOption

func WithKEKOptions

func WithKEKOptions(opts *crypto.KEKOptions) SecretOption

func WithSecretLimits

func WithSecretLimits(limits store.Limits) SecretOption

type SecretRepo

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

func NewSecretRepo

func NewSecretRepo(core store.Store, opts ...SecretOption) *SecretRepo

func (*SecretRepo) Create

func (r *SecretRepo) Create(ctx context.Context, s *types.Secret) error

Create using fields on secret (no ref required)

func (*SecretRepo) CreateRef

func (r *SecretRepo) CreateRef(ctx context.Context, ref string, s *types.Secret) error

func (*SecretRepo) Delete

func (r *SecretRepo) Delete(ctx context.Context, namespace, name string) error

func (*SecretRepo) Get

func (r *SecretRepo) Get(ctx context.Context, namespace, name string) (*types.Secret, error)

func (*SecretRepo) GetVersionN

func (r *SecretRepo) GetVersionN(ctx context.Context, namespace, name string, version int) (*types.Secret, error)

GetVersionN returns a specific historical version of a secret. The version numbers are the monotonically-increasing user-facing integers carried on types.Secret.Version, NOT the opaque store version IDs.

func (*SecretRepo) List

func (r *SecretRepo) List(ctx context.Context, namespace string) ([]*types.Secret, error)

func (*SecretRepo) ListVersions

func (r *SecretRepo) ListVersions(ctx context.Context, namespace, name string) ([]*types.Secret, error)

ListVersions returns every historical version of a secret, decrypted, in descending Version order. Useful for `rune secret versions`.

The underlying store keeps every Update as a distinct version row so this includes plaintext data for each one — callers must therefore gate access behind the secrets:reveal verb if they expose Data downstream.

func (*SecretRepo) Rollback

func (r *SecretRepo) Rollback(ctx context.Context, namespace, name string, toVersion int, opts ...store.UpdateOption) (*types.Secret, error)

Rollback rewrites the secret to the contents of a prior version, producing a NEW version (head+1). The old versions are retained in history. Returns the freshly-written secret on success.

func (*SecretRepo) Update

func (r *SecretRepo) Update(ctx context.Context, namespace, name string, s *types.Secret, opts ...store.UpdateOption) error

type ServiceOption

type ServiceOption func(*ServiceRepo)

type ServiceRepo

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

func NewServiceRepo

func NewServiceRepo(core store.Store, opts ...ServiceOption) *ServiceRepo

func (*ServiceRepo) Core

func (r *ServiceRepo) Core() store.Store

Core returns the underlying store

func (*ServiceRepo) Create

func (r *ServiceRepo) Create(ctx context.Context, s *types.Service) error

Create using fields on service (no ref required)

func (*ServiceRepo) CreateRef

func (r *ServiceRepo) CreateRef(ctx context.Context, ref string, s *types.Service) error

func (*ServiceRepo) Delete

func (r *ServiceRepo) Delete(ctx context.Context, ref string) error

func (*ServiceRepo) Get

func (r *ServiceRepo) Get(ctx context.Context, ref string) (*types.Service, error)

func (*ServiceRepo) GetByName

func (r *ServiceRepo) GetByName(ctx context.Context, namespace, name string) (*types.Service, error)

GetByName retrieves a service by name and namespace

func (*ServiceRepo) GetByServiceID

func (r *ServiceRepo) GetByServiceID(ctx context.Context, namespace, serviceID string) (*types.Service, error)

GetByServiceID retrieves a service by its ID (not name)

func (*ServiceRepo) GetDependents

func (r *ServiceRepo) GetDependents(ctx context.Context, ref string) ([]*types.Service, error)

GetDependents returns all services that depend on the given service

func (*ServiceRepo) GetHistory

func (r *ServiceRepo) GetHistory(ctx context.Context, ref string) ([]store.HistoricalVersion, error)

GetHistory returns version history for a service

func (*ServiceRepo) GetVersion

func (r *ServiceRepo) GetVersion(ctx context.Context, ref string, version string) (*types.Service, error)

GetVersion returns a specific version of a service

func (*ServiceRepo) List

func (r *ServiceRepo) List(ctx context.Context, namespace string) ([]*types.Service, error)

func (*ServiceRepo) ListByLabelSelector

func (r *ServiceRepo) ListByLabelSelector(ctx context.Context, namespace string, selector map[string]string) ([]*types.Service, error)

ListByLabelSelector returns services matching the given label selector

func (*ServiceRepo) ListByStatus

func (r *ServiceRepo) ListByStatus(ctx context.Context, namespace string, status types.ServiceStatus) ([]*types.Service, error)

ListByStatus returns services with the given status

func (*ServiceRepo) Update

func (r *ServiceRepo) Update(ctx context.Context, ref string, s *types.Service, opts ...store.UpdateOption) error

func (*ServiceRepo) UpdateScale

func (r *ServiceRepo) UpdateScale(ctx context.Context, ref string, scale int) error

UpdateScale updates only the scale of a service

func (*ServiceRepo) UpdateStatus

func (r *ServiceRepo) UpdateStatus(ctx context.Context, ref string, status types.ServiceStatus) error

UpdateStatus updates only the status of a service

func (*ServiceRepo) UpdateStatusByName

func (r *ServiceRepo) UpdateStatusByName(ctx context.Context, namespace, name string, status types.ServiceStatus) error

UpdateStatusByName updates only the status of a service by name and namespace

func (*ServiceRepo) Watch

func (r *ServiceRepo) Watch(ctx context.Context, namespace string) (<-chan store.WatchEvent, error)

Watch proxies to the base store

type SnapshotRepo

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

SnapshotRepo provides CRUD over Snapshot resources.

func NewSnapshotRepo

func NewSnapshotRepo(core store.Store) *SnapshotRepo

NewSnapshotRepo constructs a SnapshotRepo.

func (*SnapshotRepo) Create

func (r *SnapshotRepo) Create(ctx context.Context, s *types.Snapshot) error

Create writes a new Snapshot row, populating ID, timestamps, and a default Pending phase if the caller did not supply one.

func (*SnapshotRepo) Delete

func (r *SnapshotRepo) Delete(ctx context.Context, namespace, name string) error

Delete removes a Snapshot row. The orchestrator's SnapshotController watches for the resulting DELETED event and runs the per-driver reclaim path.

func (*SnapshotRepo) Get

func (r *SnapshotRepo) Get(ctx context.Context, namespace, name string) (*types.Snapshot, error)

Get retrieves a Snapshot by namespace and name.

func (*SnapshotRepo) List

func (r *SnapshotRepo) List(ctx context.Context, namespace string) ([]*types.Snapshot, error)

List returns every Snapshot in the given namespace.

func (*SnapshotRepo) ListAll

func (r *SnapshotRepo) ListAll(ctx context.Context) ([]*types.Snapshot, error)

ListAll returns every Snapshot across every namespace. Mirrors VolumeRepo.ListAll: enumerates via NamespaceRepo + per-namespace List so it works on backends that don't support cross-namespace listing.

func (*SnapshotRepo) Update

func (r *SnapshotRepo) Update(ctx context.Context, s *types.Snapshot, opts ...store.UpdateOption) error

Update writes an updated Snapshot, preserving CreatedAt/ID and refreshing UpdatedAt.

type StorageClassRepo

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

StorageClassRepo provides CRUD over StorageClass resources.

func NewStorageClassRepo

func NewStorageClassRepo(core store.Store) *StorageClassRepo

NewStorageClassRepo constructs a StorageClassRepo.

func (*StorageClassRepo) Create

Create writes a new StorageClass row, populating ID and timestamps.

func (*StorageClassRepo) Delete

func (r *StorageClassRepo) Delete(ctx context.Context, name string) error

Delete removes a StorageClass.

func (*StorageClassRepo) Get

Get retrieves a StorageClass by name.

func (*StorageClassRepo) List

List returns every StorageClass.

func (*StorageClassRepo) Update

Update writes an updated StorageClass, refreshing UpdatedAt and preserving CreatedAt from the existing row.

type TokenRepo

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

func NewTokenRepo

func NewTokenRepo(st store.Store) *TokenRepo

func (*TokenRepo) Delete

func (r *TokenRepo) Delete(ctx context.Context, id string) error

Delete removes a token row outright (used by access-token GC).

func (*TokenRepo) DeleteExpiredTokens

func (r *TokenRepo) DeleteExpiredTokens(ctx context.Context, now time.Time) (int, error)

DeleteExpiredTokens evicts any token whose expiry has passed as of `now`, regardless of kind (short-lived access tokens, unused refresh grants that were never rotated forward, and static tokens issued with a TTL). Tokens with no expiry (ExpiresAt == nil) are kept. Returns the number deleted. Revoked rows are intentionally retained for audit (`token list` shows revoked=true).

func (*TokenRepo) FindRefreshGrant

func (r *TokenRepo) FindRefreshGrant(ctx context.Context, secret string) (*types.Token, error)

FindRefreshGrant validates a token presented to the refresh endpoint. It requires refresh-kind; anything else (access/static) is rejected.

func (*TokenRepo) FindRefreshGrantByPrevHash

func (r *TokenRepo) FindRefreshGrantByPrevHash(ctx context.Context, secret string) (*types.Token, error)

FindRefreshGrantByPrevHash finds a (non-revoked) refresh grant whose PrevSecretHash matches h. Used to detect genuinely stale reuse of an already-rotated refresh secret — i.e. theft, past the grace window.

func (*TokenRepo) FindRequestBearer

func (r *TokenRepo) FindRequestBearer(ctx context.Context, secret string) (*types.Token, error)

FindRequestBearer validates a token presented as a request bearer. It rejects refresh-kind tokens — they are never valid bearers (RUNE-201). All request-authentication paths (gRPC authFunc, dashboard ui middleware, exec WS, WhoAmI) MUST use this, never lookupBySecret directly.

func (*TokenRepo) Get

func (r *TokenRepo) Get(ctx context.Context, id string) (*types.Token, error)

func (*TokenRepo) IssueAccess

func (r *TokenRepo) IssueAccess(ctx context.Context, subjectID, subjectType string, ttl time.Duration) (*types.Token, string, error)

IssueAccess mints a short-lived access token (RUNE-201). Accepted as a request bearer; expires after ttl.

func (*TokenRepo) IssueRefreshGrant

func (r *TokenRepo) IssueRefreshGrant(ctx context.Context, name, subjectID, subjectType string, ttl time.Duration) (*types.Token, string, error)

IssueRefreshGrant mints a long-lived refresh grant (RUNE-201). It is NEVER a valid request bearer — only the refresh endpoint accepts it. ttl is the sliding idle window; 0 means no expiry (discouraged for humans).

func (*TokenRepo) IssueStatic

func (r *TokenRepo) IssueStatic(ctx context.Context, name, subjectID, subjectType string, desc string, ttl time.Duration) (*types.Token, string, error)

IssueStatic creates a new long-lived (static) token with a freshly generated secret. Returns the plaintext secret once. Static tokens are full bearers and are not subject to RUNE-201 refresh; service accounts, CI (`cast`), and the bootstrap/break-glass root token use this path.

func (*TokenRepo) List

func (r *TokenRepo) List(ctx context.Context) ([]types.Token, error)

func (*TokenRepo) Revoke

func (r *TokenRepo) Revoke(ctx context.Context, id string) error

func (*TokenRepo) RotateGrantSecret

func (r *TokenRepo) RotateGrantSecret(ctx context.Context, grant *types.Token, slidingTTL time.Duration) (string, error)

RotateGrantSecret mints a fresh secret for an existing refresh grant: the current secret hash is preserved as PrevSecretHash (for post-grace theft detection), the new hash is stored, LastUsedAt is stamped, and the sliding idle expiry is extended by slidingTTL (0 = leave expiry unchanged). Returns the new plaintext secret once.

func (*TokenRepo) Update

func (r *TokenRepo) Update(ctx context.Context, t *types.Token) error

Update persists changes to an existing token (e.g. refresh-grant rotation).

type UserRepo

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

func NewUserRepo

func NewUserRepo(st store.Store) *UserRepo

func (*UserRepo) Create

func (r *UserRepo) Create(ctx context.Context, u *types.User) (*types.User, error)

func (*UserRepo) Delete

func (r *UserRepo) Delete(ctx context.Context, id string) error

func (*UserRepo) Get

func (r *UserRepo) Get(ctx context.Context, id string) (*types.User, error)

func (*UserRepo) GetByName

func (r *UserRepo) GetByName(ctx context.Context, name string) (*types.User, error)

func (*UserRepo) GetByNameOrID

func (r *UserRepo) GetByNameOrID(ctx context.Context, nameOrID string) (*types.User, error)

func (*UserRepo) List

func (r *UserRepo) List(ctx context.Context) ([]*types.User, error)

func (*UserRepo) Update

func (r *UserRepo) Update(ctx context.Context, u *types.User) error

type VolumeRepo

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

VolumeRepo provides CRUD over Volume resources.

func NewVolumeRepo

func NewVolumeRepo(core store.Store) *VolumeRepo

NewVolumeRepo constructs a VolumeRepo.

func (*VolumeRepo) Create

func (r *VolumeRepo) Create(ctx context.Context, v *types.Volume) error

Create writes a new Volume row, populating ID, timestamps, and a default Pending status if the caller did not supply one.

func (*VolumeRepo) Delete

func (r *VolumeRepo) Delete(ctx context.Context, namespace, name string) error

Delete removes a Volume row. The orchestrator's VolumeController watches for the resulting DELETED event and runs the per-driver reclaim path.

func (*VolumeRepo) Get

func (r *VolumeRepo) Get(ctx context.Context, namespace, name string) (*types.Volume, error)

Get retrieves a Volume by namespace and name.

func (*VolumeRepo) List

func (r *VolumeRepo) List(ctx context.Context, namespace string) ([]*types.Volume, error)

List returns every Volume in the given namespace.

func (*VolumeRepo) ListAll

func (r *VolumeRepo) ListAll(ctx context.Context) ([]*types.Volume, error)

ListAll returns every Volume across every namespace. This is the cross-namespace projection used by cluster-scoped operations like the StorageClass cascade-delete safety check.

We deliberately enumerate via NamespaceRepo + per-namespace List rather than the underlying store.ListAll, because the in-memory test stores do not implement true cross-namespace listing — they treat the empty namespace as a literal key. Going through the namespace list keeps this correct on every backend.

func (*VolumeRepo) Update

func (r *VolumeRepo) Update(ctx context.Context, v *types.Volume, opts ...store.UpdateOption) error

Update writes an updated Volume, preserving CreatedAt/ID and refreshing UpdatedAt.

Jump to

Keyboard shortcuts

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