mutexv1

package
v0.7.4 Latest Latest
Warning

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

Go to latest
Published: May 24, 2023 License: MIT Imports: 16 Imported by: 0

Documentation

Overview

Code generated by protoc-gen-go_temporal. DO NOT EDIT. versions:

protoc-gen-go_temporal 0.7.4-next (05ff63d873553461ccbd6746528d541d03300b50)
go go1.20.4
protoc (unknown)

source: example.proto

Index

Constants

View Source
const (
	MutexWorkflowName                   = "mycompany.mutex.v1.Mutex.MutexWorkflow"
	SampleWorkflowWithMutexWorkflowName = "mycompany.mutex.v1.Mutex.SampleWorkflowWithMutexWorkflow"
)

Mutex workflow names

View Source
const (
	AcquireLeaseSignalName  = "mycompany.mutex.v1.Mutex.AcquireLeaseSignal"
	LeaseAcquiredSignalName = "mycompany.mutex.v1.Mutex.LeaseAcquiredSignal"
	RenewLeaseSignalName    = "mycompany.mutex.v1.Mutex.RenewLeaseSignal"
	RevokeLeaseSignalName   = "mycompany.mutex.v1.Mutex.RevokeLeaseSignal"
)

Mutex signal names

View Source
const (
	MutexActivityName = "mycompany.mutex.v1.Mutex.MutexActivity"
)

Mutex activity names

View Source
const MutexTaskQueue = "mutex-v1"

MutexTaskQueue is the default task-queue for a Mutex worker

Variables

View Source
var (
	MutexIDExpression                   = expression.MustParseExpression("mutex/${!resource}")
	SampleWorkflowWithMutexIDExpression = expression.MustParseExpression("sample-workflow-with-mutex/${!resource}/${!uuid_v4()}")
)

Mutex id expressions

View Source
var File_example_proto protoreflect.FileDescriptor

Functions

func AcquireLeaseExternal

func AcquireLeaseExternal(ctx workflow.Context, workflowID string, runID string, req *AcquireLeaseRequest) workflow.Future

AcquireLeaseExternal sends a AcquireLease signal to an existing workflow

func LeaseAcquiredExternal

func LeaseAcquiredExternal(ctx workflow.Context, workflowID string, runID string, req *LeaseAcquiredRequest) workflow.Future

LeaseAcquiredExternal sends a LeaseAcquired signal to an existing workflow

func RegisterActivities

func RegisterActivities(r worker.Registry, activities Activities)

RegisterActivities registers activities with a worker

func RegisterMutexActivity

func RegisterMutexActivity(r worker.Registry, fn func(context.Context, *MutexRequest) error)

RegisterMutexActivity registers a Mutex activity

func RegisterMutexWorkflow

func RegisterMutexWorkflow(r worker.Registry, wf func(workflow.Context, *MutexInput) (MutexWorkflow, error))

RegisterMutexWorkflow registers a Mutex workflow with the given worker

func RegisterSampleWorkflowWithMutexWorkflow

func RegisterSampleWorkflowWithMutexWorkflow(r worker.Registry, wf func(workflow.Context, *SampleWorkflowWithMutexInput) (SampleWorkflowWithMutexWorkflow, error))

RegisterSampleWorkflowWithMutexWorkflow registers a SampleWorkflowWithMutex workflow with the given worker

func RegisterWorkflows

func RegisterWorkflows(r worker.Registry, workflows Workflows)

RegisterWorkflows registers Mutex workflows with the given worker

func RenewLeaseExternal

func RenewLeaseExternal(ctx workflow.Context, workflowID string, runID string, req *RenewLeaseRequest) workflow.Future

RenewLeaseExternal sends a RenewLease signal to an existing workflow

func RevokeLeaseExternal

func RevokeLeaseExternal(ctx workflow.Context, workflowID string, runID string, req *RevokeLeaseRequest) workflow.Future

RevokeLeaseExternal sends a RevokeLease signal to an existing workflow

Types

type AcquireLeaseRequest added in v0.7.1

type AcquireLeaseRequest struct {
	WorkflowId string               `protobuf:"bytes,1,opt,name=workflow_id,json=workflowId,proto3" json:"workflow_id,omitempty"`
	Timeout    *durationpb.Duration `protobuf:"bytes,2,opt,name=timeout,proto3" json:"timeout,omitempty"`
	// contains filtered or unexported fields
}

