Documentation
¶
Overview ¶
Package badger provides a Badger DB implementation of the store.Store interface.
Badger is an embedded key-value database optimized for read-heavy workloads and write-heavy workloads with good read performance. It provides ACID guarantees and supports transactions.
This implementation uses JSON encoding for complex structures and prefix-based key namespacing for different entity types. It is suitable for single-node deployments and local development environments.
Index ¶
- type Config
- type Store
- func (s *Store) Close() error
- func (s *Store) CountByTenant(_ context.Context, tenantID string) (int, error)
- func (s *Store) CountDomainsByTenant(_ context.Context, tenantID string) (int, error)
- func (s *Store) CountSecretsByTenant(_ context.Context, tenantID string) (int, error)
- func (s *Store) CountTenants(_ context.Context) (int, error)
- func (s *Store) CountTenantsByStatus(_ context.Context, status admin.TenantStatus) (int, error)
- func (s *Store) Delete(_ context.Context, tenantID string, instanceID id.ID) error
- func (s *Store) DeleteCertificate(_ context.Context, tenantID string, certID id.ID) error
- func (s *Store) DeleteCheck(_ context.Context, tenantID string, checkID id.ID) error
- func (s *Store) DeleteDomain(_ context.Context, tenantID string, domainID id.ID) error
- func (s *Store) DeleteRoute(_ context.Context, tenantID string, routeID id.ID) error
- func (s *Store) DeleteSecret(_ context.Context, tenantID string, instanceID id.ID, key string) error
- func (s *Store) DeleteTenant(_ context.Context, tenantID string) error
- func (s *Store) GetByID(_ context.Context, tenantID string, instanceID id.ID) (*instance.Instance, error)
- func (s *Store) GetBySlug(_ context.Context, tenantID string, slug string) (*instance.Instance, error)
- func (s *Store) GetCertificate(_ context.Context, tenantID string, certID id.ID) (*network.Certificate, error)
- func (s *Store) GetCheck(_ context.Context, tenantID string, checkID id.ID) (*health.HealthCheck, error)
- func (s *Store) GetDeployment(_ context.Context, tenantID string, deployID id.ID) (*deploy.Deployment, error)
- func (s *Store) GetDomain(_ context.Context, tenantID string, domainID id.ID) (*network.Domain, error)
- func (s *Store) GetDomainByHostname(_ context.Context, hostname string) (*network.Domain, error)
- func (s *Store) GetLatestResourceSnapshot(_ context.Context, tenantID string, instanceID id.ID) (*telemetry.ResourceSnapshot, error)
- func (s *Store) GetLatestResult(_ context.Context, tenantID string, checkID id.ID) (*health.HealthResult, error)
- func (s *Store) GetRelease(_ context.Context, tenantID string, releaseID id.ID) (*deploy.Release, error)
- func (s *Store) GetRoute(_ context.Context, tenantID string, routeID id.ID) (*network.Route, error)
- func (s *Store) GetSecretByKey(_ context.Context, tenantID string, instanceID id.ID, key string) (*secrets.Secret, error)
- func (s *Store) GetTenant(_ context.Context, tenantID string) (*admin.Tenant, error)
- func (s *Store) GetTenantBySlug(_ context.Context, slug string) (*admin.Tenant, error)
- func (s *Store) Insert(_ context.Context, inst *instance.Instance) error
- func (s *Store) InsertAuditEntry(_ context.Context, entry *admin.AuditEntry) error
- func (s *Store) InsertCertificate(_ context.Context, cert *network.Certificate) error
- func (s *Store) InsertCheck(_ context.Context, check *health.HealthCheck) error
- func (s *Store) InsertDeployment(_ context.Context, d *deploy.Deployment) error
- func (s *Store) InsertDomain(_ context.Context, domain *network.Domain) error
- func (s *Store) InsertLogs(_ context.Context, logs []telemetry.LogEntry) error
- func (s *Store) InsertMetrics(_ context.Context, metrics []telemetry.Metric) error
- func (s *Store) InsertRelease(_ context.Context, r *deploy.Release) error
- func (s *Store) InsertResourceSnapshot(_ context.Context, snap *telemetry.ResourceSnapshot) error
- func (s *Store) InsertResult(_ context.Context, result *health.HealthResult) error
- func (s *Store) InsertRoute(_ context.Context, route *network.Route) error
- func (s *Store) InsertSecret(_ context.Context, secret *secrets.Secret) error
- func (s *Store) InsertTenant(_ context.Context, tenant *admin.Tenant) error
- func (s *Store) InsertTraces(_ context.Context, traces []telemetry.Trace) error
- func (s *Store) List(_ context.Context, tenantID string, opts instance.ListOptions) (*instance.ListResult, error)
- func (s *Store) ListCertificates(_ context.Context, tenantID string, instanceID id.ID) ([]network.Certificate, error)
- func (s *Store) ListCertificatesByDomain(_ context.Context, tenantID string, domainID id.ID) ([]network.Certificate, error)
- func (s *Store) ListChecks(_ context.Context, tenantID string, instanceID id.ID) ([]health.HealthCheck, error)
- func (s *Store) ListDeployments(_ context.Context, tenantID string, instanceID id.ID, opts deploy.ListOptions) (*deploy.DeployListResult, error)
- func (s *Store) ListDomains(_ context.Context, tenantID string, instanceID id.ID) ([]network.Domain, error)
- func (s *Store) ListReleases(_ context.Context, tenantID string, instanceID id.ID, opts deploy.ListOptions) (*deploy.ReleaseListResult, error)
- func (s *Store) ListResourceSnapshots(_ context.Context, tenantID string, instanceID id.ID, opts telemetry.TimeRange) ([]telemetry.ResourceSnapshot, error)
- func (s *Store) ListResults(_ context.Context, tenantID string, checkID id.ID, opts health.HistoryOptions) ([]health.HealthResult, error)
- func (s *Store) ListRoutes(_ context.Context, tenantID string, instanceID id.ID) ([]network.Route, error)
- func (s *Store) ListSecrets(_ context.Context, tenantID string, instanceID id.ID) ([]secrets.Secret, error)
- func (s *Store) ListTenants(_ context.Context, opts admin.ListTenantsOptions) (*admin.TenantListResult, error)
- func (s *Store) Migrate(_ context.Context) error
- func (s *Store) NextReleaseVersion(_ context.Context, tenantID string, instanceID id.ID) (int, error)
- func (s *Store) Ping(_ context.Context) error
- func (s *Store) QueryAuditLog(_ context.Context, opts admin.AuditQuery) (*admin.AuditResult, error)
- func (s *Store) QueryLogs(_ context.Context, q telemetry.LogQuery) ([]telemetry.LogEntry, error)
- func (s *Store) QueryMetrics(_ context.Context, q telemetry.MetricQuery) ([]telemetry.Metric, error)
- func (s *Store) QueryTraces(_ context.Context, q telemetry.TraceQuery) ([]telemetry.Trace, error)
- func (s *Store) Update(_ context.Context, inst *instance.Instance) error
- func (s *Store) UpdateCertificate(_ context.Context, cert *network.Certificate) error
- func (s *Store) UpdateCheck(_ context.Context, check *health.HealthCheck) error
- func (s *Store) UpdateDeployment(_ context.Context, d *deploy.Deployment) error
- func (s *Store) UpdateDomain(_ context.Context, domain *network.Domain) error
- func (s *Store) UpdateRoute(_ context.Context, route *network.Route) error
- func (s *Store) UpdateSecret(_ context.Context, secret *secrets.Secret) error
- func (s *Store) UpdateTenant(_ context.Context, tenant *admin.Tenant) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// Path is the directory path where Badger will store data.
Path string `default:"./data/badger" env:"CP_BADGER_PATH" json:"path"`
// InMemory when true runs Badger in memory mode (for testing).
InMemory bool `default:"false" env:"CP_BADGER_IN_MEMORY" json:"in_memory"`
// SyncWrites enables synchronous writes (slower but safer).
SyncWrites bool `default:"false" env:"CP_BADGER_SYNC_WRITES" json:"sync_writes"`
}
Config holds the configuration for the Badger store.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store is the Badger implementation of store.Store.
func (*Store) CountByTenant ¶
func (*Store) CountDomainsByTenant ¶
func (*Store) CountSecretsByTenant ¶
func (*Store) CountTenantsByStatus ¶
func (*Store) DeleteCertificate ¶
func (*Store) DeleteCheck ¶
func (*Store) DeleteDomain ¶
func (*Store) DeleteRoute ¶
func (*Store) DeleteSecret ¶
func (*Store) GetCertificate ¶
func (*Store) GetDeployment ¶
func (*Store) GetDomainByHostname ¶
func (*Store) GetLatestResourceSnapshot ¶
func (*Store) GetLatestResult ¶
func (*Store) GetRelease ¶
func (*Store) GetSecretByKey ¶
func (*Store) GetTenantBySlug ¶
func (*Store) InsertAuditEntry ¶
func (*Store) InsertCertificate ¶
func (*Store) InsertCheck ¶
func (*Store) InsertDeployment ¶
func (*Store) InsertDomain ¶
func (*Store) InsertLogs ¶
func (*Store) InsertMetrics ¶
func (*Store) InsertRelease ¶
func (*Store) InsertResourceSnapshot ¶
func (*Store) InsertResult ¶
func (*Store) InsertRoute ¶
func (*Store) InsertSecret ¶
func (*Store) InsertTenant ¶
func (*Store) InsertTraces ¶
func (*Store) List ¶
func (s *Store) List(_ context.Context, tenantID string, opts instance.ListOptions) (*instance.ListResult, error)
func (*Store) ListCertificates ¶
func (*Store) ListCertificatesByDomain ¶
func (*Store) ListChecks ¶
func (*Store) ListDeployments ¶
func (*Store) ListDomains ¶
func (*Store) ListReleases ¶
func (*Store) ListResourceSnapshots ¶
func (*Store) ListResults ¶
func (*Store) ListRoutes ¶
func (*Store) ListSecrets ¶
func (*Store) ListTenants ¶
func (s *Store) ListTenants(_ context.Context, opts admin.ListTenantsOptions) (*admin.TenantListResult, error)
func (*Store) NextReleaseVersion ¶
func (*Store) QueryAuditLog ¶
func (s *Store) QueryAuditLog(_ context.Context, opts admin.AuditQuery) (*admin.AuditResult, error)
func (*Store) QueryMetrics ¶
func (*Store) QueryTraces ¶
func (*Store) UpdateCertificate ¶
func (*Store) UpdateCheck ¶
func (*Store) UpdateDeployment ¶
func (*Store) UpdateDomain ¶
func (*Store) UpdateRoute ¶
func (*Store) UpdateSecret ¶
Click to show internal directories.
Click to hide internal directories.