Documentation ¶
Index ¶
- Constants
- func CheckIfDatabaseInitialized(db *dbr.Connection) (bool, error)
- func InitializeDatabase(connectionURL string, retries int, log logrus.FieldLogger) (*dbr.Connection, error)
- func WaitForDatabaseAccess(connString string, retryCount int, sleepTime time.Duration, ...) (*dbr.Connection, error)
- type Factory
- type ReadSession
- type Transaction
- type WriteSession
- type WriteSessionWithinTransaction
Constants ¶
View Source
const ( InstancesTableName = "instances" OperationTableName = "operations" OrchestrationTableName = "orchestrations" RuntimeStateTableName = "runtime_states" CreatedAtField = "created_at" )
View Source
const TableNotExistsError = "42P01"
View Source
const (
UniqueViolationErrorCode = "23505"
)
Variables ¶
This section is empty.
Functions ¶
func CheckIfDatabaseInitialized ¶
func CheckIfDatabaseInitialized(db *dbr.Connection) (bool, error)
func InitializeDatabase ¶
func InitializeDatabase(connectionURL string, retries int, log logrus.FieldLogger) (*dbr.Connection, error)
InitializeDatabase opens database connection and initializes schema if it does not exist
func WaitForDatabaseAccess ¶
func WaitForDatabaseAccess(connString string, retryCount int, sleepTime time.Duration, log logrus.FieldLogger) (*dbr.Connection, error)
Types ¶
type Factory ¶
type Factory interface { NewReadSession() ReadSession NewWriteSession() WriteSession NewSessionWithinTransaction() (WriteSessionWithinTransaction, dberr.Error) }
func NewFactory ¶
func NewFactory(connection *dbr.Connection) Factory
type ReadSession ¶
type ReadSession interface { FindAllInstancesJoinedWithOperation(prct ...predicate.Predicate) ([]dbmodel.InstanceWithOperationDTO, dberr.Error) FindAllInstancesForRuntimes(runtimeIdList []string) ([]dbmodel.InstanceDTO, dberr.Error) FindAllInstancesForSubAccounts(subAccountslist []string) ([]dbmodel.InstanceDTO, dberr.Error) GetInstanceByID(instanceID string) (dbmodel.InstanceDTO, dberr.Error) GetLastOperation(instanceID string) (dbmodel.OperationDTO, dberr.Error) GetOperationByID(opID string) (dbmodel.OperationDTO, dberr.Error) GetNotFinishedOperationsByType(operationType internal.OperationType) ([]dbmodel.OperationDTO, dberr.Error) CountNotFinishedOperationsByInstanceID(instanceID string) (int, dberr.Error) GetOperationByTypeAndInstanceID(inID string, opType internal.OperationType) (dbmodel.OperationDTO, dberr.Error) GetOperationByInstanceID(inID string) (dbmodel.OperationDTO, dberr.Error) GetOperationsByTypeAndInstanceID(inID string, opType internal.OperationType) ([]dbmodel.OperationDTO, dberr.Error) GetOperationsByInstanceID(inID string) ([]dbmodel.OperationDTO, dberr.Error) GetOperationsForIDs(opIdList []string) ([]dbmodel.OperationDTO, dberr.Error) ListOperations(filter dbmodel.OperationFilter) ([]dbmodel.OperationDTO, int, int, error) ListOperationsByType(operationType internal.OperationType) ([]dbmodel.OperationDTO, dberr.Error) GetOperationStats() ([]dbmodel.OperationStatEntry, error) GetInstanceStats() ([]dbmodel.InstanceByGlobalAccountIDStatEntry, error) GetERSContextStats() ([]dbmodel.InstanceERSContextStatsEntry, error) GetNumberOfInstancesForGlobalAccountID(globalAccountID string) (int, error) GetRuntimeStateByOperationID(operationID string) (dbmodel.RuntimeStateDTO, dberr.Error) ListRuntimeStateByRuntimeID(runtimeID string) ([]dbmodel.RuntimeStateDTO, dberr.Error) GetOrchestrationByID(oID string) (dbmodel.OrchestrationDTO, dberr.Error) ListOrchestrations(filter dbmodel.OrchestrationFilter) ([]dbmodel.OrchestrationDTO, int, int, error) ListInstances(filter dbmodel.InstanceFilter) ([]dbmodel.InstanceDTO, int, int, error) ListOperationsByOrchestrationID(orchestrationID string, filter dbmodel.OperationFilter) ([]dbmodel.OperationDTO, int, int, error) ListOperationsInTimeRange(from, to time.Time) ([]dbmodel.OperationDTO, error) GetOperationStatsForOrchestration(orchestrationID string) ([]dbmodel.OperationStatEntry, error) GetLatestRuntimeStateByRuntimeID(runtimeID string) (dbmodel.RuntimeStateDTO, dberr.Error) GetLatestRuntimeStateWithReconcilerInputByRuntimeID(runtimeID string) (dbmodel.RuntimeStateDTO, dberr.Error) GetLatestRuntimeStateWithKymaVersionByRuntimeID(runtimeID string) (dbmodel.RuntimeStateDTO, dberr.Error) GetLatestRuntimeStateWithOIDCConfigByRuntimeID(runtimeID string) (dbmodel.RuntimeStateDTO, dberr.Error) ListEvents(filter events.EventFilter) ([]events.EventDTO, error) }
type Transaction ¶
type WriteSession ¶
type WriteSession interface { InsertInstance(instance dbmodel.InstanceDTO) dberr.Error UpdateInstance(instance dbmodel.InstanceDTO) dberr.Error DeleteInstance(instanceID string) dberr.Error InsertOperation(dto dbmodel.OperationDTO) dberr.Error UpdateOperation(dto dbmodel.OperationDTO) dberr.Error InsertOrchestration(o dbmodel.OrchestrationDTO) dberr.Error UpdateOrchestration(o dbmodel.OrchestrationDTO) dberr.Error InsertRuntimeState(state dbmodel.RuntimeStateDTO) dberr.Error InsertEvent(level events.EventLevel, message, instanceID, operationID string) dberr.Error DeleteEvents(until time.Time) dberr.Error }
type WriteSessionWithinTransaction ¶
type WriteSessionWithinTransaction interface { WriteSession Transaction }
Click to show internal directories.
Click to hide internal directories.