AcquireLeaseRequest describes the input to a AcquireLease signal

func (*AcquireLeaseRequest) Descriptor deprecated added in v0.7.1

func (*AcquireLeaseRequest) Descriptor() ([]byte, []int)

Deprecated: Use AcquireLeaseRequest.ProtoReflect.Descriptor instead.

func (*AcquireLeaseRequest) GetTimeout added in v0.7.1

func (x *AcquireLeaseRequest) GetTimeout() *durationpb.Duration

func (*AcquireLeaseRequest) GetWorkflowId added in v0.7.1

func (x *AcquireLeaseRequest) GetWorkflowId() string

func (*AcquireLeaseRequest) ProtoMessage added in v0.7.1

func (*AcquireLeaseRequest) ProtoMessage()

func (*AcquireLeaseRequest) ProtoReflect added in v0.7.1

func (x *AcquireLeaseRequest) ProtoReflect() protoreflect.Message

func (*AcquireLeaseRequest) Reset added in v0.7.1

func (x *AcquireLeaseRequest) Reset()

func (*AcquireLeaseRequest) String added in v0.7.1

func (x *AcquireLeaseRequest) String() string

type AcquireLeaseSignal

type AcquireLeaseSignal struct {
	Channel workflow.ReceiveChannel
}

AcquireLeaseSignal describes a AcquireLease signal

func (*AcquireLeaseSignal) Receive added in v0.7.1

Receive blocks until a AcquireLease signal is received

func (*AcquireLeaseSignal) ReceiveAsync added in v0.7.1

func (s *AcquireLeaseSignal) ReceiveAsync() *AcquireLeaseRequest

ReceiveAsync checks for a AcquireLease signal without blocking

func (*AcquireLeaseSignal) Select added in v0.7.1

Select checks for a AcquireLease signal without blocking

type Activities

type Activities interface {
	// Mutex provides a mutex over a shared resource
	Mutex(ctx context.Context, req *MutexRequest) error
}

Activities describes available worker activites

type Client

type Client interface {
	// Mutex provides a mutex over a shared resource
	Mutex(ctx context.Context, opts *client.StartWorkflowOptions, req *MutexRequest) error
	// ExecuteMutex executes a Mutex workflow
	ExecuteMutex(ctx context.Context, opts *client.StartWorkflowOptions, req *MutexRequest) (MutexRun, error)
	// GetMutex retrieves a Mutex workflow execution
	GetMutex(ctx context.Context, workflowID string, runID string) (MutexRun, error)
	// StartMutexWithAcquireLease sends a AcquireLease signal to a Mutex workflow, starting it if not present
	StartMutexWithAcquireLease(ctx context.Context, opts *client.StartWorkflowOptions, req *MutexRequest, signal *AcquireLeaseRequest) (MutexRun, error)
	// SampleWorkflowWithMutex provides an example of a running workflow that uses
	// a Mutex workflow to prevent concurrent access to a shared resource
	SampleWorkflowWithMutex(ctx context.Context, opts *client.StartWorkflowOptions, req *SampleWorkflowWithMutexRequest) (*SampleWorkflowWithMutexResponse, error)
	// ExecuteSampleWorkflowWithMutex executes a SampleWorkflowWithMutex workflow
	ExecuteSampleWorkflowWithMutex(ctx context.Context, opts *client.StartWorkflowOptions, req *SampleWorkflowWithMutexRequest) (SampleWorkflowWithMutexRun, error)
	// GetSampleWorkflowWithMutex retrieves a SampleWorkflowWithMutex workflow execution
	GetSampleWorkflowWithMutex(ctx context.Context, workflowID string, runID string) (SampleWorkflowWithMutexRun, error)
	// SignalAcquireLease sends a AcquireLease signal to an existing workflow
	SignalAcquireLease(ctx context.Context, workflowID string, runID string, signal *AcquireLeaseRequest) error
	// SignalLeaseAcquired sends a LeaseAcquired signal to an existing workflow
	SignalLeaseAcquired(ctx context.Context, workflowID string, runID string, signal *LeaseAcquiredRequest) error
	// SignalRenewLease sends a RenewLease signal to an existing workflow
	SignalRenewLease(ctx context.Context, workflowID string, runID string, signal *RenewLeaseRequest) error
	// SignalRevokeLease sends a RevokeLease signal to an existing workflow
	SignalRevokeLease(ctx context.Context, workflowID string, runID string, signal *RevokeLeaseRequest) error
}

