controller

package
v0.47.0 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2026 License: Apache-2.0 Imports: 33 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	KindModel      = model.KindModel
	KindDeployment = model.KindDeployment
	KindInstance   = model.KindInstance
)
View Source
const (
	Read         = permissions.Read
	Write        = permissions.Write
	Execute      = permissions.Execute
	Administrate = permissions.Administrate
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AdministrateChecker

type AdministrateChecker interface {
	HasAdministrate(ctx context.Context, namespace string, kind model.Kind, id string, user string) (bool, error)
}

AdministrateChecker is implemented by authorizers that know shared rights (SEC-11).

type Controller

type Controller struct {
	// contains filtered or unexported fields
}

func New

func (*Controller) Convert

func (this *Controller) Convert(ctx context.Context, token string, namespace string, xml string) (model.Conversion, error)

Convert rewrites a model written for Camunda 7 and validates the result against the rules of the namespace, without storing it (MIG-04).

func (*Controller) CorrelateMessage

func (this *Controller) CorrelateMessage(ctx context.Context, token string, input model.MessageInput) (model.CorrelationResult, error)

CorrelateMessage delivers a message to the caller's instances and deployments; admins, e.g. the event-worker with client credentials, correlate across owners or for one owner (EVT-01).

func (*Controller) CreateDeployment

func (this *Controller) CreateDeployment(ctx context.Context, token string, namespace string, input model.DeploymentInput) (model.Deployment, error)

func (*Controller) CreateModel

func (this *Controller) CreateModel(ctx context.Context, token string, namespace string, input model.ModelInput) (result model.Model, err error)

func (*Controller) CreateSchedule

func (this *Controller) CreateSchedule(ctx context.Context, token string, namespace string, input model.ScheduleInput) (result model.Schedule, err error)

CreateSchedule needs the execute right on the deployment; the starts run as its owner.

func (*Controller) CurrentModelVersions added in v0.37.0

func (this *Controller) CurrentModelVersions(ctx context.Context, token string, namespace string, ids []string) (result map[string]model.ModelVersion, err error)

CurrentModelVersions reads the current version of the models ids the caller may read, keyed by model id; an id the caller may not read is missing. The rights are read once and checked in the query, so a list costs one transaction instead of one per model with a check each.

func (*Controller) DebugState

func (this *Controller) DebugState(ctx context.Context, token string, namespace string, id string, options model.DebugOptions) (result model.DebugState, err error)

DebugState returns the live state of an instance (DBG-02) with the read right on it or as admin (DBG-08); large values are cut and can be loaded with GetVariable (DBG-04).

func (*Controller) DeleteDeployment

func (this *Controller) DeleteDeployment(ctx context.Context, token string, namespace string, id string) error

DeleteDeployment removes all versions with instances, history, incidents and start events in one transaction (DEP-11).

func (*Controller) DeleteInstances

func (this *Controller) DeleteInstances(ctx context.Context, token string, namespace string, ids []string) error

DeleteInstances removes instances with history, variables, incidents and runtime state (HIST-03); a running instance is removed as well.

func (*Controller) DeleteIoValue

func (this *Controller) DeleteIoValue(ctx context.Context, token string, key string) error

func (*Controller) DeleteModel

func (this *Controller) DeleteModel(ctx context.Context, token string, namespace string, id string, force bool) error

DeleteModel deletes a model unless deployments of module tasks use it; force deletes it anyway and is for admins (SMS-15)

func (*Controller) DeleteModule

func (this *Controller) DeleteModule(ctx context.Context, token string, namespace string, id string) error

DeleteModule removes a module; its resource is removed through the outbox (SMS-06).

func (*Controller) DeleteNamespace

func (this *Controller) DeleteNamespace(ctx context.Context, token string, name string) error

func (*Controller) DeleteSchedule

func (this *Controller) DeleteSchedule(ctx context.Context, token string, namespace string, id string) error

func (*Controller) DeleteUser

func (this *Controller) DeleteUser(ctx context.Context, token string, userId string) error

DeleteUser removes everything the user owns in all namespaces and the user's rights on resources of others (SEC-08). Resources of others that depend on the user's resources are deleted with notification of their owners, or the deletion is rejected, as the namespace decides (SEC-13). Rights are removed first: if permissions-v2 fails, nothing is deleted and the call can be repeated.

func (*Controller) DeleteUserData

func (this *Controller) DeleteUserData(ctx context.Context, userId string) error

DeleteUserData deletes a user without a request token, e.g. for the Kafka topic user, which remains as fallback for users deleted outside of user-management (SEC-14).

func (*Controller) DeleteVariable

func (this *Controller) DeleteVariable(ctx context.Context, token string, namespace string, id string, name string) error

DeleteVariable removes a variable of an instance (SMS-10).

func (*Controller) DeploymentInstanceCount

func (this *Controller) DeploymentInstanceCount(ctx context.Context, token string, namespace string, id string, version int) (result model.Count, err error)

DeploymentInstanceCount counts the instances of all users on a version of a deployment, for those who may administrate it, e.g. to see how many have not moved to a new version yet

func (*Controller) DeploymentParameters

func (this *Controller) DeploymentParameters(ctx context.Context, token string, namespace string, id string) ([]model.ParameterDescription, error)

DeploymentParameters describes the start parameters of a deployment with their options; it needs execute on the deployment, as before for releases (SMS-08).

func (*Controller) DeploymentVersions added in v0.37.0

func (this *Controller) DeploymentVersions(ctx context.Context, token string, namespace string, ids []string, current bool, limit int, offset int) (result []model.DeploymentVersion, total int, err error)

DeploymentVersions lists the versions of the deployments ids the caller may read: with current the current version of each, otherwise every version kept. They follow the order of ids, newest first per deployment; an id the caller may not read is left out, as is a repeated id. limit and offset select a window of that order before the content is read, a limit of 0 means all; total counts the whole order. The rights are read once and checked in the query, so the versions of a list cost one transaction instead of one per version with a check each.

func (*Controller) DeploymentsUsable added in v0.10.4

func (this *Controller) DeploymentsUsable(ctx context.Context, token string, namespace string, ids []string) (map[string]bool, error)

DeploymentsUsable reports per deployment whether every start parameter of its current version has an option for the caller, the usable flag of release lists (SMS-08). Deployments without the execute right, or unknown ones, are not usable. It checks the rights once and holds no database connection while it asks other services; each description costs device-selection about 100 ms of work, so a list of a few dozen releases takes seconds. A flag that is not computed when ctx ends is missing from the result; its computation goes on and serves the next call from a cache for a few minutes.

func (*Controller) EventEvaluations

func (this *Controller) EventEvaluations(ctx context.Context, token string, namespace string, id string, options model.EventReconstructionOptions) (result model.EventReconstruction, err error)

EventEvaluations reconstructs the evaluations of a device event while its element waited, from the values in the time series and with the code of the event worker (EVT-10, EVT-11).

func (*Controller) GetDeployment

func (this *Controller) GetDeployment(ctx context.Context, token string, namespace string, id string) (result model.Deployment, err error)

func (*Controller) GetDeploymentSource added in v0.7.0

func (this *Controller) GetDeploymentSource(ctx context.Context, token string, namespace string, id string, version int) (result model.ModelVersion, err error)

GetDeploymentSource returns the model version a version of a deployment was created from, as it was saved, before the conversion for the engine. Reading the deployment is enough: whoever sees a release sees what it was made of, as with the copy smart-service-repository kept. ErrNotFound if the version names no model or the model version is gone.

func (*Controller) GetDeploymentVersion

func (this *Controller) GetDeploymentVersion(ctx context.Context, token string, namespace string, id string, version int) (result model.DeploymentVersion, err error)

func (*Controller) GetInstance

func (this *Controller) GetInstance(ctx context.Context, token string, namespace string, id string) (result model.Instance, err error)

func (*Controller) GetIoValue

func (this *Controller) GetIoValue(ctx context.Context, token string, key string) (model.IoValue, error)

func (*Controller) GetModel

func (this *Controller) GetModel(ctx context.Context, token string, namespace string, id string) (result model.Model, err error)

func (*Controller) GetModelVersion

func (this *Controller) GetModelVersion(ctx context.Context, token string, namespace string, id string, version int) (result model.ModelVersion, err error)

func (*Controller) GetModule

func (this *Controller) GetModule(ctx context.Context, token string, namespace string, id string) (result model.Module, err error)

func (*Controller) GetNamespace

func (this *Controller) GetNamespace(ctx context.Context, token string, namespace string) (model.Namespace, error)

func (*Controller) GetNetwork

func (this *Controller) GetNetwork(ctx context.Context, token string, networkId string) (model.Network, error)

GetNetwork shows a gateway with the desired and the applied state of its resources (SYNC-13).

func (*Controller) GetSchedule

func (this *Controller) GetSchedule(ctx context.Context, token string, namespace string, id string) (result model.Schedule, err error)

func (*Controller) GetStartParameters

func (this *Controller) GetStartParameters(ctx context.Context, token string, namespace string, deploymentId string) (result []model.StartParameter, err error)

func (*Controller) GetUserDependents

func (this *Controller) GetUserDependents(ctx context.Context, token string, userId string) (result model.UserDependents, err error)

GetUserDependents is the dry run of DeleteUser; user-management calls it before any service deletes anything (SEC-14).

func (*Controller) GetUserSettings

func (this *Controller) GetUserSettings(ctx context.Context, token string, userId string) (result model.UserSettings, err error)

func (*Controller) GetVariable

func (this *Controller) GetVariable(ctx context.Context, token string, namespace string, id string, name string, elementId string) (result model.Variable, err error)

GetVariable returns the complete current value of a variable; with elementId the local variable of a token at that element (DBG-04).

func (*Controller) GetVariables

func (this *Controller) GetVariables(ctx context.Context, token string, namespace string, id string) (result []model.Variable, err error)

func (*Controller) HistoryState

func (this *Controller) HistoryState(ctx context.Context, token string, namespace string, id string, options model.HistoryOptions) (result model.DebugState, err error)

HistoryState reconstructs the state of an instance after an activity entry (DBG-13).

func (*Controller) HistoryVariable

func (this *Controller) HistoryVariable(ctx context.Context, token string, namespace string, id string, name string, elementId string, options model.HistoryOptions) (result model.HistoryVariable, err error)

HistoryVariable returns the complete value of a variable at a step of the history; with elementId the local variable of that element (DBG-04).

func (*Controller) ImportNetwork added in v0.21.0

func (this *Controller) ImportNetwork(ctx context.Context, token string, networkId string, doc model.GatewayExport, options model.NetworkImportOptions) (result model.NetworkImport, err error)

ImportNetwork takes over the deployments of a gateway from its export into a cloud that does not know them, with their ids and versions, so that the gateway applies them without an update; its instances follow with the synchronisation (SNRGY-5066). Admins only.

The deployments are written directly, not through createDeployment: that starts at version 1, and the gateway ignores a version below the one it runs (fogsync applyDeployment), now and for every later change in the cloud. Deployments that exist stay as they are, so that a repeated import creates nothing.

func (*Controller) IoBulk

func (this *Controller) IoBulk(ctx context.Context, token string, bulk model.IoBulk) ([]model.IoValue, error)

func (*Controller) ListActivities

func (this *Controller) ListActivities(ctx context.Context, token string, namespace string, id string, options model.ActivityListOptions) (result model.ActivityPage, err error)

func (*Controller) ListBlockedScripts added in v0.31.0

func (this *Controller) ListBlockedScripts(ctx context.Context, token string) (result []model.BlockedScript, err error)

ListBlockedScripts lists the scripts that ended the engine; admins only (EXPR-03).

func (*Controller) ListDeploymentVersions

func (this *Controller) ListDeploymentVersions(ctx context.Context, token string, namespace string, id string, options model.PageOptions) (result model.Page[model.DeploymentVersion], err error)

func (*Controller) ListDeployments

func (this *Controller) ListDeployments(ctx context.Context, token string, namespace string, options model.DeploymentListOptions) (result model.Page[model.Deployment], err error)

func (*Controller) ListElementStats

func (this *Controller) ListElementStats(ctx context.Context, token string, namespace string, id string, run int) (result []model.ElementStats, err error)

func (*Controller) ListEventDescriptions

func (this *Controller) ListEventDescriptions(ctx context.Context, token string, namespace string, deploymentId string) (result []model.EventDescription, err error)

ListEventDescriptions lists the event descriptions of the current version of a deployment; those of older versions serve instances still running on them (DEP-04).

func (*Controller) ListIncidents

func (this *Controller) ListIncidents(ctx context.Context, token string, namespace string, options model.IncidentListOptions) (result model.Page[model.Incident], err error)

func (*Controller) ListInstances

func (this *Controller) ListInstances(ctx context.Context, token string, namespace string, options model.InstanceListOptions) (result model.Page[model.Instance], err error)

func (*Controller) ListIoValues

func (this *Controller) ListIoValues(ctx context.Context, token string, options model.IoListOptions) (model.Page[model.IoValue], error)

ListIoValues lists the process-io values of the caller (IO-02).

func (*Controller) ListMaintenanceProcedures

func (this *Controller) ListMaintenanceProcedures(ctx context.Context, token string, namespace string, id string) (result []model.MaintenanceProcedure, err error)

ListMaintenanceProcedures lists the procedures an instance offers (SMS-13).

func (*Controller) ListModelVersions

func (this *Controller) ListModelVersions(ctx context.Context, token string, namespace string, id string, options model.PageOptions) (result model.Page[model.ModelVersion], err error)

func (*Controller) ListModels

func (this *Controller) ListModels(ctx context.Context, token string, namespace string, options model.ModelListOptions) (result model.Page[model.Model], err error)

func (*Controller) ListModules

func (this *Controller) ListModules(ctx context.Context, token string, namespace string, options model.ModuleListOptions) (result model.Page[model.Module], err error)

ListModules lists the modules of the instances a user may read (SMS-12).

func (*Controller) ListNamespaces

func (this *Controller) ListNamespaces(ctx context.Context, token string) ([]model.Namespace, error)

func (*Controller) ListNetworks

func (this *Controller) ListNetworks(ctx context.Context, token string) ([]model.Network, error)

ListNetworks shows the gateways the user may read with their synchronisation (SYNC-12).

func (*Controller) ListRuns

func (this *Controller) ListRuns(ctx context.Context, token string, namespace string, id string) (result []model.Run, err error)

func (*Controller) ListSchedules

func (this *Controller) ListSchedules(ctx context.Context, token string, namespace string, options model.ScheduleListOptions) (result model.Page[model.Schedule], err error)

ListSchedules lists the schedules of the caller; admins see all (RUN-07).

func (*Controller) MaintenanceParameters

func (this *Controller) MaintenanceParameters(ctx context.Context, token string, namespace string, id string, procedure string) ([]model.ParameterDescription, error)

MaintenanceParameters describes the parameters of a maintenance procedure (SMS-13).

func (*Controller) PrepareDeployment

func (this *Controller) PrepareDeployment(ctx context.Context, token string, namespace string, input model.PrepareInput) (result model.PreparedDeployment, err error)

PrepareDeployment returns what a deploy dialog needs: start parameters, validation findings and the selectable devices, groups and imports per device task and device event (DEP-01).

func (*Controller) PublishModel

func (this *Controller) PublishModel(ctx context.Context, token string, namespace string, id string, input model.PublishInput) (result model.Model, err error)

func (*Controller) PutDeployment

func (this *Controller) PutDeployment(ctx context.Context, token string, namespace string, id string, input model.DeploymentInput) (result model.Deployment, err error)

PutDeployment creates a deployment with the given id or updates it. An update with the same BPMN and metadata as the current version changes nothing, so that repeating it is harmless.

func (*Controller) PutInstance

func (this *Controller) PutInstance(ctx context.Context, token string, namespace string, id string, input model.StartInstanceInput) (model.Instance, error)

func (*Controller) PutModel added in v0.16.1

func (this *Controller) PutModel(ctx context.Context, token string, namespace string, id string, input model.ModelInput) (result model.Model, err error)

PutModel creates a model with the given id or updates it, as smart-service-repository did with designs (SNRGY-5035). An id that a model the caller cannot see or a deployment of another user carries is refused with a conflict, so that nobody takes over the releases of others (SNRGY-4993).

func (*Controller) PutNamespace

func (this *Controller) PutNamespace(ctx context.Context, token string, name string, ns model.Namespace) (model.Namespace, error)

PutNamespace creates or changes a namespace with its permissions-v2 topics (NS-02, NS-05).

func (*Controller) RecomputeDeviceGroup

func (this *Controller) RecomputeDeviceGroup(ctx context.Context, groupId string) error

RecomputeDeviceGroup recomputes the deployments whose events depend on a device group.

func (*Controller) RecomputeEvents

func (this *Controller) RecomputeEvents(ctx context.Context, deploymentId string) error

RecomputeEvents derives the event descriptions again, e.g. after a device group changed (DEP-08): of the current version and of every older version that still has descriptions for instances running on it (DEP-04), each from its own model and selections. A gateway gets those of its current version with its deployment; older ones it keeps as it got them.

func (*Controller) RemoveResource

func (this *Controller) RemoveResource(ctx context.Context, ref model.ResourceRef) error

RemoveResource removes a deployment, instance or watch a module refers to (SMS-06); one of a gateway is deleted there as well, as through the API (SMS-12).

func (*Controller) ResetRestarts

func (this *Controller) ResetRestarts(ctx context.Context, token string, namespace string, id string) (result model.Deployment, err error)

ResetRestarts clears the faulty mark of a deployment after a restart loop (INC-04). A gateway counts the restarts of its instances itself and reports the mark with its status (SYNC-02), so for a deployment of a gateway the reset happens there first; an unreachable gateway answers unavailable and nothing changes. On a gateway it needs the right x there, as a start does.

func (*Controller) ResourceUsage

func (this *Controller) ResourceUsage(ctx context.Context, token string, namespace string, kind string, id string) (result model.ResourceUsage, err error)

ResourceUsage counts who uses a process model, flow or import type, so that its repository can refuse to delete it (SMS-15)

func (*Controller) RestartInstance

func (this *Controller) RestartInstance(ctx context.Context, token string, namespace string, id string, input model.RestartInput) (model.Instance, error)

func (*Controller) Rights added in v0.33.3

func (this *Controller) Rights(ctx context.Context, token string, namespace string, kind model.Kind, ids []string) (map[string]model.Rights, error)

Rights names what the caller may do with the given resources, for clients that show it: everything for an admin, otherwise what permissions-v2 computes. Ownership is left out, because the caller knows the owners; an id without rights is missing from the answer.

func (*Controller) SetDeploymentDisabled

func (this *Controller) SetDeploymentDisabled(ctx context.Context, token string, namespace string, id string, input model.DisabledInput) (result model.Deployment, err error)

SetDeploymentDisabled switches a deployment off or on (DEP-12). Off stops its running instances; while it is off, starts through the API are refused and schedules, timer and message starts are skipped. Updates keep the state. Deployments of gateways cannot be switched off, as with the engine wrapper.

func (*Controller) SetDescriber

func (this *Controller) SetDescriber(describer *events.Describer)

SetDescriber enables event descriptions for event workers (DEP-07).

func (*Controller) SetEventDebugging

func (this *Controller) SetEventDebugging(series events.Series, evaluator *events.Evaluator, userToken auth.UserTokenSource)

SetEventDebugging enables the reconstruction of event evaluations (EVT-10) and the evaluation of the current value of waiting events (DBG-18); both read with the token of the owner.

func (*Controller) SetHubs added in v0.23.1

func (this *Controller) SetHubs(hubs devicerepository.Interface, adminToken auth.TokenSource)

SetHubs reads the owners of networks from the hubs of device-repository, to whom deployments and instances of gateways belong (FOG-11); adminToken reads them for TakeOverNetworkOwners.

func (*Controller) SetIo

func (this *Controller) SetIo(io *processio.Service)

SetIo enables the process-io API (IO-02).

func (*Controller) SetIoValue

func (this *Controller) SetIoValue(ctx context.Context, token string, key string, input model.IoValueInput) error

func (*Controller) SetLive

func (this *Controller) SetLive(hub *debug.Hub, settings LiveSettings)

SetLive enables live debug streams.

func (*Controller) SetNetworks

func (this *Controller) SetNetworks(networks Networks)

SetNetworks enables deployments to gateways.

func (*Controller) SetOwner

func (this *Controller) SetOwner(ctx context.Context, token string, namespace string, kind model.Kind, id string, input model.OwnerInput) error

SetOwner changes the owner of a resource. Allowed are platform admins and users who administrate the resource; the new owner must already administrate it (SEC-11).

func (*Controller) SetParameters

func (this *Controller) SetParameters(describer *prepare.Describer, userToken auth.UserTokenSource)

SetParameters enables start parameters with options (SMS-08); userToken serves starts without a caller, e.g. by the watcher.

func (*Controller) SetPreparation

func (this *Controller) SetPreparation(preparer *prepare.Preparer, access *prepare.Access)

SetPreparation enables selection options and access checks of selected devices.

func (*Controller) SetUserSettings

func (this *Controller) SetUserSettings(ctx context.Context, token string, userId string, settings model.UserSettings) (model.UserSettings, error)

SetUserSettings sets the limits of a user; a lower retention applies at once (HIST-04).

func (*Controller) SetVariable

func (this *Controller) SetVariable(ctx context.Context, token string, namespace string, id string, name string, value any) error

func (*Controller) StartInstance

func (this *Controller) StartInstance(ctx context.Context, token string, namespace string, input model.StartInstanceInput) (model.Instance, error)

func (*Controller) StartMaintenance

func (this *Controller) StartMaintenance(ctx context.Context, token string, namespace string, id string, procedure string, input model.MaintenanceStartInput) (model.Instance, error)

StartMaintenance starts a procedure of an instance as an instance of its own that refers to it; administrate on the instance is needed, as before (SMS-13). It starts also while a run of the procedure is running, since a user asked for it.

func (*Controller) StartMaintenanceInternal

func (this *Controller) StartMaintenanceInternal(ctx context.Context, id string, procedure string, variables map[string]any) (model.Instance, error)

StartMaintenanceInternal starts a procedure without a caller, e.g. for the watcher (TASK-27); the procedure runs as the owner of the instance. While a run of the procedure is running, it queues a rerun with the variables instead and returns no instance (SNRGY-5143).

func (*Controller) StartMaintenanceRerun added in v0.44.6

func (this *Controller) StartMaintenanceRerun(ctx context.Context, rerun store.MaintenanceRerun) (model.Instance, error)

StartMaintenanceRerun starts a rerun queued by StartMaintenanceInternal and removes it. It starts nothing and returns no instance while a run of the procedure is running or once another replica started the rerun.

func (*Controller) StopInstances

func (this *Controller) StopInstances(ctx context.Context, token string, namespace string, ids []string) error

func (*Controller) TakeOverNetworkOwners added in v0.16.0

func (this *Controller) TakeOverNetworkOwners(ctx context.Context) error

TakeOverNetworkOwners gives deployments and instances of gateways from before FOG-11 the owner of their network; the rights of the owner are registered by the permission sync. A network whose owner cannot be read is left as it is and named in the error.

func (*Controller) TriggerWait added in v0.22.0

func (this *Controller) TriggerWait(ctx context.Context, token string, namespace string, id string, elementId string, input model.TriggerInput) error

TriggerWait needs the write right like setting a variable: it changes the course of the instance, which the read right of the debugger does not cover (DBG-17, DBG-08).

func (*Controller) UnblockScript added in v0.31.0

func (this *Controller) UnblockScript(ctx context.Context, token string, fingerprint string) error

UnblockScript removes a script from the blocklist; admins only (EXPR-03). This replica applies it at once, the others when they see the new revision.

func (*Controller) UpdateInstanceInfo

func (this *Controller) UpdateInstanceInfo(ctx context.Context, token string, namespace string, id string, input model.InstanceInfoInput) (result model.Instance, err error)

UpdateInstanceInfo changes name and description of an instance; they are no part of the run, so instances of a gateway take them in the cloud.

func (*Controller) UpdateModel

func (this *Controller) UpdateModel(ctx context.Context, token string, namespace string, id string, input model.ModelInput) (result model.Model, err error)

func (*Controller) UpdateParameters

func (this *Controller) UpdateParameters(ctx context.Context, token string, namespace string, id string, input model.ParametersInput) (model.Instance, error)

UpdateParameters restarts an instance with new start parameters; the new run removes the modules of the previous one (SMS-03, SMS-09). Needs administrate on the instance and execute on its deployment, as before.

func (*Controller) UpdateSchedule

func (this *Controller) UpdateSchedule(ctx context.Context, token string, namespace string, id string, input model.ScheduleInput) (result model.Schedule, err error)

func (*Controller) Validate

func (this *Controller) Validate(ctx context.Context, token string, namespace string, xml string) ([]model.Issue, error)

func (*Controller) Watch

func (this *Controller) Watch(ctx context.Context, token string, namespace string, id string, options model.WatchOptions) (<-chan model.DebugMessage, error)

Watch streams the debug state of an instance: a snapshot, then deltas, and the end state when the instance ends (DBG-01). The channel closes when the stream ends or ctx is done; a stream that ends without end message was interrupted and can be resumed with After.

type Granter added in v0.16.0

type Granter interface {
	Grant(ctx context.Context, namespace string, kind model.Kind, id string, owner string, user string, rights model.Rights) error
	CheckGranted(ctx context.Context, token jwt.Token, namespace string, kind model.Kind, id string, right Right) (bool, error)
	GrantedIds(ctx context.Context, token jwt.Token, namespace string, kind model.Kind, right Right) ([]string, error)
}

Granter gives users other than the owner rights on resources of gateways and evaluates them also where the namespace does not share the kind (FOG-11).

type HubChecker

type HubChecker interface {
	CheckHub(ctx context.Context, token jwt.Token, networkId string, right Right) (bool, error)
	// the ids of the gateways the user may read
	ReadableHubs(ctx context.Context, token jwt.Token) ([]string, error)
}

HubChecker checks rights on gateways in permissions-v2, topic hubs (SEC-05).

type LiveSettings

type LiveSettings struct {
	// streams per user and replica
	MaxPerUser int
	// deltas are merged when changes come faster than this
	MinInterval time.Duration
	// a stream checks its instance at least this often, in case a wake-up got lost
	Fallback time.Duration
	// a resume or a delta covering more activity entries sends a new snapshot instead
	MaxDeltaActivities int
	// interval of the evaluation of the current value of waiting events (DBG-18)
	EventInterval time.Duration
}

LiveSettings bound the live debug streams (DBG-10).

func DefaultLiveSettings

func DefaultLiveSettings() LiveSettings

type Namespaces

type Namespaces interface {
	Get(name string) (model.Namespace, bool)
	List() []model.Namespace
	Put(ctx context.Context, ns model.Namespace) (model.Namespace, bool, error)
	Delete(ctx context.Context, name string) error
}

Namespaces is the namespace registry (NS-02).

type Networks

type Networks interface {
	Desire(tx *store.Tx, networkId string, resource fogsync.Resource) error
	// sends the desired state now instead of with the next pass
	Wake()
	// asks the gateway to send its change stream from the position the cloud took, instead
	// of with its next status (SNRGY-5066)
	RequestChanges(ctx context.Context, networkId string) error
	// the networks with the ids, all if ids is nil, with their resources if detailed
	Overview(ctx context.Context, ids []string, detailed bool) ([]model.Network, error)
	// reads from a gateway (DBG-15) and watches an instance there (DBG-12)
	Call(ctx context.Context, networkId string, method string, namespace string, instance string, args fogsync.RequestArgs, result any) error
	Watch(ctx context.Context, networkId string, namespace string, instance string, options model.WatchOptions) (<-chan model.DebugMessage, error)
}

Networks keeps the desired state of gateways; set in the cloud when the synchronisation with gateways is configured (DEP-09, SYNC-01). Deployments and instances of a gateway are stored in the cloud with their network id, but run on the gateway: the cloud only desires them.

type Registrar added in v0.10.6

type Registrar interface {
	Register(ctx context.Context, namespace string, kind model.Kind, id string, owner string) error
}

Registrar gives the owner of a resource its rights in permissions-v2 right away instead of with the next sync (SEC-11)

type Right = permissions.Right

type RightsLister added in v0.33.3

type RightsLister interface {
	Rights(ctx context.Context, token jwt.Token, namespace string, kind model.Kind, ids []string) (map[string]model.Rights, error)
}

RightsLister is implemented by authorizers that can name the rights a token holds through sharing.

type UserRemover

type UserRemover interface {
	RemoveUser(ctx context.Context, userId string, owners permissions.Owners) error
}

UserRemover removes a deleted user's rights on resources of others (SEC-08).

Jump to

Keyboard shortcuts

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