db

package
v1.0.85 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2023 License: Apache-2.0 Imports: 31 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultCheckRetentionDays  = 7
	DefaultCanaryRetentionDays = 7
)
View Source
const (
	DefaultCheckStatusRetentionDays        = 60
	RetentionDaysFor1hCheckStatusAggregate = 180
	RetentionDaysFor1dCheckStatusAggregate = 1000
)

Variables

View Source
var (
	CheckRetentionDays  int
	CanaryRetentionDays int
)
View Source
var CheckStatusRetentionDays int
View Source
var ConnectionString string
View Source
var DBMetrics bool
View Source
var DefaultExpiryDays int
View Source
var Gorm *gorm.DB
View Source
var HTTPEndpoint = "http://localhost:8080/db"
View Source
var PostgRESTServerPort = 3000
View Source
var PostgRESTVersion = "v9.0.0"
View Source
var RunMigrations bool

Functions

func AddCheckStatuses added in v1.0.10

func AddCheckStatuses(ctx context.Context, ids []string, status models.CheckHealthStatus) error

func AggregateCheckStatuses1d added in v0.38.246

func AggregateCheckStatuses1d()

AggregateCheckStatuses aggregates check statuses daily and stores it to the corresponding tables.

func AggregateCheckStatuses1h added in v0.38.246

func AggregateCheckStatuses1h()

AggregateCheckStatuses aggregates check statuses hourly and stores it to the corresponding tables.

func CleanupCanaries added in v0.38.332

func CleanupCanaries()

func CleanupChecks added in v0.38.332

func CleanupChecks()

func CreateCanary added in v0.38.85

func CreateCanary(canary *pkg.Canary) error

func CreateCheck added in v0.38.85

func CreateCheck(canary pkg.Canary, check *pkg.Check) error

func CreateComponentCanaryFromInline added in v0.38.151

func CreateComponentCanaryFromInline(id, name, namespace, schedule, owner string, spec *v1.CanarySpec) (*pkg.Canary, error)

func DeleteAllOldCheckStatuses added in v0.38.246

func DeleteAllOldCheckStatuses()

DeleteAllOldCheckStatuses deletes check statuses older than the configured retention period from 3 different tables.

func DeleteCanary added in v0.38.85

func DeleteCanary(id string, deleteTime time.Time) error

func DeleteCheckComponentRelationshipsForCanary added in v0.38.151

func DeleteCheckComponentRelationshipsForCanary(id string, deleteTime time.Time) error

func DeleteChecksForCanary added in v0.38.151

func DeleteChecksForCanary(id string, deleteTime time.Time) ([]string, error)

func DeleteComponentChildren added in v0.38.210

func DeleteComponentChildren(componentID string, deleteTime time.Time) error

func DeleteComponentRelationship added in v0.38.140

func DeleteComponentRelationship(componentID string, deleteTime time.Time) error

func DeleteComponentsOfTopology added in v0.38.266

func DeleteComponentsOfTopology(topologyID string, deleteTime time.Time) error

DeleteComponents deletes all components associated with a topology

func DeleteComponentsWithIDs added in v0.38.125

func DeleteComponentsWithIDs(compIDs []string, deleteTime time.Time) error

DeleteComponentsWithID deletes all components with specified ids.

func DeleteConfigRelationshipForComponent added in v0.38.165

func DeleteConfigRelationshipForComponent(componentID uuid.UUID, deleteTime time.Time) error

func DeleteInlineCanariesForComponent added in v0.38.151

func DeleteInlineCanariesForComponent(componentID string, deleteTime time.Time) error

func DeleteNonTransformedChecks added in v1.0.10

func DeleteNonTransformedChecks(id []string) error

func DeleteTopology added in v0.38.266

func DeleteTopology(t *v1.Topology) error

func FindCanary added in v0.38.85

func FindCanary(namespace, name string) (*pkg.Canary, error)

func FindCanaryByID added in v0.38.257

func FindCanaryByID(id string) (*pkg.Canary, error)

func FindCheck added in v0.38.85

func FindCheck(canary pkg.Canary, name string) (*pkg.Check, error)

func FindChecks added in v1.0.85

func FindChecks(ctx context.Context, idOrName, checkType string) ([]models.Check, error)

func FindConfig added in v0.38.165

func FindConfig(config pkg.Config) (*pkg.Config, error)

func FindConfigForComponent added in v0.38.195

func FindConfigForComponent(componentID, configType string) ([]pkg.Config, error)

func FindDeletedChecksSince added in v0.38.328

func FindDeletedChecksSince(ctx context.Context, since time.Time) ([]string, error)

func GetActiveComponentsIDsOfTopology added in v0.38.266

func GetActiveComponentsIDsOfTopology(topologyID string) (compIDs []uuid.UUID, err error)

func GetAllActiveChecksForCanary added in v0.38.160

func GetAllActiveChecksForCanary(canaryID uuid.UUID) (checks pkg.Checks, err error)

returns all the checks associated with canary which are currently executing

func GetAllCanariesForSync added in v1.0.6

func GetAllCanariesForSync(ctx context.Context, namespace string) ([]pkg.Canary, error)

func GetAllChecksForCanary added in v0.38.151

func GetAllChecksForCanary(canaryID uuid.UUID) (checks pkg.Checks, err error)

