mongo

package
v1.5.4 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2026 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Overview

Package mongo implements store.Store using the Grove ORM with mongodriver.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Store

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

Store implements store.Store using MongoDB via Grove ORM.

func New

func New(db *grove.DB) *Store

New creates a new MongoDB store backed by Grove ORM.

func (*Store) Close

func (s *Store) Close() error

Close closes the database connection.

func (*Store) CountByTenant

func (s *Store) CountByTenant(ctx context.Context, tenantID string) (int, error)

func (*Store) CountDatacentersByTenant added in v1.3.0

func (s *Store) CountDatacentersByTenant(ctx context.Context, tenantID string) (int, error)

CountDatacentersByTenant returns the total number of datacenters for a tenant.

func (*Store) CountDomainsByTenant

func (s *Store) CountDomainsByTenant(ctx context.Context, tenantID string) (int, error)

func (*Store) CountInstancesByDatacenter added in v1.3.0

func (s *Store) CountInstancesByDatacenter(ctx context.Context, tenantID string, datacenterID id.ID) (int, error)

CountInstancesByDatacenter returns the number of instances linked to a datacenter.

func (*Store) CountSecretsByTenant

func (s *Store) CountSecretsByTenant(ctx context.Context, tenantID string) (int, error)

func (*Store) CountTenants

func (s *Store) CountTenants(ctx context.Context) (int, error)

func (*Store) CountTenantsByStatus

func (s *Store) CountTenantsByStatus(ctx context.Context, status admin.TenantStatus) (int, error)

func (*Store) DB added in v0.1.0

func (s *Store) DB() *grove.DB

DB returns the underlying grove database for direct access.

func (*Store) Delete

func (s *Store) Delete(ctx context.Context, tenantID string, instanceID id.ID) error

func (*Store) DeleteBootstrap added in v1.5.1

func (s *Store) DeleteBootstrap(ctx context.Context, bootstrapID id.ID) error

DeleteBootstrap removes a row.

func (*Store) DeleteCertificate

func (s *Store) DeleteCertificate(ctx context.Context, tenantID string, certID id.ID) error

func (*Store) DeleteCheck

func (s *Store) DeleteCheck(ctx context.Context, tenantID string, checkID id.ID) error

func (*Store) DeleteDatacenter added in v1.3.0

func (s *Store) DeleteDatacenter(ctx context.Context, tenantID string, datacenterID id.ID) error

DeleteDatacenter removes a datacenter from the store.

func (*Store) DeleteDomain

func (s *Store) DeleteDomain(ctx context.Context, tenantID string, domainID id.ID) error

func (*Store) DeleteRoute

func (s *Store) DeleteRoute(ctx context.Context, tenantID string, routeID id.ID) error

func (*Store) DeleteSecret

func (s *Store) DeleteSecret(ctx context.Context, tenantID string, instanceID id.ID, key string) error

func (*Store) DeleteTemplate added in v1.3.0

func (s *Store) DeleteTemplate(ctx context.Context, tenantID string, templateID id.ID) error

DeleteTemplate removes a template.

func (*Store) DeleteTenant

func (s *Store) DeleteTenant(ctx context.Context, tenantID string) error

func (*Store) DeleteWorkload added in v1.5.1

func (s *Store) DeleteWorkload(ctx context.Context, tenantID string, workloadID id.ID) error

DeleteWorkload removes a workload row. Replica Instances are not touched here — workload.Service.Delete handles cascade by calling instance.Service.Delete first.

func (*Store) GetBootstrap added in v1.5.1

func (s *Store) GetBootstrap(ctx context.Context, bootstrapID id.ID) (*bootstrap.BootstrapWorkload, error)

GetBootstrap retrieves a bootstrap workload by ID.

func (*Store) GetBootstrapByName added in v1.5.1

func (s *Store) GetBootstrapByName(ctx context.Context, datacenterID id.ID, name string) (*bootstrap.BootstrapWorkload, error)

GetBootstrapByName retrieves the row whose (DatacenterID, Name) pair matches.

func (*Store) GetByID

