repos

package
v0.0.1-dev.13 Latest Latest
Warning

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

Go to latest
Published: May 7, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

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 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) List

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

List returns configs in a namespace

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 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) List

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

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 TokenRepo

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

func NewTokenRepo

func NewTokenRepo(st store.Store) *TokenRepo

func (*TokenRepo) FindBySecret

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

FindBySecret tries to locate and validate a token by comparing the hash.

func (*TokenRepo) Get

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

func (*TokenRepo) Issue

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

Issue creates a new token with a freshly generated secret. Returns the plaintext secret once.

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

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

Jump to

Keyboard shortcuts

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