mutexv1

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2023 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

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

protoc-gen-go_temporal 0.6.2-next (5cc7a59beb1e3de5a59cb1721ef6168b4d036e86)
go go1.19.6
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 *AcquireLeaseSignal) workflow.Future

AcquireLeaseExternal sends a AcquireLease signal to an existing workflow

func LeaseAcquiredExternal

func LeaseAcquiredExternal(ctx workflow.Context, workflowID string, runID string, req *LeaseAcquiredSignal) 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 *RenewLeaseSignal) workflow.Future

RenewLeaseExternal sends a RenewLease signal to an existing workflow

func RevokeLeaseExternal

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

RevokeLeaseExternal sends a RevokeLease signal to an existing workflow

Types

type AcquireLease

type AcquireLease struct {
	Channel workflow.ReceiveChannel
}

AcquireLease describes a AcquireLease signal

func (*AcquireLease) Receive

func (s *AcquireLease) Receive(ctx workflow.Context) (*AcquireLeaseSignal, bool)

Receive blocks until a AcquireLease signal is received

func (*AcquireLease) ReceiveAsync

func (s *AcquireLease) ReceiveAsync() *AcquireLeaseSignal

ReceiveAsync checks for a AcquireLease signal without blocking

func (*AcquireLease) Select

Select checks for a AcquireLease signal without blocking

type AcquireLeaseSignal

type AcquireLeaseSignal 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
}

func (*AcquireLeaseSignal) Descriptor deprecated

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

Deprecated: Use AcquireLeaseSignal.ProtoReflect.Descriptor instead.

func (*AcquireLeaseSignal) GetTimeout

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

func (*AcquireLeaseSignal) GetWorkflowId

func (x *AcquireLeaseSignal) GetWorkflowId() string

func (*AcquireLeaseSignal) ProtoMessage

func (*AcquireLeaseSignal) ProtoMessage()

func (*AcquireLeaseSignal) ProtoReflect

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

func (*AcquireLeaseSignal) Reset

func (x *AcquireLeaseSignal) Reset()

func (*AcquireLeaseSignal) String

func (x *AcquireLeaseSignal) String() string

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 executes a Mutex workflow and blocks until error or response received
	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 *AcquireLeaseSignal) (MutexRun, error)
	// SampleWorkflowWithMutex executes a SampleWorkflowWithMutex workflow and blocks until error or response received
	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)
	// AcquireLease sends a AcquireLease signal to an existing workflow
	AcquireLease(ctx context.Context, workflowID string, runID string, signal *AcquireLeaseSignal) error
	// LeaseAcquired sends a LeaseAcquired signal to an existing workflow
	LeaseAcquired(ctx context.Context, workflowID string, runID string, signal *LeaseAcquiredSignal) error
	// RenewLease sends a RenewLease signal to an existing workflow
	RenewLease(ctx context.Context, workflowID string, runID string, signal *RenewLeaseSignal) error
	// RevokeLease sends a RevokeLease signal to an existing workflow
	RevokeLease(ctx context.Context, workflowID string, runID string, signal *RevokeLeaseSignal) 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 LeaseAcquired

type LeaseAcquired struct {
	Channel workflow.ReceiveChannel
}

LeaseAcquired describes a LeaseAcquired signal

func (*LeaseAcquired) Receive

Receive blocks until a LeaseAcquired signal is received

func (*LeaseAcquired) ReceiveAsync

func (s *LeaseAcquired) ReceiveAsync() *LeaseAcquiredSignal

ReceiveAsync checks for a LeaseAcquired signal without blocking

func (*LeaseAcquired) Select

Select checks for a LeaseAcquired signal without blocking

type LeaseAcquiredSignal

type LeaseAcquiredSignal 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
}

func (*LeaseAcquiredSignal) Descriptor deprecated

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

Deprecated: Use LeaseAcquiredSignal.ProtoReflect.Descriptor instead.

func (*LeaseAcquiredSignal) GetLeaseId

func (x *LeaseAcquiredSignal) GetLeaseId() string

func (*LeaseAcquiredSignal) GetRunId

func (x *LeaseAcquiredSignal) GetRunId() string

func (*LeaseAcquiredSignal) GetWorkflowId

func (x *LeaseAcquiredSignal) GetWorkflowId() string

func (*LeaseAcquiredSignal) ProtoMessage

func (*LeaseAcquiredSignal) ProtoMessage()

