Table of Contents

Class WorkflowConsensus

Namespace
JD.AI.Workflows.Consensus
Assembly
JD.AI.Workflows.dll

Consensus mechanism for publishing workflows to shared catalogs. Implements a simple approval voting protocol: a workflow version must receive the required number of approvals before it can be published.

public sealed class WorkflowConsensus
Inheritance
WorkflowConsensus
Inherited Members

Constructors

WorkflowConsensus(int)

Creates a new consensus instance.

public WorkflowConsensus(int requiredApprovals = 1)

Parameters

requiredApprovals int

Minimum number of distinct approvals needed to publish. Defaults to 1 (single-user mode).

Properties

ProposalCount

Number of active proposals.

public int ProposalCount { get; }

Property Value

int

Methods

Approve(string, string, string)

Approves a pending proposal. Each user can only approve once.

public bool Approve(string workflowName, string version, string approver)

Parameters

workflowName string
version string
approver string

Returns

bool

GetProposal(string, string)

Gets the current proposal for a workflow version.

public PublishProposal? GetProposal(string workflowName, string version)

Parameters

workflowName string
version string

Returns

PublishProposal

ListProposals(ProposalStatus?)

Lists all proposals with an optional status filter.

public IReadOnlyList<PublishProposal> ListProposals(ProposalStatus? status = null)

Parameters

status ProposalStatus?

Returns

IReadOnlyList<PublishProposal>

Propose(string, string, string)

Creates a proposal to publish a workflow version.

public PublishProposal Propose(string workflowName, string version, string proposer)

Parameters

workflowName string
version string
proposer string

Returns

PublishProposal

Reject(string, string, string, string)

Rejects a pending proposal with a reason.

public bool Reject(string workflowName, string version, string rejector, string reason)

Parameters

workflowName string
version string
rejector string
reason string

Returns

bool

RemoveProposal(string, string)

Removes a resolved (approved/rejected) proposal.

public bool RemoveProposal(string workflowName, string version)

Parameters

workflowName string
version string

Returns

bool