func (s *Store) GetByID(ctx context.Context, tenantID string, instanceID id.ID) (*instance.Instance, error)

func (*Store) GetBySlug

func (s *Store) GetBySlug(ctx context.Context, tenantID string, slug string) (*instance.Instance, error)

func (*Store) GetCertificate

func (s *Store) GetCertificate(ctx context.Context, tenantID string, certID id.ID) (*network.Certificate, error)

func (*Store) GetCheck

func (s *Store) GetCheck(ctx context.Context, tenantID string, checkID id.ID) (*health.HealthCheck, error)

func (*Store) GetDatacenterByID added in v1.3.0

func (s *Store) GetDatacenterByID(ctx context.Context, tenantID string, datacenterID id.ID) (*datacenter.Datacenter, error)

GetDatacenterByID retrieves a datacenter by ID. Returns the DC when it belongs to tenantID OR when it's platform-shared (tenant_id="").

func (*Store) GetDatacenterBySlug added in v1.3.0

func (s *Store) GetDatacenterBySlug(ctx context.Context, tenantID string, slug string) (*datacenter.Datacenter, error)

GetDatacenterBySlug retrieves a datacenter by slug. Tenant-scoped hits take precedence over platform-shared ones with the same slug (we sort tenant-owned first via a synthetic order field).

func (*Store) GetDeployment

func (s *Store) GetDeployment(ctx context.Context, tenantID string, deployID id.ID) (*deploy.Deployment, error)

func (*Store) GetDomain

func (s *Store) GetDomain(ctx context.Context, tenantID string, domainID id.ID) (*network.Domain, error)

func (*Store) GetDomainByHostname

func (s *Store) GetDomainByHostname(ctx context.Context, hostname string) (*network.Domain, error)

func (*Store) GetLatestResourceSnapshot

func (s *Store) GetLatestResourceSnapshot(ctx context.Context, tenantID string, instanceID id.ID) (*telemetry.ResourceSnapshot, error)

func (*Store) GetLatestResult

func (s *Store) GetLatestResult(ctx context.Context, tenantID string, checkID id.ID) (*health.HealthResult, error)

func (*Store) GetRelease

func (s *Store) GetRelease(ctx context.Context, tenantID string, releaseID id.ID) (*deploy.Release, error)

func (*Store) GetRoute

func (s *Store) GetRoute(ctx context.Context, tenantID string, routeID id.ID) (*network.Route, error)

func (*Store) GetSecretByKey

func (s *Store) GetSecretByKey(ctx context.Context, tenantID string, instanceID id.ID, key string) (*secrets.Secret, error)

func (*Store) GetTemplate added in v1.3.0

func (s *Store) GetTemplate(ctx context.Context, tenantID string, templateID id.ID) (*template.Template, error)

GetTemplate retrieves a workload template by ID within a tenant.

func (*Store) GetTenant

func (s *Store) GetTenant(ctx context.Context, tenantID string) (*admin.Tenant, error)

func (*Store) GetTenantByExternalID added in v1.5.1

func (s *Store) GetTenantByExternalID(ctx context.Context, externalID string) (*admin.Tenant, error)

func (*Store) GetTenantBySlug

func (s *Store) GetTenantBySlug(ctx context.Context, slug string) (*admin.Tenant, error)

func (*Store) GetWorkloadByID added in v1.5.1

func (s *Store) GetWorkloadByID(ctx context.Context, tenantID string, workloadID id.ID) (*workload.Workload, error)

GetWorkloadByID returns a workload by ID. Empty tenantID is the cross-tenant convention used by admin views.

func (*Store) GetWorkloadBySlug added in v1.5.1

func (s *Store) GetWorkloadBySlug(ctx context.Context, tenantID, slug string) (*workload.Workload, error)

GetWorkloadBySlug returns a workload by URL-safe slug within the tenant.

func (*Store) Insert

func (s *Store) Insert(ctx context.Context, inst *instance.Instance) error

func (*Store) InsertAuditEntry

func (s *Store) InsertAuditEntry(ctx context.Context, entry *admin.AuditEntry) error

func (*Store) InsertBootstrap added in v1.5.1