func (*LeaseAcquiredSignal) ProtoReflect

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

func (*LeaseAcquiredSignal) Reset

func (x *LeaseAcquiredSignal) Reset()

func (*LeaseAcquiredSignal) String

func (x *LeaseAcquiredSignal) String() string

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 *AcquireLeaseSignal) 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 *RenewLeaseSignal) workflow.Future

RenewLease sends the corresponding signal request to the child workflow

func (*MutexChildRun) RevokeLease

func (r *MutexChildRun) RevokeLease(ctx workflow.Context, input *RevokeLeaseSignal) 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 *AcquireLease
	RenewLease   *RenewLease
	RevokeLease  *RevokeLease
}

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
}

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 *AcquireLeaseSignal) error
	// RenewLease sends a RenewLease signal to the workflow
	RenewLease(ctx context.Context, req *RenewLeaseSignal) error
	// RevokeLease sends a RevokeLease signal to the workflow
	RevokeLease(ctx context.Context, req *RevokeLeaseSignal) error
}

MutexRun describes a Mutex workflow run

type MutexWorkflow

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

MutexWorkflow describes a Mutex workflow implementation

type RenewLease

type RenewLease struct {
	Channel workflow.ReceiveChannel
}

RenewLease describes a RenewLease signal

func (*RenewLease) Receive

func (s *RenewLease) Receive(ctx workflow.Context) (*RenewLeaseSignal, bool)

Receive blocks until a RenewLease signal is received

func (*RenewLease) ReceiveAsync

func (s *RenewLease) ReceiveAsync() *RenewLeaseSignal

ReceiveAsync checks for a RenewLease signal without blocking

func (*RenewLease) Select

func (s *RenewLease) Select(sel workflow.Selector, fn func(*RenewLeaseSignal)) workflow.Selector

Select checks for a RenewLease signal without blocking

type RenewLeaseSignal

type RenewLeaseSignal 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
}

func (*RenewLeaseSignal) Descriptor deprecated

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

Deprecated: Use RenewLeaseSignal.ProtoReflect.Descriptor instead.

func (*RenewLeaseSignal) GetLeaseId

func (x *RenewLeaseSignal) GetLeaseId() string

func (*RenewLeaseSignal) GetTimeout

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

func (*RenewLeaseSignal) ProtoMessage

func (*RenewLeaseSignal) ProtoMessage()

func (*RenewLeaseSignal) ProtoReflect

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

func (*RenewLeaseSignal) Reset

func (x *RenewLeaseSignal) Reset()

func (*RenewLeaseSignal) String

func (x *RenewLeaseSignal) String() string

type RevokeLease

type RevokeLease struct {
	Channel workflow.ReceiveChannel
}

RevokeLease describes a RevokeLease signal

func (*RevokeLease) Receive

func (s *RevokeLease) Receive(ctx workflow.Context) (*RevokeLeaseSignal, bool)

Receive blocks until a RevokeLease signal is received

func (*RevokeLease) ReceiveAsync

func (s *RevokeLease) ReceiveAsync() *RevokeLeaseSignal

ReceiveAsync checks for a RevokeLease signal without blocking

func (*RevokeLease) Select

func (s *RevokeLease) Select(sel workflow.Selector, fn func(*RevokeLeaseSignal)) workflow.Selector

Select checks for a RevokeLease signal without blocking

type RevokeLeaseSignal

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

func (*RevokeLeaseSignal) Descriptor deprecated

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

Deprecated: Use RevokeLeaseSignal.ProtoReflect.Descriptor instead.

func (*RevokeLeaseSignal) GetLeaseId

func (x *RevokeLeaseSignal) GetLeaseId() string

func (*RevokeLeaseSignal) ProtoMessage

func (*RevokeLeaseSignal) ProtoMessage()

func (*RevokeLeaseSignal) ProtoReflect

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

func (*RevokeLeaseSignal) Reset

func (x *RevokeLeaseSignal) Reset()

func (*RevokeLeaseSignal) String

func (x *RevokeLeaseSignal) String() string

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 *LeaseAcquired
}

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
}

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
}

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 *LeaseAcquiredSignal) error
}

SampleWorkflowWithMutexRun describes a SampleWorkflowWithMutex workflow run

type SampleWorkflowWithMutexWorkflow

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

SampleWorkflowWithMutexWorkflow describes a SampleWorkflowWithMutex workflow implementation

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