View Source Lightning.Workflows.Snapshot (Lightning v2.10.4)
Ecto model for Workflow Snapshots.
Snapshots are a way to store the state of a workflow at a given point in time.
Summary
Functions
Get the latest snapshot for a workflow, based on the lock_version.
Get the latest snapshot for a workflow, or create one if it doesn't exist.
Types
@type t() :: %Lightning.Workflows.Snapshot{ __meta__: Ecto.Schema.Metadata.t(), edges: [ %Lightning.Workflows.Snapshot.Edge{ condition_expression: term(), condition_label: term(), condition_type: term(), enabled: term(), id: term(), inserted_at: term(), source_job_id: term(), source_trigger_id: term(), target_job_id: term(), updated_at: term() } ], id: Ecto.UUID.t() | nil, inserted_at: term(), jobs: [ %Lightning.Workflows.Snapshot.Job{ adaptor: term(), body: term(), credential: term(), id: term(), inserted_at: term(), name: term(), project_credential: term(), project_credential_id: term(), updated_at: term() } ], lock_version: term(), name: String.t() | nil, triggers: [ %Lightning.Workflows.Snapshot.Trigger{ comment: term(), cron_expression: term(), custom_path: term(), enabled: term(), has_auth_method: term(), id: term(), inserted_at: term(), kafka_configuration: term(), type: term(), updated_at: term(), webhook_auth_methods: term() } ], workflow: nil | Lightning.Workflows.Workflow.t() | Ecto.Association.NotLoaded.t(), workflow_id: term() }
Functions
@spec build(Lightning.Workflows.Workflow.t()) :: Ecto.Changeset.t()
@spec create(Lightning.Workflows.Workflow.t()) :: {:ok, t()} | {:error, Ecto.Changeset.t()}
@spec get_all_for(Lightning.Workflows.Workflow.t()) :: [t()]
@spec get_current_for(Lightning.Workflows.Workflow.t()) :: t() | nil
Get the latest snapshot for a workflow, based on the lock_version.
It returns the latest snapshot regardless of the lock_version of the
workflow passed in. This is intentional to ensure that
get_or_create_latest_for/1
doesn't attempt to create a new snapshot if the
workflow has been updated elsewhere.
@spec get_or_create_latest_for( Lightning.Workflows.Workflow.t(), struct() ) :: {:ok, t()} | {:error, Ecto.Changeset.t()}
Get the latest snapshot for a workflow, or create one if it doesn't exist.
Link to this function
get_or_create_latest_for(multi, name \\ :snapshot, workflow, actor)
View Source@spec get_or_create_latest_for( Ecto.Multi.t(), binary() | :snapshot, Lightning.Workflows.Workflow.t(), struct() ) :: Ecto.Multi.t()