Client describes a client for a Mutex worker

func NewClient

func NewClient(c client.Client) Client

NewClient initializes a new Mutex client

func NewClientWithOptions

func NewClientWithOptions(c client.Client, opts client.Options) (Client, error)

NewClientWithOptions initializes a new Mutex client with the given options

type LeaseAcquiredRequest added in v0.7.1

type LeaseAcquiredRequest struct {
	WorkflowId string `protobuf:"bytes,1,opt,name=workflow_id,json=workflowId,proto3" json:"workflow_id,omitempty"`
	RunId      string `protobuf:"bytes,2,opt,name=run_id,json=runId,proto3" json:"run_id,omitempty"`
	LeaseId    string `protobuf:"bytes,3,opt,name=lease_id,json=leaseId,proto3" json:"lease_id,omitempty"`
	// contains filtered or unexported fields
}

LeaseAcquiredRequest describes the input to a LeaseAcquired signal

func (*LeaseAcquiredRequest) Descriptor deprecated added in v0.7.1

func (*LeaseAcquiredRequest) Descriptor() ([]byte, []int)

Deprecated: Use LeaseAcquiredRequest.ProtoReflect.Descriptor instead.

func (*LeaseAcquiredRequest) GetLeaseId added in v0.7.1

func (x *LeaseAcquiredRequest) GetLeaseId() string

func (*LeaseAcquiredRequest) GetRunId added in v0.7.1

func (x *LeaseAcquiredRequest) GetRunId() string

func (*LeaseAcquiredRequest) GetWorkflowId added in v0.7.1

func (x *LeaseAcquiredRequest) GetWorkflowId() string

func (*LeaseAcquiredRequest) ProtoMessage added in v0.7.1

func (*LeaseAcquiredRequest) ProtoMessage()

func (*LeaseAcquiredRequest) ProtoReflect added in v0.7.1

func (x *LeaseAcquiredRequest) ProtoReflect() protoreflect.Message

func (*LeaseAcquiredRequest) Reset added in v0.7.1

func (x *LeaseAcquiredRequest) Reset()

func (*LeaseAcquiredRequest) String added in v0.7.1

func (x *LeaseAcquiredRequest) String() string

type LeaseAcquiredSignal

type LeaseAcquiredSignal struct {
	Channel workflow.ReceiveChannel
}

LeaseAcquiredSignal describes a LeaseAcquired signal

func (*LeaseAcquiredSignal) Receive added in v0.7.1

Receive blocks until a LeaseAcquired signal is received

func (*LeaseAcquiredSignal) ReceiveAsync added in v0.7.1

func (s *LeaseAcquiredSignal) ReceiveAsync() *LeaseAcquiredRequest

ReceiveAsync checks for a LeaseAcquired signal without blocking

func (*LeaseAcquiredSignal) Select added in v0.7.1

Select checks for a LeaseAcquired signal without blocking

type MutexChildRun

type MutexChildRun struct {
	Future workflow.ChildWorkflowFuture
}

MutexChildRun describes a child Mutex workflow run

func MutexChild

MutexChild executes a child Mutex workflow

func (*MutexChildRun) AcquireLease

func (r *MutexChildRun) AcquireLease(ctx workflow.Context, input *AcquireLeaseRequest) workflow.Future

AcquireLease sends the corresponding signal request to the child workflow

func (*MutexChildRun) Get

func (r *MutexChildRun) Get(ctx workflow.Context) error

Get blocks until the workflow is completed, returning the response value

func (*MutexChildRun) RenewLease

func (r *MutexChildRun) RenewLease(ctx workflow.Context, input *RenewLeaseRequest) workflow.Future

RenewLease sends the corresponding signal request to the child workflow

func (*MutexChildRun) RevokeLease

func (r *MutexChildRun) RevokeLease(ctx workflow.Context, input *RevokeLeaseRequest) workflow.Future

RevokeLease sends the corresponding signal request to the child workflow

func (*MutexChildRun) Select

