Documentation
¶
Index ¶
- Constants
- func InterpreError(key string, err error) error
- func InterpreMysqlError(key string, err error) error
- func InterprePostgresError(key string, err error) error
- func InterpreResourceError(cluster, name string, err error) error
- func NewStorageFactory(configPath string) (storage.StorageFactory, error)
- type CollectionResourceStorage
- type Config
- type JSONQueryExpression
- func (jsonQuery *JSONQueryExpression) Build(builder clause.Builder)
- func (jsonQuery *JSONQueryExpression) Equal(value string) *JSONQueryExpression
- func (jsonQuery *JSONQueryExpression) Exist() *JSONQueryExpression
- func (jsonQuery *JSONQueryExpression) In(values ...string) *JSONQueryExpression
- func (jsonQuery *JSONQueryExpression) NotEqual(value string) *JSONQueryExpression
- func (jsonQuery *JSONQueryExpression) NotExist() *JSONQueryExpression
- func (jsonQuery *JSONQueryExpression) NotIn(values ...string) *JSONQueryExpression
- type LogConfig
- type MySQLConfig
- type PostgresConfig
- type Resource
- type ResourceStorage
- func (s *ResourceStorage) Create(ctx context.Context, cluster string, obj runtime.Object) error
- func (s *ResourceStorage) Delete(ctx context.Context, cluster string, obj runtime.Object) error
- func (s *ResourceStorage) Get(ctx context.Context, cluster, namespace, name string, into runtime.Object) error
- func (s *ResourceStorage) GetStorageConfig() *storage.ResourceStorageConfig
- func (s *ResourceStorage) List(ctx context.Context, listObject runtime.Object, opts *internal.ListOptions) error
- func (s *ResourceStorage) Update(ctx context.Context, cluster string, obj runtime.Object) error
- type SelectedResource
- type StorageFactory
- func (f *StorageFactory) CleanCluster(ctx context.Context, cluster string) error
- func (s *StorageFactory) CleanClusterResource(ctx context.Context, cluster string, gvr schema.GroupVersionResource) error
- func (s *StorageFactory) GetCollectionResources(ctx context.Context) ([]*internal.CollectionResource, error)
- func (f *StorageFactory) GetResourceVersions(ctx context.Context, cluster string) (map[schema.GroupVersionResource]map[string]interface{}, error)
- func (s *StorageFactory) NewCollectionResourceStorage(cr *internal.CollectionResource) (storage.CollectionResourceStorage, error)
- func (s *StorageFactory) NewResourceStorage(config *storage.ResourceStorageConfig) (storage.ResourceStorage, error)
Constants ¶
View Source
const ( SearchLabelOwnerKey = "internalstorage.clusterpedia.io/owner-key" SearchLabelOwnerUID = "internalstorage.clusterpedia.io/owner-uid" SearchLabelOwnerSeniority = "internalstorage.clusterpedia.io/owner-seniority" )
View Source
const StorageName = "internal"
Variables ¶
This section is empty.
Functions ¶
func InterpreError ¶
func InterpreMysqlError ¶
func InterprePostgresError ¶
func InterpreResourceError ¶
func NewStorageFactory ¶
func NewStorageFactory(configPath string) (storage.StorageFactory, error)
Types ¶
type CollectionResourceStorage ¶
type CollectionResourceStorage struct {
// contains filtered or unexported fields
}
func (*CollectionResourceStorage) Get ¶
func (s *CollectionResourceStorage) Get(ctx context.Context, opts *internal.ListOptions) (*internal.CollectionResource, error)
type Config ¶
type Config struct {
Type string `env:"DB_TYPE" required:"true"`
Network string `env:"DB_NETWORK"` // Network type, either tcp or unix, Default is tcp
Host string `env:"DB_HOST"` // TCP host:port or Unix socket depending on Network
Port string `env:"DB_PORT"`
User string `env:"DB_USER"`
Password string `env:"DB_PASSWORD"`
Database string `env:"DB_DATABASE" required:"true"`
SSLMode string `yaml:"sslMode"`
CertFile string `yaml:"sslCertFile"`
KeyFile string `yaml:"sslKeyFile"`
RootCertFile string `yaml:"sslRootCertFile"`
MySQL *MySQLConfig `yaml:"mysql"`
Postgres *PostgresConfig `yaml:"postgres"`
Params map[string]string `yaml:"params"`
Log *LogConfig `yaml:"log"`
}
type JSONQueryExpression ¶
type JSONQueryExpression struct {
// contains filtered or unexported fields
}
func JSONQuery ¶
func JSONQuery(column string, keys ...string) *JSONQueryExpression
func (*JSONQueryExpression) Build ¶
func (jsonQuery *JSONQueryExpression) Build(builder clause.Builder)
func (*JSONQueryExpression) Equal ¶
func (jsonQuery *JSONQueryExpression) Equal(value string) *JSONQueryExpression
func (*JSONQueryExpression) Exist ¶ added in v0.1.0
func (jsonQuery *JSONQueryExpression) Exist() *JSONQueryExpression
func (*JSONQueryExpression) In ¶
func (jsonQuery *JSONQueryExpression) In(values ...string) *JSONQueryExpression
func (*JSONQueryExpression) NotEqual ¶
func (jsonQuery *JSONQueryExpression) NotEqual(value string) *JSONQueryExpression
func (*JSONQueryExpression) NotExist ¶ added in v0.1.0
func (jsonQuery *JSONQueryExpression) NotExist() *JSONQueryExpression
func (*JSONQueryExpression) NotIn ¶
func (jsonQuery *JSONQueryExpression) NotIn(values ...string) *JSONQueryExpression
type MySQLConfig ¶
type MySQLConfig struct {
DialTimeout *time.Duration `yaml:"dialTimeout"`
ReadTimeout *time.Duration `yaml:"readTimeout"`
WriteTimeout *time.Duration `yaml:"writeTimeout"`
ServerPubKey *string `yaml:"serverPubKey"`
Loc *string `yaml:"loc"`
MaxAllowedPacket *int `yaml:"maxAllowedPacket"`
AllowAllFiles *bool `yaml:"allowAllFiles"` // Allow all files to be used with LOAD DATA LOCAL INFILE
AllowCleartextPasswords *bool `yaml:"allowCleartextPasswords"` // Allows the cleartext client side plugin
AllowNativePasswords *bool `yaml:"allowNativePasswords"` // Allows the native password authentication method
AllowOldPasswords *bool `yaml:"allowOldPasswords"` // Allows the old insecure password method
CheckConnLiveness *bool `yaml:"checkConnLiveness"` // Check connections for liveness before using them
ClientFoundRows *bool `yaml:"clientFoundRows"` // Return number of matching rows instead of rows changed
ColumnsWithAlias *bool `yaml:"columnsWithAlias"` // Prepend table alias to column names
InterpolateParams *bool `yaml:"interpolateParams"` // Interpolate placeholders into query string
MultiStatements *bool `yaml:"multiStatements"` // Allow multiple statements in one query
ParseTime *bool `yaml:"parseTime"` // Parse time values to time.Time
RejectReadOnly *bool `yaml:"rejectReadOnly"` // Reject read-only connections
}
type PostgresConfig ¶
type PostgresConfig struct{}
type Resource ¶
type Resource struct {
ID uint `gorm:"primaryKey"`
Group string `` /* 171-byte string literal not displayed */
Version string `` /* 171-byte string literal not displayed */
Resource string `` /* 171-byte string literal not displayed */
Kind string `gorm:"size:63;not null"`
Cluster string `gorm:"size:253;not null;uniqueIndex:uni_group_version_resource_cluster_namespace_name,length:100;index:idx_cluster"`
Namespace string `` /* 144-byte string literal not displayed */
Name string `` /* 183-byte string literal not displayed */
OwnerUID types.UID `gorm:"column:owner_uid;size:36;not null;default:''"`
UID types.UID `gorm:"size:36;not null"`
ResourceVersion string `gorm:"size:30;not null"`
Object datatypes.JSON `gorm:"not null"`
CreatedAt time.Time `gorm:"not null"`
SyncedAt time.Time `gorm:"not null;autoUpdateTime"`
DeletedAt sql.NullTime
}
func (Resource) GroupVersionResource ¶
func (res Resource) GroupVersionResource() schema.GroupVersionResource
type ResourceStorage ¶
type ResourceStorage struct {
// contains filtered or unexported fields
}
func (*ResourceStorage) GetStorageConfig ¶
func (s *ResourceStorage) GetStorageConfig() *storage.ResourceStorageConfig
func (*ResourceStorage) List ¶
func (s *ResourceStorage) List(ctx context.Context, listObject runtime.Object, opts *internal.ListOptions) error
type SelectedResource ¶
type SelectedResource struct {
}
SelectedResource used to select specific fields
type StorageFactory ¶
type StorageFactory struct {
// contains filtered or unexported fields
}
func (*StorageFactory) CleanCluster ¶
func (f *StorageFactory) CleanCluster(ctx context.Context, cluster string) error
func (*StorageFactory) CleanClusterResource ¶
func (s *StorageFactory) CleanClusterResource(ctx context.Context, cluster string, gvr schema.GroupVersionResource) error
func (*StorageFactory) GetCollectionResources ¶
func (s *StorageFactory) GetCollectionResources(ctx context.Context) ([]*internal.CollectionResource, error)
func (*StorageFactory) GetResourceVersions ¶
func (f *StorageFactory) GetResourceVersions(ctx context.Context, cluster string) (map[schema.GroupVersionResource]map[string]interface{}, error)
func (*StorageFactory) NewCollectionResourceStorage ¶
func (s *StorageFactory) NewCollectionResourceStorage(cr *internal.CollectionResource) (storage.CollectionResourceStorage, error)
func (*StorageFactory) NewResourceStorage ¶
func (s *StorageFactory) NewResourceStorage(config *storage.ResourceStorageConfig) (storage.ResourceStorage, error)
Click to show internal directories.
Click to hide internal directories.