func (s *Store) InsertBootstrap(ctx context.Context, bw *bootstrap.BootstrapWorkload) error

InsertBootstrap persists a new bootstrap workload row.

func (*Store) InsertCertificate

func (s *Store) InsertCertificate(ctx context.Context, cert *network.Certificate) error

func (*Store) InsertCheck

func (s *Store) InsertCheck(ctx context.Context, check *health.HealthCheck) error

func (*Store) InsertDatacenter added in v1.3.0

func (s *Store) InsertDatacenter(ctx context.Context, dc *datacenter.Datacenter) error

InsertDatacenter persists a new datacenter.

func (*Store) InsertDeployment

func (s *Store) InsertDeployment(ctx context.Context, d *deploy.Deployment) error

func (*Store) InsertDomain

func (s *Store) InsertDomain(ctx context.Context, domain *network.Domain) error

func (*Store) InsertLogs

func (s *Store) InsertLogs(ctx context.Context, logs []telemetry.LogEntry) error

func (*Store) InsertMetrics

func (s *Store) InsertMetrics(ctx context.Context, metrics []telemetry.Metric) error

func (*Store) InsertRelease

func (s *Store) InsertRelease(ctx context.Context, r *deploy.Release) error

func (*Store) InsertResourceSnapshot

func (s *Store) InsertResourceSnapshot(ctx context.Context, snap *telemetry.ResourceSnapshot) error

func (*Store) InsertResult

func (s *Store) InsertResult(ctx context.Context, result *health.HealthResult) error

func (*Store) InsertRoute

func (s *Store) InsertRoute(ctx context.Context, route *network.Route) error

func (*Store) InsertSecret

func (s *Store) InsertSecret(ctx context.Context, secret *secrets.Secret) error

func (*Store) InsertTemplate added in v1.3.0

func (s *Store) InsertTemplate(ctx context.Context, t *template.Template) error

InsertTemplate persists a new workload template.

func (*Store) InsertTenant

func (s *Store) InsertTenant(ctx context.Context, tenant *admin.Tenant) error

func (*Store) InsertTraces

func (s *Store) InsertTraces(ctx context.Context, traces []telemetry.Trace) error

func (*Store) InsertWorkload added in v1.5.1

func (s *Store) InsertWorkload(ctx context.Context, w *workload.Workload) error

InsertWorkload persists a Workload.

func (*Store) List

func (s *Store) List(ctx context.Context, tenantID string, opts instance.ListOptions) (*instance.ListResult, error)

func (*Store) ListBootstraps added in v1.5.1

func (s *Store) ListBootstraps(ctx context.Context, datacenterID id.ID) ([]*bootstrap.BootstrapWorkload, error)

ListBootstraps returns every bootstrap workload attached to the given datacenter, ordered by created_at for stable iteration.

func (*Store) ListCertificates

func (s *Store) ListCertificates(ctx context.Context, tenantID string, instanceID id.ID) ([]network.Certificate, error)

func (*Store) ListChecks

func (s *Store) ListChecks(ctx context.Context, tenantID string, instanceID id.ID) ([]health.HealthCheck, error)

func (*Store) ListDatacenters added in v1.3.0

func (s *Store) ListDatacenters(ctx context.Context, tenantID string, opts datacenter.ListOptions) (*datacenter.ListResult, error)

ListDatacenters returns datacenters visible to tenantID — both tenant-owned and platform-shared (tenant_id="").

func (*Store) ListDeployments

func (s *Store) ListDeployments(ctx context.Context, tenantID string, instanceID id.ID, opts deploy.ListOptions) (*deploy.DeployListResult, error)

func (*Store) ListDomains

func (s *Store) ListDomains(ctx context.Context, tenantID string, instanceID id.ID) ([]network.Domain, error)

func (*Store) ListReleases

func (s *Store) ListReleases(ctx context.Context, tenantID string, instanceID id.ID, opts deploy.ListOptions) (*deploy.ReleaseListResult, error)

func (*Store) ListResourceSnapshots

func (s *Store) ListResourceSnapshots(ctx context.Context, tenantID string, instanceID id.ID, opts telemetry.TimeRange) ([]telemetry.ResourceSnapshot, error)