func (r *MutexChildRun) Select(sel workflow.Selector, fn func(MutexChildRun)) workflow.Selector

Select adds this completion to the selector. Callback can be nil.

func (*MutexChildRun) SelectStart

func (r *MutexChildRun) SelectStart(sel workflow.Selector, fn func(MutexChildRun)) workflow.Selector

SelectStart adds waiting for start to the selector. Callback can be nil.

func (*MutexChildRun) WaitStart

func (r *MutexChildRun) WaitStart(ctx workflow.Context) (*workflow.Execution, error)

WaitStart waits for the child workflow to start

type MutexFuture

type MutexFuture struct {
	Future workflow.Future
}

MutexFuture describes a Mutex activity execution

func Mutex

Mutex provides a mutex over a shared resource

func MutexLocal

Mutex provides a mutex over a shared resource

func (*MutexFuture) Get

func (f *MutexFuture) Get(ctx workflow.Context) error

Get blocks on a Mutex execution, returning the response

func (*MutexFuture) Select

func (f *MutexFuture) Select(sel workflow.Selector, fn func(*MutexFuture)) workflow.Selector

Select adds the Mutex completion to the selector, callback can be nil

type MutexInput

type MutexInput struct {
	Req          *MutexRequest
	AcquireLease *AcquireLeaseSignal
	RenewLease   *RenewLeaseSignal
	RevokeLease  *RevokeLeaseSignal
}

MutexInput describes the input to a Mutex workflow constructor

type MutexRequest

type MutexRequest struct {
	Resource string `protobuf:"bytes,1,opt,name=resource,proto3" json:"resource,omitempty"`
	// contains filtered or unexported fields
}

MutexRequest describes the input to a Mutex workflow/activity

func (*MutexRequest) Descriptor deprecated

func (*MutexRequest) Descriptor() ([]byte, []int)

Deprecated: Use MutexRequest.ProtoReflect.Descriptor instead.

func (*MutexRequest) GetResource

func (x *MutexRequest) GetResource() string

func (*MutexRequest) ProtoMessage

func (*MutexRequest) ProtoMessage()

func (*MutexRequest) ProtoReflect

func (x *MutexRequest) ProtoReflect() protoreflect.Message

func (*MutexRequest) Reset

func (x *MutexRequest) Reset()

func (*MutexRequest) String

func (x *MutexRequest) String() string

type MutexRun

type MutexRun interface {
	// ID returns the workflow ID
	ID() string
	// RunID returns the workflow instance ID
	RunID() string
	// Get blocks until the workflow is complete and returns the result
	Get(ctx context.Context) error
	// AcquireLease sends a AcquireLease signal to the workflow
	AcquireLease(ctx context.Context, req *AcquireLeaseRequest) error
	// RenewLease sends a RenewLease signal to the workflow
	RenewLease(ctx context.Context, req *RenewLeaseRequest) error
	// RevokeLease sends a RevokeLease signal to the workflow
	RevokeLease(ctx context.Context, req *RevokeLeaseRequest) error
}

MutexRun describes a Mutex workflow run

type MutexWorkflow

type MutexWorkflow interface {
	// Execute a Mutex workflow
	Execute(ctx workflow.Context) error
}

Mutex provides a mutex over a shared resource

type RenewLeaseRequest added in v0.7.1

type RenewLeaseRequest struct {
	LeaseId string               `protobuf:"bytes,1,opt,name=lease_id,json=leaseId,proto3" json:"lease_id,omitempty"`
	Timeout *durationpb.Duration `protobuf:"bytes,2,opt,name=timeout,proto3" json:"timeout,omitempty"`
	// contains filtered or unexported fields
}

RenewLeaseRequest describes the input to a RenewLease signal

func (*RenewLeaseRequest) Descriptor deprecated added in v0.7.1

func (*RenewLeaseRequest) Descriptor() ([]byte, []int)

Deprecated: Use RenewLeaseRequest.ProtoReflect.Descriptor instead.

func (*RenewLeaseRequest) GetLeaseId added in v0.7.1

func (x *RenewLeaseRequest) GetLeaseId() string

func (*RenewLeaseRequest) GetTimeout added in v0.7.1

func (x *RenewLeaseRequest) GetTimeout() *durationpb.Duration

