Documentation
¶
Index ¶
- Constants
- func DBConfigFromConfig(config *config.SyncConfig) dbConfig
- func DBSessionFromConfig(ctx context.Context, kubectlConfig kubernetes.Interface, namespace string, ...) db.Session
- func DBSessionFromConfigWithCreds(config *config.SyncConfig, username, password string) db.Session
- func NewSyncQueries(session db.Session, config dbConfig) *syncQueries
- func SecondsToDurationWithDefault(value *int, defaultSeconds int) time.Duration
- type ControllerHealthRecord
- type DBInfo
- type LimitRecord
- type LockRecord
- type StateRecord
- type SyncQueries
Constants ¶
View Source
const ( DefaultDBPollSeconds = 10 DefaultDBHeartbeatSeconds = 60 DefaultDBInactiveControllerSeconds = 600 )
View Source
const ( LimitNameField = "name" LimitSizeField = "sizelimit" StateNameField = "name" StateKeyField = "workflowkey" StateControllerField = "controller" StateHeldField = "held" StatePriorityField = "priority" StateTimeField = "time" ControllerNameField = "controller" ControllerTimeField = "time" LockNameField = "name" LockControllerField = "controller" )
Field name constants
Variables ¶
This section is empty.
Functions ¶
func DBConfigFromConfig ¶
func DBConfigFromConfig(config *config.SyncConfig) dbConfig
func DBSessionFromConfig ¶
func DBSessionFromConfig(ctx context.Context, kubectlConfig kubernetes.Interface, namespace string, config *config.SyncConfig) db.Session
func DBSessionFromConfigWithCreds ¶
func DBSessionFromConfigWithCreds(config *config.SyncConfig, username, password string) db.Session
func NewSyncQueries ¶
NewSyncQueries creates a new syncQueries instance
Types ¶
type ControllerHealthRecord ¶
type LimitRecord ¶
Record types for database operations
type LockRecord ¶
type StateRecord ¶
type StateRecord struct {
Name string `db:"name"` // semaphore name identifier
Key string `db:"workflowkey"` // workflow key holding or waiting for the lock of the form <namespace>/<name>
Controller string `db:"controller"` // controller where the workflow is running
Held bool `db:"held"`
Priority int32 `db:"priority"` // higher number = higher priority in queue
Time time.Time `db:"time"` // timestamp of creation or last update
}
type SyncQueries ¶
type SyncQueries interface {
CreateSemaphoreLimit(ctx context.Context, name string, sizeLimit int) error
UpdateSemaphoreLimit(ctx context.Context, name string, sizeLimit int) error
DeleteSemaphoreLimit(ctx context.Context, name string) error
GetSemaphoreLimit(ctx context.Context, dbKey string) (*LimitRecord, error)
GetCurrentState(ctx context.Context, session db.Session, semaphoreName string, held bool) ([]StateRecord, error)
GetCurrentHolders(ctx context.Context, session db.Session, semaphoreName string) ([]StateRecord, error)
GetCurrentPending(ctx context.Context, semaphoreName string) ([]StateRecord, error)
GetOrderedQueue(ctx context.Context, session db.Session, semaphoreName string, inactiveTimeout time.Duration) ([]StateRecord, error)
AddToQueue(ctx context.Context, record *StateRecord) error
RemoveFromQueue(ctx context.Context, semaphoreName, holderKey string) error
CheckQueueExists(ctx context.Context, semaphoreName, holderKey, controllerName string) ([]StateRecord, error)
UpdateStateToHeld(ctx context.Context, session db.Session, semaphoreName, holderKey, controllerName string) error
InsertHeldState(ctx context.Context, session db.Session, record *StateRecord) error
GetPendingInQueue(ctx context.Context, session db.Session, semaphoreName, holderKey, controllerName string) ([]StateRecord, error)
ReleaseHeld(ctx context.Context, semaphoreName, key, controllerName string) error
GetExistingLocks(ctx context.Context, lockName, controllerName string) ([]LockRecord, error)
InsertLock(ctx context.Context, record *LockRecord) error
DeleteLock(ctx context.Context, lockName string) error
ExpireInactiveLocks(ctx context.Context, inactiveTimeout time.Duration) (int64, error)
InsertControllerHealth(ctx context.Context, record *ControllerHealthRecord) error
UpdateControllerTimestamp(ctx context.Context, controllerName string, timestamp time.Time) error
GetPendingInQueueWithSession(ctx context.Context, session db.Session, semaphoreName, holderKey, controllerName string) ([]StateRecord, error)
UpdateStateToHeldWithSession(ctx context.Context, session db.Session, semaphoreName, holderKey, controllerName string) error
InsertHeldStateWithSession(ctx context.Context, session db.Session, record *StateRecord) error
}
Click to show internal directories.
Click to hide internal directories.