func (*Store) ListResults

func (s *Store) ListResults(ctx context.Context, tenantID string, checkID id.ID, opts health.HistoryOptions) ([]health.HealthResult, error)

func (*Store) ListRoutes

func (s *Store) ListRoutes(ctx context.Context, tenantID string, instanceID id.ID) ([]network.Route, error)

func (*Store) ListSecrets

func (s *Store) ListSecrets(ctx context.Context, tenantID string, instanceID id.ID) ([]secrets.Secret, error)

func (*Store) ListTemplates added in v1.3.0

func (s *Store) ListTemplates(ctx context.Context, tenantID string, opts template.ListOptions) (*template.ListResult, error)

ListTemplates returns a paginated list of templates for a tenant.

func (*Store) ListTenants

func (s *Store) ListTenants(ctx context.Context, opts admin.ListTenantsOptions) (*admin.TenantListResult, error)

func (*Store) ListWorkloads added in v1.5.1

func (s *Store) ListWorkloads(ctx context.Context, tenantID string, opts workload.ListOptions) (*workload.ListResult, error)

ListWorkloads returns workloads matching the filter. Empty tenantID = cross-tenant view.

func (*Store) Migrate

func (s *Store) Migrate(ctx context.Context) error

Migrate creates indexes for all controlplane collections.

func (*Store) NextReleaseVersion

func (s *Store) NextReleaseVersion(ctx context.Context, tenantID string, instanceID id.ID) (int, error)

func (*Store) Ping

func (s *Store) Ping(ctx context.Context) error

Ping checks database connectivity.

func (*Store) QueryAuditLog

func (s *Store) QueryAuditLog(ctx context.Context, opts admin.AuditQuery) (*admin.AuditResult, error)

func (*Store) QueryLogs

func (s *Store) QueryLogs(ctx context.Context, q telemetry.LogQuery) ([]telemetry.LogEntry, error)

func (*Store) QueryMetrics

func (s *Store) QueryMetrics(ctx context.Context, q telemetry.MetricQuery) ([]telemetry.Metric, error)

func (*Store) QueryTraces

func (s *Store) QueryTraces(ctx context.Context, q telemetry.TraceQuery) ([]telemetry.Trace, error)

func (*Store) Update

func (s *Store) Update(ctx context.Context, inst *instance.Instance) error

func (*Store) UpdateBootstrap added in v1.5.1

func (s *Store) UpdateBootstrap(ctx context.Context, bw *bootstrap.BootstrapWorkload) error

UpdateBootstrap persists changes to an existing row.

func (*Store) UpdateCertificate

func (s *Store) UpdateCertificate(ctx context.Context, cert *network.Certificate) error

func (*Store) UpdateCheck

func (s *Store) UpdateCheck(ctx context.Context, check *health.HealthCheck) error

func (*Store) UpdateDatacenter added in v1.3.0

func (s *Store) UpdateDatacenter(ctx context.Context, dc *datacenter.Datacenter) error

UpdateDatacenter persists changes to an existing datacenter.

func (*Store) UpdateDeployment

func (s *Store) UpdateDeployment(ctx context.Context, d *deploy.Deployment) error

func (*Store) UpdateDomain

func (s *Store) UpdateDomain(ctx context.Context, domain *network.Domain) error

func (*Store) UpdateRoute

func (s *Store) UpdateRoute(ctx context.Context, route *network.Route) error

func (*Store) UpdateSecret

func (s *Store) UpdateSecret(ctx context.Context, secret *secrets.Secret) error

func (*Store) UpdateTemplate added in v1.3.0

func (s *Store) UpdateTemplate(ctx context.Context, t *template.Template) error

UpdateTemplate persists changes to an existing template.

func (*Store) UpdateTenant

func (s *Store) UpdateTenant(ctx context.Context, tenant *admin.Tenant) error

func (*Store) UpdateWorkload added in v1.5.1

func (s *Store) UpdateWorkload(ctx context.Context, w *workload.Workload) error

UpdateWorkload persists changes.

Jump to

Keyboard shortcuts

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