func (*RenewLeaseRequest) ProtoMessage added in v0.7.1

func (*RenewLeaseRequest) ProtoMessage()

func (*RenewLeaseRequest) ProtoReflect added in v0.7.1

func (x *RenewLeaseRequest) ProtoReflect() protoreflect.Message

func (*RenewLeaseRequest) Reset added in v0.7.1

func (x *RenewLeaseRequest) Reset()

func (*RenewLeaseRequest) String added in v0.7.1

func (x *RenewLeaseRequest) String() string

type RenewLeaseSignal

type RenewLeaseSignal struct {
	Channel workflow.ReceiveChannel
}

RenewLeaseSignal describes a RenewLease signal

func (*RenewLeaseSignal) Receive added in v0.7.1

Receive blocks until a RenewLease signal is received

func (*RenewLeaseSignal) ReceiveAsync added in v0.7.1

func (s *RenewLeaseSignal) ReceiveAsync() *RenewLeaseRequest

ReceiveAsync checks for a RenewLease signal without blocking

func (*RenewLeaseSignal) Select added in v0.7.1

Select checks for a RenewLease signal without blocking

type RevokeLeaseRequest added in v0.7.1

type RevokeLeaseRequest struct {
	LeaseId string `protobuf:"bytes,1,opt,name=lease_id,json=leaseId,proto3" json:"lease_id,omitempty"`
	// contains filtered or unexported fields
}

RevokeLeaseRequest describes the input to a RevokeLease signal

func (*RevokeLeaseRequest) Descriptor deprecated added in v0.7.1

func (*RevokeLeaseRequest) Descriptor() ([]byte, []int)

Deprecated: Use RevokeLeaseRequest.ProtoReflect.Descriptor instead.

func (*RevokeLeaseRequest) GetLeaseId added in v0.7.1

func (x *RevokeLeaseRequest) GetLeaseId() string

func (*RevokeLeaseRequest) ProtoMessage added in v0.7.1

func (*RevokeLeaseRequest) ProtoMessage()

func (*RevokeLeaseRequest) ProtoReflect added in v0.7.1

func (x *RevokeLeaseRequest) ProtoReflect() protoreflect.Message

func (*RevokeLeaseRequest) Reset added in v0.7.1

func (x *RevokeLeaseRequest) Reset()

func (*RevokeLeaseRequest) String added in v0.7.1

func (x *RevokeLeaseRequest) String() string

type RevokeLeaseSignal

type RevokeLeaseSignal struct {
	Channel workflow.ReceiveChannel
}

RevokeLeaseSignal describes a RevokeLease signal

func (*RevokeLeaseSignal) Receive added in v0.7.1

Receive blocks until a RevokeLease signal is received

func (*RevokeLeaseSignal) ReceiveAsync added in v0.7.1

func (s *RevokeLeaseSignal) ReceiveAsync() *RevokeLeaseRequest

ReceiveAsync checks for a RevokeLease signal without blocking

func (*RevokeLeaseSignal) Select added in v0.7.1

Select checks for a RevokeLease signal without blocking

type SampleWorkflowWithMutexChildRun

type SampleWorkflowWithMutexChildRun struct {
	Future workflow.ChildWorkflowFuture
}

SampleWorkflowWithMutexChildRun describes a child SampleWorkflowWithMutex workflow run

func SampleWorkflowWithMutexChild

SampleWorkflowWithMutexChild executes a child SampleWorkflowWithMutex workflow

func (*SampleWorkflowWithMutexChildRun) Get

Get blocks until the workflow is completed, returning the response value

func (*SampleWorkflowWithMutexChildRun) LeaseAcquired

LeaseAcquired sends the corresponding signal request to the child workflow

func (*SampleWorkflowWithMutexChildRun) Select

Select adds this completion to the selector. Callback can be nil.

func (*SampleWorkflowWithMutexChildRun) SelectStart

SelectStart adds waiting for start to the selector. Callback can be nil.

func (*SampleWorkflowWithMutexChildRun) WaitStart

WaitStart waits for the child workflow to start

type SampleWorkflowWithMutexInput

type SampleWorkflowWithMutexInput struct {
	Req           *SampleWorkflowWithMutexRequest
	LeaseAcquired *LeaseAcquiredSignal
}

