Documentation ¶
Index ¶
- Constants
- type EnvLockHeldError
- type EnvNotFoundError
- type EnvParams
- type EtcdKeys
- func (k EtcdKeys) GetBaseKey(repo string, env string) string
- func (k EtcdKeys) GetCloneEnvPatternKey(cloneEnv string) string
- func (k EtcdKeys) GetEnvKey(env string) string
- func (k EtcdKeys) GetEnvLockKey(env string) string
- func (k EtcdKeys) GetGlobalKey(prefix, key string) string
- func (k EtcdKeys) GetGroupKey(prefix, key string) string
- func (k EtcdKeys) GetReadGlobalRepoEnvKey(repo, env, key string) string
- func (k EtcdKeys) GetReadGroupRepoEnvKey(repo, env, key string) string
- type EtcdRepository
- func (r *EtcdRepository) AddEnv(ctx context.Context, env string, params EnvParams) error
- func (r *EtcdRepository) CloneConfig(ctx context.Context, repo, env, newEnv string, ...) error
- func (r *EtcdRepository) DeleteConfig(ctx context.Context, repo, env string) error
- func (r *EtcdRepository) DeleteEnv(ctx context.Context, env string) error
- func (r *EtcdRepository) GetAllEnvs(ctx context.Context) ([]EnvParams, error)
- func (r *EtcdRepository) GetEnvOriginal(ctx context.Context, env string) (string, bool, error)
- func (r *EtcdRepository) GetEnvParams(ctx context.Context, env string) (EnvParams, error)
- func (r *EtcdRepository) ReadConfig(ctx context.Context, repo, env string, groups, globalKeys []string) (map[string]interface{}, error)
- func (r *EtcdRepository) SetEnvVersion(ctx context.Context, env string, version string) error
- func (r *EtcdRepository) UpsertConfig(ctx context.Context, repo, env string, config *types.ParsedRepoConfig) error
- type RedisKeys
- func (k RedisKeys) GetAllEnvsPatternKey() string
- func (k RedisKeys) GetBaseKey(gitRepoName string, envName string) string
- func (k RedisKeys) GetCloneEnvDeletePatternKey(gitRepoName, clonedEnv string) string
- func (k RedisKeys) GetCloneEnvPatternKey(cloneEnv string) string
- func (k RedisKeys) GetEnvKey(envName string) string
- func (k RedisKeys) GetEnvLockKey(envName string) string
- func (k RedisKeys) GetGlobalKeyKey(baseKeyPrefix string, configKey string) string
- func (k RedisKeys) GetGlobalPatternKey(env string, key string) string
- func (k RedisKeys) GetGroupKey(baseKeyPrefix string, groupName string) string
- func (k RedisKeys) GetGroupPatternKey(env string, groupName string) string
- type RedisRepository
- func (r *RedisRepository) AddEnv(ctx context.Context, env string, params EnvParams) error
- func (r *RedisRepository) CloneConfig(ctx context.Context, repo, cloneEnv, newEnv string, ...) error
- func (r *RedisRepository) DeleteConfig(ctx context.Context, repo, env string) error
- func (r *RedisRepository) DeleteEnv(ctx context.Context, env string) error
- func (r *RedisRepository) GetAllEnvs(ctx context.Context) ([]EnvParams, error)
- func (r *RedisRepository) GetEnvOriginal(ctx context.Context, env string) (string, bool, error)
- func (r *RedisRepository) GetEnvParams(ctx context.Context, env string) (EnvParams, error)
- func (r *RedisRepository) HealthCheck(ctx context.Context) error
- func (r *RedisRepository) ReadConfig(ctx context.Context, repo, env string, groups, globalKeys []string) (map[string]interface{}, error)
- func (r *RedisRepository) SetEnvVersion(ctx context.Context, env string, version string) error
- func (r *RedisRepository) UpsertConfig(ctx context.Context, repo, env string, config *types.ParsedRepoConfig) error
- type Repository
- type RepositoryConfig
Constants ¶
const ( ReadLockMaxRetries = 3 ReadLockRetryInterval = 500 * time.Millisecond )
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) GetCloneEnvPatternKey ¶
func (EtcdKeys) GetEnvLockKey ¶
func (EtcdKeys) GetGlobalKey ¶
func (EtcdKeys) GetGroupKey ¶
func (EtcdKeys) GetReadGlobalRepoEnvKey ¶
func (EtcdKeys) GetReadGroupRepoEnvKey ¶
type EtcdRepository ¶
func NewEtcdRepository ¶
func NewEtcdRepository(etcd *etcd.Etcd) *EtcdRepository
func (*EtcdRepository) CloneConfig ¶
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 ¶
GetEnvOriginal retrieves the original value of the specified environment from the repository.
func (*EtcdRepository) GetEnvParams ¶
GetEnvParams retrieves the environment metadata for the specified key.
func (*EtcdRepository) ReadConfig ¶
func (*EtcdRepository) SetEnvVersion ¶
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 (RedisKeys) GetBaseKey ¶
func (RedisKeys) GetCloneEnvDeletePatternKey ¶
func (RedisKeys) GetCloneEnvPatternKey ¶
func (RedisKeys) GetEnvLockKey ¶
func (RedisKeys) GetGlobalKeyKey ¶
func (RedisKeys) GetGlobalPatternKey ¶
func (RedisKeys) GetGroupKey ¶
type RedisRepository ¶
func NewRedisRepository ¶
func NewRedisRepository(redis *rds.Redis) *RedisRepository
func (*RedisRepository) CloneConfig ¶
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 ¶
GetEnvOriginal retrieves the original value of the specified environment from the repository.
func (*RedisRepository) GetEnvParams ¶
GetEnvParams retrieves the environment metadata for the specified key.
func (*RedisRepository) HealthCheck ¶
func (r *RedisRepository) HealthCheck(ctx context.Context) error
func (*RedisRepository) ReadConfig ¶
func (*RedisRepository) SetEnvVersion ¶
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 ¶
func New(ctx context.Context, cfg RepositoryConfig) (Repository, error)