returns all the checks associated with canary.

func GetAllComponentWithCanaries added in v0.38.151

func GetAllComponentWithCanaries() (components pkg.Components, err error)

func GetAllComponentsWithConfigs added in v0.38.172

func GetAllComponentsWithConfigs() (components pkg.Components, err error)

func GetAllComponentsWithSelectors added in v0.38.198

func GetAllComponentsWithSelectors() (components pkg.Components, err error)

Get all the components from table which has not null selectors

func GetAllTopologiesForSync added in v1.0.6

func GetAllTopologiesForSync() ([]v1.Topology, error)

func GetCanary added in v0.38.85

func GetCanary(id string) (pkg.Canary, error)

func GetCheck added in v0.38.85

func GetCheck(id string) (*pkg.Check, error)

func GetCheckRelationshipsForComponent added in v0.38.181

func GetCheckRelationshipsForComponent(componentID uuid.UUID) ([]pkg.CheckComponentRelationship, error)

func GetChecksWithLabelSelector added in v0.38.151

func GetChecksWithLabelSelector(labelSelector string) (selectedChecks pkg.Checks, err error)

func GetChildRelationshipsForParentComponent added in v0.38.181

func GetChildRelationshipsForParentComponent(componentID uuid.UUID) ([]pkg.ComponentRelationship, error)

func GetComponentsWithFieldSelector added in v0.38.198

func GetComponentsWithFieldSelector(fieldSelector string) (components pkg.Components, err error)

func GetComponentsWithLabelSelector added in v0.38.198

func GetComponentsWithLabelSelector(labelSelector string) (components pkg.Components, err error)

func GetComponentsWithSelectors added in v0.38.151

func GetComponentsWithSelectors(resourceSelectors v1.ResourceSelectors) (components pkg.Components, err error)

func GetDB

func GetDB() (*sql.DB, error)

func GetLabelsFromSelector added in v0.38.114

func GetLabelsFromSelector(selector string) (matchLabels map[string]string)

func GetTopology added in v0.38.266

func GetTopology(ctx context.Context, id string) (*v1.Topology, error)

func GetTransformedCheckIDs added in v0.38.260

func GetTransformedCheckIDs(ctx context.Context, canaryID string) ([]string, error)

func GoOffline added in v0.38.149

func GoOffline() error

func Init

func Init() error

func IsConfigured added in v0.38.85

func IsConfigured() bool

func IsConnected added in v0.38.85

func IsConnected() bool

func NewComponentRelationships added in v0.38.181

func NewComponentRelationships(relationshipID uuid.UUID, path string, components pkg.Components) (relationships []*pkg.ComponentRelationship, err error)

func PersistCanary added in v0.38.85

func PersistCanary(canary v1.Canary, source string) (*pkg.Canary, error)

func PersistCanaryModel added in v1.0.26

func PersistCanaryModel(model pkg.Canary) (*pkg.Canary, error)

func PersistCheck added in v0.38.85

func PersistCheck(check pkg.Check, canaryID uuid.UUID) (uuid.UUID, error)

func PersistCheckComponentRelationship added in v0.38.151

func PersistCheckComponentRelationship(relationship *pkg.CheckComponentRelationship) error

func PersistComponent added in v0.38.85

func PersistComponent(component *pkg.Component) ([]uuid.UUID, error)

TODO: Simplify logic and improve readability

func PersistComponentRelationships added in v0.38.151

func PersistComponentRelationships(relationships []*pkg.ComponentRelationship) error

func PersistComponents added in v0.38.135

func PersistComponents(results []*pkg.Component) error

func PersistConfigComponentRelationship added in v0.38.165

func PersistConfigComponentRelationship(configID, componentID uuid.UUID, selectorID string) error

func PersistJobHistory added in v0.38.201

func PersistJobHistory(h *models.JobHistory) error

func PersistTopology added in v0.38.266

func PersistTopology(t *v1.Topology) (bool, error)

func PostgRESTEndpoint added in v0.38.137

func PostgRESTEndpoint() string

func RefreshCheckStatusSummary added in v0.38.232

func RefreshCheckStatusSummary()

func RemoveTransformedChecks added in v1.0.10

func RemoveTransformedChecks(ctx context.Context, ids []string) error

func Start added in v0.38.85

func Start(ctx context.Context) error

func StartPostgrest added in v0.38.137

func StartPostgrest()

func StopServer added in v0.38.83

func StopServer() error

func UpdateComponentCosts added in v0.38.199

func UpdateComponentCosts() error

func UpdateStatusAndSummaryForComponent added in v0.38.146

func UpdateStatusAndSummaryForComponent(id uuid.UUID, status types.ComponentStatus, summary types.Summary) (int64, error)

Types

type ConfigComponentRelationship added in v0.38.176

type ConfigComponentRelationship struct {
	ComponentID uuid.UUID
	ConfigID    uuid.UUID
	SelectorID  string
	DeletedAt   *time.Time
}

Store entry in config_component_relationship table

func GetConfigRelationshipsForComponent added in v0.38.165

func GetConfigRelationshipsForComponent(componentID uuid.UUID) ([]ConfigComponentRelationship, error)

Directories

Path Synopsis
nolint
nolint

Jump to

Keyboard shortcuts

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