Documentation ¶
Index ¶
- Variables
- func ConvertToGRPC(cfg *Config) (*spec.Config, error)
- func ConvertToGRPCEvents(w Events) (*spec.Events, error)
- func ConvertToGRPCTaskEvent(te TaskEvent) (*spec.TaskEvent, error)
- func ConvertToGRPCWorkflow(w Workflow) *spec.Workflow
- type ClusterState
- type Clusters
- type Config
- type Events
- type InMemoryStore
- func (i *InMemoryStore) Close() error
- func (i *InMemoryStore) CreateConfig(_ context.Context, config *Config) error
- func (i *InMemoryStore) DeleteConfig(_ context.Context, name string, version uint64) error
- func (i *InMemoryStore) GetConfig(_ context.Context, name string) (*Config, error)
- func (i *InMemoryStore) HealthCheck() error
- func (i *InMemoryStore) ListConfigs(_ context.Context, filter *ListFilter) ([]*Config, error)
- func (i *InMemoryStore) MarkForDeletion(_ context.Context, name string, version uint64) error
- func (i *InMemoryStore) UpdateConfig(_ context.Context, config *Config) error
- type KubernetesContext
- type ListFilter
- type Manifest
- type Mongo
- func (m *Mongo) Close() error
- func (m *Mongo) CreateConfig(ctx context.Context, config *Config) error
- func (m *Mongo) DeleteConfig(ctx context.Context, name string, version uint64) error
- func (m *Mongo) GetConfig(ctx context.Context, name string) (*Config, error)
- func (m *Mongo) HealthCheck() error
- func (m *Mongo) Init() error
- func (m *Mongo) ListConfigs(ctx context.Context, filter *ListFilter) ([]*Config, error)
- func (m *Mongo) MarkForDeletion(ctx context.Context, name string, version uint64) error
- func (m *Mongo) UpdateConfig(ctx context.Context, config *Config) error
- type Store
- type TaskEvent
- type Workflow
Constants ¶
This section is empty.
Variables ¶
var ErrNotFoundOrDirty = errors.New("failed to find requested document. It is possible that this operation was a Dirty Write. Consider fetching the latest version of the requested document to repeat the read-write cycle")
ErrNotFoundOrDirty is returned when the requested document couldn't be found inside the database or a Dirty Write occurred.
Functions ¶
func ConvertToGRPC ¶
ConvertToGRPC converts from database representation to GRPC representation. For clusters, it mimics the GRPC unmarshalling style where if a field was not set within a message it will be nil instead of a zero value for that type.
func ConvertToGRPCEvents ¶
ConvertToGRPCEvents converts the database representation of events to GRPC.
func ConvertToGRPCWorkflow ¶
ConvertToGRPCWorkflow converts the database representation of the workflow state to GRPC.
Types ¶
type ClusterState ¶
type Config ¶
type Config struct { Version uint64 `bson:"version"` Name string `bson:"name"` K8SCtx KubernetesContext `bson:"kubernetesContext"` Manifest Manifest `bson:"manifest"` Clusters map[string]*ClusterState `bson:"clusters"` }
type Events ¶
type InMemoryStore ¶
type InMemoryStore struct {
// contains filtered or unexported fields
}
func NewInMemoryStore ¶
func NewInMemoryStore() *InMemoryStore
func (*InMemoryStore) Close ¶
func (i *InMemoryStore) Close() error
func (*InMemoryStore) CreateConfig ¶
func (i *InMemoryStore) CreateConfig(_ context.Context, config *Config) error
func (*InMemoryStore) DeleteConfig ¶
func (*InMemoryStore) HealthCheck ¶
func (i *InMemoryStore) HealthCheck() error
func (*InMemoryStore) ListConfigs ¶
func (i *InMemoryStore) ListConfigs(_ context.Context, filter *ListFilter) ([]*Config, error)
func (*InMemoryStore) MarkForDeletion ¶
func (*InMemoryStore) UpdateConfig ¶
func (i *InMemoryStore) UpdateConfig(_ context.Context, config *Config) error
type KubernetesContext ¶
type ListFilter ¶
type ListFilter struct {
ManifestState []string
}
ListFilter wraps supported filters for listing configs.
type Mongo ¶
type Mongo struct {
// contains filtered or unexported fields
}
func (*Mongo) CreateConfig ¶
func (*Mongo) DeleteConfig ¶
func (*Mongo) HealthCheck ¶
func (*Mongo) ListConfigs ¶
func (*Mongo) MarkForDeletion ¶
type Store ¶
type Store interface { io.Closer healthcheck.HealthChecker // CreateConfig creates a new config. It is up to the application logic to determine if the // config already exists or not. On conflict, the creation will error out. The Version field // of the config will always be overwritten to 0 as new configs always start with a version of 0. CreateConfig(ctx context.Context, config *Config) error // UpdateConfig updates an existing config in the database with the new supplied data. If there is no document // that matches the Config.Name and Config.Version the ErrNotFoundOrDirty err is returned. It is up to the application // code to determine, if the write was Dirty (i.e. outdated Document version used) or there is no such document with the // requested Config.Name and Config.Version combination. Before updating the document, a higher document version // number by 1 will replace the supplied number in Config.Version (i.e. Config.Version += 1). UpdateConfig(ctx context.Context, config *Config) error // GetConfig queries the document with the Config.Name. If no such document is found the ErrNotFoundOrDirty err // is returned. In this case it always will be the case that the document is absent. This can be used by the application // code to determine an absent document or Dirty Write. GetConfig(ctx context.Context, name string) (*Config, error) // ListConfigs queries all documents stored that satisfy the passed in ListFilter. ListConfigs(ctx context.Context, filter *ListFilter) ([]*Config, error) // DeleteConfig will delete the document with the requested Config.Name and Config.Version combination. // If No documents with the given combination were deleted the ErrNotFoundOrDirty err is returned. It is up // to the application code to handle the case in which a Dirty Write occurred or the document does not exist. DeleteConfig(ctx context.Context, name string, version uint64) error // MarkForDeletion will mark the infrastructure in the document with the requested Config.Name and Config.Version for // deletion. If No documents with the given combination were marked for deletion the ErrNotFoundOrDirty err is returned. It is up // to the application code to handle the case in which a Dirty Write occurred or the document does not exist. MarkForDeletion(ctx context.Context, name string, version uint64) error }
type Workflow ¶
type Workflow struct { Status string `bson:"status"` Stage string `bson:"stage"` Description string `bson:"description"` Timestamp string `bson:"timestamp"` }
func ConvertFromGRPCWorkflow ¶
ConvertFromGRPCWorkflow converts the workflow state data from GRPC to the database representation.