repository

package
v0.0.0-...-e163d20 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ReadLockMaxRetries    = 3
	ReadLockRetryInterval = 500 * time.Millisecond
)
View Source
const (
	ConfigurationPrefix     = "configleam:config"
	ConfigurationEnvPrefix  = "configleam:env"
	ConfigurationLockPrefix = "configleam:lock"

	GlobalPrefix = "global"
	GroupPrefix  = "group"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type EnvLockHeldError

type EnvLockHeldError struct {
	Env string
}

func (EnvLockHeldError) Error

func (e EnvLockHeldError) Error() string

type EnvNotFoundError

type EnvNotFoundError struct {
	Key string
}

EnvNotFoundError is used when an environment is not found.

func (EnvNotFoundError) Error

func (e EnvNotFoundError) Error() string

type EnvParams

type EnvParams struct {
	Name     string `json:"name"`
	Version  string `json:"version"`
	Clone    bool   `json:"clone"`
	Original string `json:"original"`
}

EnvParams represents parameters for managing environment metadata.

type EtcdKeys

type EtcdKeys struct{}

func (EtcdKeys) GetBaseKey

func (k EtcdKeys) GetBaseKey(repo string, env string) string

func (EtcdKeys) GetCloneEnvPatternKey

func (k EtcdKeys) GetCloneEnvPatternKey(cloneEnv string) string

func (EtcdKeys) GetEnvKey

func (k EtcdKeys) GetEnvKey(env string) string

func (EtcdKeys) GetEnvLockKey

func (k EtcdKeys) GetEnvLockKey(env string) string

func (EtcdKeys) GetGlobalKey

func (k EtcdKeys) GetGlobalKey(prefix, key string) string

func (EtcdKeys) GetGroupKey

func (k EtcdKeys) GetGroupKey(prefix, key string) string

func (EtcdKeys) GetReadGlobalRepoEnvKey

func (k EtcdKeys) GetReadGlobalRepoEnvKey(repo, env, key string) string

func (EtcdKeys) GetReadGroupRepoEnvKey

func (k EtcdKeys) GetReadGroupRepoEnvKey(repo, env, key string) string

type EtcdRepository

type EtcdRepository struct {
	*etcd.Etcd
	// contains filtered or unexported fields
}

func NewEtcdRepository

func NewEtcdRepository(etcd *etcd.Etcd) *EtcdRepository

func (*EtcdRepository) AddEnv

func (r *EtcdRepository) AddEnv(ctx context.Context, env string, params EnvParams) error

AddEnv adds metadata for a new environment to the repository.

func (*EtcdRepository) CloneConfig

func (r *EtcdRepository) CloneConfig(ctx context.Context, repo, env, newEnv string, updateGlobal map[string]interface{}) error

func (*EtcdRepository) DeleteConfig

func (r *EtcdRepository) DeleteConfig(ctx context.Context, repo, env string) error

DeleteConfig deletes all configuration keys for a specific repository and environment.

func (*EtcdRepository) DeleteEnv

func (r *EtcdRepository) DeleteEnv(ctx context.Context, env string) error

DeleteEnv removes metadata for the specified environment from the repository.

func (*EtcdRepository) GetAllEnvs

func (r *EtcdRepository) GetAllEnvs(ctx context.Context) ([]EnvParams, error)

GetAllEnvs retrieves all available environments from the repository.

func (*EtcdRepository) GetEnvOriginal

func (r *EtcdRepository) GetEnvOriginal(ctx context.Context, env string) (string, bool, error)

GetEnvOriginal retrieves the original value of the specified environment from the repository.

func (*EtcdRepository) GetEnvParams

func (r *EtcdRepository) GetEnvParams(ctx context.Context, env string) (EnvParams, error)

GetEnvParams retrieves the environment metadata for the specified key.

func (*EtcdRepository) ReadConfig

func (r *EtcdRepository) ReadConfig(ctx context.Context, repo, env string, groups, globalKeys []string) (map[string]interface{}, error)

func (*EtcdRepository) SetEnvVersion

func (r *EtcdRepository) SetEnvVersion(ctx context.Context, env string, version string) error

SetEnvVersion sets the version metadata for the specified environment in the repository.

func (*EtcdRepository) UpsertConfig

func (r *EtcdRepository) UpsertConfig(ctx context.Context, repo, env string, config *types.ParsedRepoConfig) error

type RedisKeys

type RedisKeys struct{}

func (RedisKeys) GetAllEnvsPatternKey

func (k RedisKeys) GetAllEnvsPatternKey() string

func (RedisKeys) GetBaseKey

func (k RedisKeys) GetBaseKey(gitRepoName string, envName string) string

func (RedisKeys) GetCloneEnvDeletePatternKey

func (k RedisKeys) GetCloneEnvDeletePatternKey(gitRepoName, clonedEnv string) string

func (RedisKeys) GetCloneEnvPatternKey

func (k RedisKeys) GetCloneEnvPatternKey(cloneEnv string) string

func (RedisKeys) GetEnvKey

func (k RedisKeys) GetEnvKey(envName string) string

func (RedisKeys) GetEnvLockKey

func (k RedisKeys) GetEnvLockKey(envName string) string

func (RedisKeys) GetGlobalKeyKey

func (k RedisKeys) GetGlobalKeyKey(baseKeyPrefix string, configKey string) string

func (RedisKeys) GetGlobalPatternKey

func (k RedisKeys) GetGlobalPatternKey(env string, key string) string

func (RedisKeys) GetGroupKey

func (k RedisKeys) GetGroupKey(baseKeyPrefix string, groupName string) string

func (RedisKeys) GetGroupPatternKey

func (k RedisKeys) GetGroupPatternKey(env string, groupName string) string

type RedisRepository

type RedisRepository struct {
	*rds.Redis
	// contains filtered or unexported fields
}

func NewRedisRepository

func NewRedisRepository(redis *rds.Redis) *RedisRepository

func (*RedisRepository) AddEnv

func (r *RedisRepository) AddEnv(ctx context.Context, env string, params EnvParams) error

AddEnv adds metadata for a new environment to the repository.

func (*RedisRepository) CloneConfig

func (r *RedisRepository) CloneConfig(ctx context.Context, repo, cloneEnv, newEnv string, updateGlobal map[string]interface{}) error

func (*RedisRepository) DeleteConfig

func (r *RedisRepository) DeleteConfig(ctx context.Context, repo, env string) error

func (*RedisRepository) DeleteEnv

func (r *RedisRepository) DeleteEnv(ctx context.Context, env string) error

DeleteEnv removes metadata for the specified environment from the repository.

func (*RedisRepository) GetAllEnvs

func (r *RedisRepository) GetAllEnvs(ctx context.Context) ([]EnvParams, error)

GetAllEnvs retrieves all available environments from the repository.

func (*RedisRepository) GetEnvOriginal

func (r *RedisRepository) GetEnvOriginal(ctx context.Context, env string) (string, bool, error)

GetEnvOriginal retrieves the original value of the specified environment from the repository.

func (*RedisRepository) GetEnvParams

func (r *RedisRepository) GetEnvParams(ctx context.Context, env string) (EnvParams, error)

GetEnvParams retrieves the environment metadata for the specified key.

func (*RedisRepository) HealthCheck

func (r *RedisRepository) HealthCheck(ctx context.Context) error

func (*RedisRepository) ReadConfig

func (r *RedisRepository) ReadConfig(ctx context.Context, repo, env string, groups, globalKeys []string) (map[string]interface{}, error)

func (*RedisRepository) SetEnvVersion

func (r *RedisRepository) SetEnvVersion(ctx context.Context, env string, version string) error

SetEnvVersion sets the version metadata for the specified environment in the repository.

func (*RedisRepository) UpsertConfig

func (r *RedisRepository) UpsertConfig(ctx context.Context, repo, env string, config *types.ParsedRepoConfig) error

type Repository

type Repository interface {
	CloneConfig(ctx context.Context, repo, env, newEnv string, updateGlobals map[string]interface{}) error
	ReadConfig(ctx context.Context, repo, env string, groups, globalKeys []string) (map[string]interface{}, error)
	UpsertConfig(ctx context.Context, repo, env string, config *types.ParsedRepoConfig) error
	DeleteConfig(ctx context.Context, repo, env string) error

	AddEnv(ctx context.Context, env string, params EnvParams) error
	DeleteEnv(ctx context.Context, env string) error
	GetEnvOriginal(ctx context.Context, env string) (string, bool, error)
	SetEnvVersion(ctx context.Context, env string, v string) error
	GetAllEnvs(ctx context.Context) ([]EnvParams, error)
	GetEnvParams(ctx context.Context, env string) (EnvParams, error)
}

func New

type RepositoryConfig

type RepositoryConfig struct {
	RedisAddrs    string
	RedisUsername string
	RedisPassword string
	RedisTLS      bool

	EtcdAddrs    []string
	EtcdUsername string
	EtcdPassword string
	EtcdTLS      bool
}

Jump to

Keyboard shortcuts

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