Documentation ¶
Index ¶
Constants ¶
const ( ProcessStatusComplete = "complete" ProcessStatusPending = "pending" ProcessStatusExecuting = "executing" ProcessStatusFailed = "failed" )
MirrorProcess different statuses.
const ( // Indicates initial mirroring process. ProcessTypeInit = "init" // Indicates re-mirroring process. ProcessTypeSync = "sync" // Indicates dry run process. ProcessTypeDryRun = "dryrun" )
MirrorProcess different types.
const RuntimeVariableNameRegexPattern = `^(([a-zA-Z][a-zA-Z0-9_\-\.]*[a-zA-Z0-9])|([a-zA-Z]))$`
Variables ¶
var ( // ErrNotFound is a common error type that should be returned by any store implementation // for the error cases when getting a single entry failed due to none existence. ErrNotFound = errors.New("ErrNotFound") // ErrDuplication is a common error type that should be returned by any store implementation // when tying to violate unique constraints. ErrDuplication = errors.New("ErrDuplication") )
var ( ErrInvalidNamespaceName = errors.New("ErrInvalidNamespaceName") ErrDuplicatedNamespaceName = errors.New("ErrDuplicatedNamespaceName") )
var ErrInvalidRuntimeVariableName = errors.New("ErrInvalidRuntimeVariableName")
Functions ¶
This section is empty.
Types ¶
type LogStore ¶ added in v0.8.4
type LogStore interface { GetNewer(ctx context.Context, track string, t time.Time) ([]core.LogEntry, error) GetOlder(ctx context.Context, track string, t time.Time) ([]core.LogEntry, error) GetStartingIDUntilTime(ctx context.Context, track string, lastID int, t time.Time) ([]core.LogEntry, error) GetNewerInstance(ctx context.Context, track string, t time.Time) ([]core.LogEntry, error) GetOlderInstance(ctx context.Context, track string, t time.Time) ([]core.LogEntry, error) GetStartingIDUntilTimeInstance(ctx context.Context, track string, lastID int, t time.Time) ([]core.LogEntry, error) DeleteOldLogs(ctx context.Context, t time.Time) error }
LogStore manages storing and querying LogEntries.
type MirrorConfig ¶ added in v0.8.3
type MirrorConfig struct { Namespace string `json:"-"` URL string `json:"url"` GitRef string `json:"gitRef,omitempty"` AuthToken string `json:"-"` PublicKey string `json:"publicKey,omitempty"` PrivateKey string `json:"-"` PrivateKeyPassphrase string `json:"-"` CreatedAt time.Time `json:"createdAt"` UpdatedAt time.Time `json:"updatedAt"` Insecure bool `json:"insecure"` }
MirrorConfig holds configuration data that are needed to create a mirror (pulling mirror credentials, urls, keys and any other details).
type MirrorProcess ¶ added in v0.8.3
type MirrorProcess struct { ID uuid.UUID `json:"id"` Namespace string `json:"-"` Status string `json:"status"` Typ string `json:"-"` EndedAt time.Time `json:"endedAt"` CreatedAt time.Time `json:"createdAt"` UpdatedAt time.Time `json:"updatedAt"` }
MirrorProcess represents an instance of mirroring process that happened or is currently happened. For every mirroring process gets executing, a MirrorProcess instance should be created with datastore.MirrorStore.
type MirrorStore ¶ added in v0.8.3
type MirrorStore interface { // CreateConfig stores a new config in the store. CreateConfig(ctx context.Context, config *MirrorConfig) (*MirrorConfig, error) // UpdateConfig updates a config in the store. UpdateConfig(ctx context.Context, config *MirrorConfig) (*MirrorConfig, error) // GetConfig gets config by namespace from the store. GetConfig(ctx context.Context, namespace string) (*MirrorConfig, error) GetAllConfigs(ctx context.Context) ([]*MirrorConfig, error) // DeleteConfig deletes mirror config of a namespace DeleteConfig(ctx context.Context, namespace string) error // CreateProcess stores a new process in the store. CreateProcess(ctx context.Context, process *MirrorProcess) (*MirrorProcess, error) // UpdateProcess update a process in the store. UpdateProcess(ctx context.Context, process *MirrorProcess) (*MirrorProcess, error) // GetProcess gets a process by id from the store. GetProcess(ctx context.Context, id uuid.UUID) (*MirrorProcess, error) // GetProcessesByNamespace gets all processes that belong to a namespace from the store. GetProcessesByNamespace(ctx context.Context, namespace string) ([]*MirrorProcess, error) // GetUnfinishedProcesses gets all processes that haven't completed from the store. GetUnfinishedProcesses(ctx context.Context) ([]*MirrorProcess, error) // DeleteOldProcesses deletes all old processes. DeleteOldProcesses(ctx context.Context, before time.Time) error }
MirrorStore *doesn't* lunch any mirroring process. MirrorStore is only responsible for fetching and setting datastore.MirrorConfig and datastore.MirrorProcess from datastore. nolint: interfacebloat
type Namespace ¶ added in v0.8.3
type Namespace struct { ID uuid.UUID `json:"-"` Name string `json:"name"` CreatedAt time.Time `json:"createdAt"` UpdatedAt time.Time `json:"updatedAt"` }
func (*Namespace) GetAttributes ¶ added in v0.8.3
type NamespacesStore ¶ added in v0.8.3
type NamespacesStore interface { // GetByID gets a single namespace object from store. if no record found, // it returns datastore.ErrNotFound error. GetByID(ctx context.Context, id uuid.UUID) (*Namespace, error) // GetByName gets a single namespace object from store. if no record found, // it returns datastore.ErrNotFound error. GetByName(ctx context.Context, name string) (*Namespace, error) // GetAll gets all namespaces from store. GetAll(ctx context.Context) ([]*Namespace, error) // Delete deletes a single namespace. if no record found, // it returns datastore.ErrNotFound error. Delete(ctx context.Context, name string) error // Create creates a new namespace. Returned errors could be ErrDuplicatedNamespaceName when namespace name is // already exists or ErrInvalidNamespaceName or when namespace name is invalid, too short or too long. Create(ctx context.Context, namespace *Namespace) (*Namespace, error) }
NamespacesStore responsible for fetching and setting namespaces from datastore.
type RuntimeVariable ¶ added in v0.8.3
type RuntimeVariable struct { ID uuid.UUID Namespace string WorkflowPath string InstanceID uuid.UUID Name string Size int MimeType string Data []byte CreatedAt time.Time UpdatedAt time.Time }
RuntimeVariable are direktiv runtime variables that hold data, workflows performs getting and setting on these data, RuntimeVariables also preserve state across multiple workflow runs.
type RuntimeVariablePatch ¶ added in v0.8.3
type RuntimeVariablePatch struct { Name *string `json:"name"` MimeType *string `json:"mimeType"` Data []byte `json:"data"` }
RuntimeVariablePatch is used to update a runtime variable.
type RuntimeVariablesStore ¶ added in v0.8.3
type RuntimeVariablesStore interface { // GetByID gets a single runtime variable from store. if no record found, // it returns datastore.ErrNotFound error. GetByID(ctx context.Context, id uuid.UUID) (*RuntimeVariable, error) // GetForNamespace gets a single runtime variable from store by namespace ID and name. if no record found, // it returns datastore.ErrNotFound error. GetForNamespace(ctx context.Context, namespace string, name string) (*RuntimeVariable, error) // GetForWorkflow gets a single runtime variable from store by namespace ID, workflow path, and name. if no record found, // it returns datastore.ErrNotFound error. GetForWorkflow(ctx context.Context, namespace string, workflowPath, name string) (*RuntimeVariable, error) // GetForInstance gets a single runtime variable from store by instance ID and name. if no record found, // it returns datastore.ErrNotFound error. GetForInstance(ctx context.Context, instanceID uuid.UUID, name string) (*RuntimeVariable, error) // ListForInstance gets all runtime variable entries from store that are linked to specific instance id ListForInstance(ctx context.Context, instanceID uuid.UUID) ([]*RuntimeVariable, error) // ListForWorkflow gets all runtime variable entries from store that are linked to specific namespace & workflow path ListForWorkflow(ctx context.Context, namespace string, workflowPath string) ([]*RuntimeVariable, error) // ListForNamespace gets all runtime variable entries from store that are at namespace level. ListForNamespace(ctx context.Context, namespace string) ([]*RuntimeVariable, error) // Set tries to update runtime variable data and mimetype fields or insert a new one if no matching variable to // update. Param variable should have one reference field set and name field set. // Deprecated method, use Create or Patch. Set(ctx context.Context, variable *RuntimeVariable) (*RuntimeVariable, error) Create(ctx context.Context, variable *RuntimeVariable) (*RuntimeVariable, error) Patch(ctx context.Context, id uuid.UUID, patch *RuntimeVariablePatch) (*RuntimeVariable, error) // DeleteForWorkflow removes all entries that are linked to a workflow. DeleteForWorkflow(ctx context.Context, namespace string, workflowPath string) error // SetWorkflowPath updates workflow path link. SetWorkflowPath(ctx context.Context, namespace string, oldWorkflowPath string, newWorkflowPath string) error // Delete removes the whole entry from store. if no record found it returns datastore.ErrNotFound error. Delete(ctx context.Context, id uuid.UUID) error // LoadData reads data field of a variable. if no record found it returns datastore.ErrNotFound error. LoadData(ctx context.Context, id uuid.UUID) ([]byte, error) }
RuntimeVariablesStore responsible for fetching and setting direktiv runtime variables from datastore.
type Secret ¶ added in v0.8.3
type Secret struct { Name string `json:"name"` Namespace string `json:"-"` Data []byte `json:"-"` CreatedAt time.Time `json:"createdAt"` UpdatedAt time.Time `json:"updatedAt"` }
Secret are namespace level variables that are hold sensitive data, can be used inside workflows the same namespace.
type SecretsStore ¶ added in v0.8.3
type SecretsStore interface { // Get gets a single namespace secret from the store. if no record found, // it returns ErrNotFound error. Get(ctx context.Context, namespace string, name string) (*Secret, error) // Set either creates (if not exists) a secret or updates the existing one. Param name should be unique. Set(ctx context.Context, secret *Secret) error // GetAll lists all namespace secrets. GetAll(ctx context.Context, namespace string) ([]*Secret, error) // Update changes a secret data. Update(ctx context.Context, secret *Secret) error // Delete removes a specific secret by name. Delete(ctx context.Context, namespace string, name string) error }
SecretsStore responsible for fetching and setting namespace secrets from datastore.
type Store ¶
type Store interface { Namespaces() NamespacesStore // Mirror returns datastore.MirrorStore, is responsible for reading and writing mirrors information. Mirror() MirrorStore NewLogs() LogStore Secrets() SecretsStore RuntimeVariables() RuntimeVariablesStore EventHistory() events.EventHistoryStore EventListener() events.EventListenerStore EventListenerTopics() events.EventTopicsStore StagingEvents() events.StagingEventStore }
Store object wraps all different direktiv application stores.