Documentation ¶
Overview ¶
Package projmanager contains functionality to execute commands (such as creating, updating, or deleting) entities (such as environments and filters) based on inspection of the entity's project key.
Index ¶
- type AutoConfigActions
- type EnvironmentActions
- type EnvironmentManager
- func (e *EnvironmentManager) AddEnvironment(env envfactory.EnvironmentParams)
- func (e *EnvironmentManager) AddFilter(filter envfactory.FilterParams)
- func (e *EnvironmentManager) DeleteEnvironment(id config.EnvironmentID) bool
- func (e *EnvironmentManager) DeleteFilter(filter config.FilterID) bool
- func (e *EnvironmentManager) Environments() []config.EnvironmentID
- func (e *EnvironmentManager) Filters() []config.FilterKey
- func (e *EnvironmentManager) KeyExpired(id config.EnvironmentID, oldKey config.SDKKey)
- func (e *EnvironmentManager) UpdateEnvironment(env envfactory.EnvironmentParams)
- type ProjectRouter
- func (e *ProjectRouter) AddEnvironment(params envfactory.EnvironmentParams)
- func (e *ProjectRouter) AddFilter(params envfactory.FilterParams)
- func (e *ProjectRouter) DeleteEnvironment(id config.EnvironmentID)
- func (e *ProjectRouter) DeleteFilter(id config.FilterID)
- func (e *ProjectRouter) KeyExpired(id config.EnvironmentID, projKey string, oldKey config.SDKKey)
- func (e *ProjectRouter) Manager(projKey string) *EnvironmentManager
- func (e *ProjectRouter) Projects() []string
- func (e *ProjectRouter) ReceivedAllEnvironments()
- func (e *ProjectRouter) UpdateEnvironment(params envfactory.EnvironmentParams)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AutoConfigActions ¶
type AutoConfigActions interface { EnvironmentActions ReceivedAllEnvironments() }
AutoConfigActions represents all possible concrete actions that may occur based on autoconfig messages.
type EnvironmentActions ¶
type EnvironmentActions interface { AddEnvironment(params envfactory.EnvironmentParams) UpdateEnvironment(params envfactory.EnvironmentParams) DeleteEnvironment(id config.EnvironmentID, filter config.FilterKey) KeyExpired(id config.EnvironmentID, filter config.FilterKey, oldKey config.SDKKey) }
type EnvironmentManager ¶
type EnvironmentManager struct {
// contains filtered or unexported fields
}
An EnvironmentManager manages the opening, modification, and closing of connections to LaunchDarkly environments for a particular LaunchDarkly project.
Assume there are M projects, each of which has N environments and K filters configured. Then: - M EnvironmentManagers must be instantiated - Within a given EnvironmentManager, N "default" environments must be setup - Additionally, N*K "filtered environments" must be setup In total, each EnvironmentManager would then manage N*(K+1) environments.
func NewEnvironmentManager ¶
func NewEnvironmentManager(project string, handler EnvironmentActions, loggers ldlog.Loggers) *EnvironmentManager
func (*EnvironmentManager) AddEnvironment ¶
func (e *EnvironmentManager) AddEnvironment(env envfactory.EnvironmentParams)
func (*EnvironmentManager) AddFilter ¶
func (e *EnvironmentManager) AddFilter(filter envfactory.FilterParams)
func (*EnvironmentManager) DeleteEnvironment ¶
func (e *EnvironmentManager) DeleteEnvironment(id config.EnvironmentID) bool
func (*EnvironmentManager) DeleteFilter ¶
func (e *EnvironmentManager) DeleteFilter(filter config.FilterID) bool
func (*EnvironmentManager) Environments ¶
func (e *EnvironmentManager) Environments() []config.EnvironmentID
func (*EnvironmentManager) Filters ¶
func (e *EnvironmentManager) Filters() []config.FilterKey
func (*EnvironmentManager) KeyExpired ¶
func (e *EnvironmentManager) KeyExpired(id config.EnvironmentID, oldKey config.SDKKey)
func (*EnvironmentManager) UpdateEnvironment ¶
func (e *EnvironmentManager) UpdateEnvironment(env envfactory.EnvironmentParams)
type ProjectRouter ¶
type ProjectRouter struct {
// contains filtered or unexported fields
}
ProjectRouter is responsible for accepting commands relating to the creation, destruction, or modification of environments and filters, and then forwarding them to a ProjectManager based on the environment/filter's project key.
func NewProjectRouter ¶
func NewProjectRouter(handler AutoConfigActions, loggers ldlog.Loggers) *ProjectRouter
NewProjectRouter creates a new router which is ready to accept commands.
func (*ProjectRouter) AddEnvironment ¶
func (e *ProjectRouter) AddEnvironment(params envfactory.EnvironmentParams)
AddEnvironment routes the given EnvironmentParams to the relevant ProjectManager based on its project key, or instantiates a new ProjectManager if one doesn't already exist.
func (*ProjectRouter) AddFilter ¶
func (e *ProjectRouter) AddFilter(params envfactory.FilterParams)
AddFilter routes the given FilterRep to the relevant ProjectManager based on its project key, or instantiates a new ProjectManager if one doesn't already exist.
func (*ProjectRouter) DeleteEnvironment ¶
func (e *ProjectRouter) DeleteEnvironment(id config.EnvironmentID)
DeleteEnvironment dispatches a deletion command for the given environment ID to all ProjectManagers. It is assumed that environment IDs are unique, and therefore only one manager will service the request.
func (*ProjectRouter) DeleteFilter ¶
func (e *ProjectRouter) DeleteFilter(id config.FilterID)
DeleteFilter dispatches a deletion command for the given filter ID to all ProjectManagers. It is assumed that filter IDs are unique, and therefore only one manager will service the request.
func (*ProjectRouter) KeyExpired ¶
func (e *ProjectRouter) KeyExpired(id config.EnvironmentID, projKey string, oldKey config.SDKKey)
KeyExpired indicates that an SDK key, scoped to a particular project, has expired. The command is forwarded on to the manager, if any, for the given projKey.
func (*ProjectRouter) Manager ¶
func (e *ProjectRouter) Manager(projKey string) *EnvironmentManager
func (*ProjectRouter) Projects ¶
func (e *ProjectRouter) Projects() []string
func (*ProjectRouter) ReceivedAllEnvironments ¶
func (e *ProjectRouter) ReceivedAllEnvironments()
ReceivedAllEnvironments directly invokes the underlying AutoConfigAction's ReceivedAllEnvironments method.
func (*ProjectRouter) UpdateEnvironment ¶
func (e *ProjectRouter) UpdateEnvironment(params envfactory.EnvironmentParams)
UpdateEnvironment routes the given EnvironmentParams to the relevant ProjectManager based on its project key. If no such manager exists, the params are ignored and an error is logged.