SampleWorkflowWithMutexInput describes the input to a SampleWorkflowWithMutex workflow constructor

type SampleWorkflowWithMutexRequest

type SampleWorkflowWithMutexRequest struct {
	Resource string  `protobuf:"bytes,1,opt,name=resource,proto3" json:"resource,omitempty"`
	Dest     string  `protobuf:"bytes,2,opt,name=dest,proto3" json:"dest,omitempty"`
	Amount   float64 `protobuf:"fixed64,3,opt,name=amount,proto3" json:"amount,omitempty"`
	// contains filtered or unexported fields
}

SampleWorkflowWithMutexRequest describes the input to a SampleWorkflowWithMutex workflow

func (*SampleWorkflowWithMutexRequest) Descriptor deprecated

func (*SampleWorkflowWithMutexRequest) Descriptor() ([]byte, []int)

Deprecated: Use SampleWorkflowWithMutexRequest.ProtoReflect.Descriptor instead.

func (*SampleWorkflowWithMutexRequest) GetAmount

func (x *SampleWorkflowWithMutexRequest) GetAmount() float64

func (*SampleWorkflowWithMutexRequest) GetDest

func (*SampleWorkflowWithMutexRequest) GetResource

func (x *SampleWorkflowWithMutexRequest) GetResource() string

func (*SampleWorkflowWithMutexRequest) ProtoMessage

func (*SampleWorkflowWithMutexRequest) ProtoMessage()

func (*SampleWorkflowWithMutexRequest) ProtoReflect

func (*SampleWorkflowWithMutexRequest) Reset

func (x *SampleWorkflowWithMutexRequest) Reset()

func (*SampleWorkflowWithMutexRequest) String

type SampleWorkflowWithMutexResponse

type SampleWorkflowWithMutexResponse struct {
	Result string `protobuf:"bytes,1,opt,name=result,proto3" json:"result,omitempty"`
	// contains filtered or unexported fields
}

SampleWorkflowWithMutexResponse describes the output from a SampleWorkflowWithMutex workflow

func (*SampleWorkflowWithMutexResponse) Descriptor deprecated

func (*SampleWorkflowWithMutexResponse) Descriptor() ([]byte, []int)

Deprecated: Use SampleWorkflowWithMutexResponse.ProtoReflect.Descriptor instead.

func (*SampleWorkflowWithMutexResponse) GetResult

func (x *SampleWorkflowWithMutexResponse) GetResult() string

func (*SampleWorkflowWithMutexResponse) ProtoMessage

func (*SampleWorkflowWithMutexResponse) ProtoMessage()

func (*SampleWorkflowWithMutexResponse) ProtoReflect

func (*SampleWorkflowWithMutexResponse) Reset

func (*SampleWorkflowWithMutexResponse) String

type SampleWorkflowWithMutexRun

type SampleWorkflowWithMutexRun interface {
	// ID returns the workflow ID
	ID() string
	// RunID returns the workflow instance ID
	RunID() string
	// Get blocks until the workflow is complete and returns the result
	Get(ctx context.Context) (*SampleWorkflowWithMutexResponse, error)
	// LeaseAcquired sends a LeaseAcquired signal to the workflow
	LeaseAcquired(ctx context.Context, req *LeaseAcquiredRequest) error
}

SampleWorkflowWithMutexRun describes a SampleWorkflowWithMutex workflow run

type SampleWorkflowWithMutexWorkflow

type SampleWorkflowWithMutexWorkflow interface {
	// Execute a SampleWorkflowWithMutex workflow
	Execute(ctx workflow.Context) (*SampleWorkflowWithMutexResponse, error)
}

SampleWorkflowWithMutex provides an example of a running workflow that uses a Mutex workflow to prevent concurrent access to a shared resource

type Workflows

type Workflows interface {
	// Mutex initializes a new MutexWorkflow value
	Mutex(ctx workflow.Context, input *MutexInput) (MutexWorkflow, error)
	// SampleWorkflowWithMutex initializes a new SampleWorkflowWithMutexWorkflow value
	SampleWorkflowWithMutex(ctx workflow.Context, input *SampleWorkflowWithMutexInput) (SampleWorkflowWithMutexWorkflow, error)
}

Workflows provides methods for initializing new Mutex workflow values

Jump to

Keyboard shortcuts

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