Documentation ¶
Index ¶
- type PostgreSQL
- func (p *PostgreSQL) DeleteSpecObject(ctx context.Context, tableName, name, namespace string) error
- func (p *PostgreSQL) GetConn() *pgxpool.Pool
- func (p *PostgreSQL) GetEntriesWithDeletedLabels(ctx context.Context, tableName string) (map[string]*spec.ManagedClusterLabelsSpecBundle, error)
- func (p *PostgreSQL) GetEntriesWithoutLeafHubName(ctx context.Context, tableName string) ([]*spec.ManagedClusterLabelsSpec, error)
- func (p *PostgreSQL) GetLastUpdateTimestamp(ctx context.Context, tableName string, filterLocalResources bool) (*time.Time, error)
- func (p *PostgreSQL) GetManagedClusterLabelsStatus(ctx context.Context, tableName string, leafHubName string, ...) (map[string]string, error)
- func (p *PostgreSQL) GetManagedClusterLeafHubName(ctx context.Context, tableName string, managedClusterName string) (string, error)
- func (p *PostgreSQL) GetObjectsBundle(ctx context.Context, tableName string, ...) (*time.Time, error)
- func (p *PostgreSQL) GetUpdatedManagedClusterLabelsBundles(ctx context.Context, tableName string, timestamp *time.Time) (map[string]*spec.ManagedClusterLabelsSpecBundle, error)
- func (p *PostgreSQL) InsertSpecObject(ctx context.Context, tableName, objUID string, object *client.Object) error
- func (p *PostgreSQL) QuerySpecObject(ctx context.Context, tableName, objUID string, object *client.Object) error
- func (p *PostgreSQL) Stop()
- func (p *PostgreSQL) UpdateDeletedLabelKeys(ctx context.Context, tableName string, readVersion int64, leafHubName string, ...) error
- func (p *PostgreSQL) UpdateLeafHubName(ctx context.Context, tableName string, readVersion int64, ...) error
- func (p *PostgreSQL) UpdateSpecObject(ctx context.Context, tableName, objUID string, object *client.Object) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type PostgreSQL ¶
type PostgreSQL struct {
// contains filtered or unexported fields
}
PostgreSQL abstracts PostgreSQL client.
func NewSpecPostgreSQL ¶ added in v0.7.0
func NewSpecPostgreSQL(ctx context.Context, dataConfig *managerconfig.DatabaseConfig) (*PostgreSQL, error)
NewSpecPostgreSQL creates a new instance of PostgreSQL object.
func (*PostgreSQL) DeleteSpecObject ¶
func (p *PostgreSQL) DeleteSpecObject(ctx context.Context, tableName, name, namespace string) error
DeleteSpecObject deletes object with name and namespace from given table
func (*PostgreSQL) GetConn ¶
func (p *PostgreSQL) GetConn() *pgxpool.Pool
GetConn returns the current postgresql connection
func (*PostgreSQL) GetEntriesWithDeletedLabels ¶
func (p *PostgreSQL) GetEntriesWithDeletedLabels(ctx context.Context, tableName string, ) (map[string]*spec.ManagedClusterLabelsSpecBundle, error)
GetEntriesWithDeletedLabels returns a map of leaf-hub -> ManagedClusterLabelsSpecBundle of objects that have a none-empty deleted-label-keys column.
func (*PostgreSQL) GetEntriesWithoutLeafHubName ¶
func (p *PostgreSQL) GetEntriesWithoutLeafHubName(ctx context.Context, tableName string, ) ([]*spec.ManagedClusterLabelsSpec, error)
GetEntriesWithoutLeafHubName returns a slice of ManagedClusterLabelsSpec that are missing leaf hub name.
func (*PostgreSQL) GetLastUpdateTimestamp ¶
func (p *PostgreSQL) GetLastUpdateTimestamp(ctx context.Context, tableName string, filterLocalResources bool, ) (*time.Time, error)
GetLastUpdateTimestamp returns the last update timestamp of a specific table.
func (*PostgreSQL) GetManagedClusterLabelsStatus ¶
func (p *PostgreSQL) GetManagedClusterLabelsStatus(ctx context.Context, tableName string, leafHubName string, managedClusterName string, ) (map[string]string, error)
GetManagedClusterLabelsStatus gets the labels present in managed-cluster CR metadata from a specific table.
func (*PostgreSQL) GetManagedClusterLeafHubName ¶
func (p *PostgreSQL) GetManagedClusterLeafHubName(ctx context.Context, tableName string, managedClusterName string, ) (string, error)
GetManagedClusterLeafHubName returns leaf-hub name for a given managed cluster from a specific table. TODO: once non-k8s-restapi exposes hub names, remove line.
func (*PostgreSQL) GetObjectsBundle ¶
func (p *PostgreSQL) GetObjectsBundle(ctx context.Context, tableName string, createObjFunc bundle.CreateObjectFunction, intoBundle bundle.ObjectsBundle, ) (*time.Time, error)
GetObjectsBundle returns a bundle of objects from a specific table.
func (*PostgreSQL) GetUpdatedManagedClusterLabelsBundles ¶
func (p *PostgreSQL) GetUpdatedManagedClusterLabelsBundles(ctx context.Context, tableName string, timestamp *time.Time, ) (map[string]*spec.ManagedClusterLabelsSpecBundle, error)
GetUpdatedManagedClusterLabelsBundles returns a map of leaf-hub -> ManagedClusterLabelsSpecBundle of objects belonging to a leaf-hub that had at least once update since the given timestamp, from a specific table.
func (*PostgreSQL) InsertSpecObject ¶
func (p *PostgreSQL) InsertSpecObject(ctx context.Context, tableName, objUID string, object *client.Object) error
InsertSpecObject insets new object to given table with object UID and payload
func (*PostgreSQL) QuerySpecObject ¶
func (p *PostgreSQL) QuerySpecObject(ctx context.Context, tableName, objUID string, object *client.Object) error
QuerySpecObject gets object from given table with object UID
func (*PostgreSQL) Stop ¶
func (p *PostgreSQL) Stop()
Stop stops PostgreSQL and closes the connection pool.
func (*PostgreSQL) UpdateDeletedLabelKeys ¶
func (p *PostgreSQL) UpdateDeletedLabelKeys(ctx context.Context, tableName string, readVersion int64, leafHubName string, managedClusterName string, deletedLabelKeys []string, ) error
UpdateDeletedLabelKeys updates deleted_label_keys value for a managed cluster entry under optimistic concurrency approach.
func (*PostgreSQL) UpdateLeafHubName ¶
func (p *PostgreSQL) UpdateLeafHubName(ctx context.Context, tableName string, readVersion int64, managedClusterName string, leafHubName string, ) error
UpdateLeafHubName updates leaf hub name for a given managed cluster under optimistic concurrency.
func (*PostgreSQL) UpdateSpecObject ¶
func (p *PostgreSQL) UpdateSpecObject(ctx context.Context, tableName, objUID string, object *client.Object) error
UpdateSpecObject updates object payload in given table with object UID