cache

package
v1.25.0-113.3 Latest Latest
Warning

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

Go to latest
Published: May 29, 2024 License: MIT Imports: 22 Imported by: 0

Documentation

Overview

Package cache is a generated GoMock package.

Index

Constants

This section is empty.

Variables

View Source
var Module = fx.Options(
	fx.Provide(func(config *configs.Config, handler metrics.Handler) Cache {
		return NewHostLevelCache(config, handler)
	}),
	fx.Provide(NewCacheFnProvider),
)

Functions

func GetCurrentRunID added in v1.24.0

func GetCurrentRunID(
	ctx context.Context,
	shardContext shard.Context,
	workflowCache Cache,
	shardOwnershipAsserted *bool,
	namespaceID string,
	workflowID string,
	lockPriority workflow.LockPriority,
) (runID string, retErr error)

Types

type Cache

type Cache interface {
	Put(
		shardContext shard.Context,
		namespaceID namespace.ID,
		execution *commonpb.WorkflowExecution,
		workflowCtx workflow.Context,
		handler metrics.Handler,
	) (workflow.Context, error)

	GetOrCreateCurrentWorkflowExecution(
		ctx context.Context,
		shardContext shard.Context,
		namespaceID namespace.ID,
		workflowID string,
		lockPriority workflow.LockPriority,
	) (ReleaseCacheFunc, error)

	GetOrCreateWorkflowExecution(
		ctx context.Context,
		shardContext shard.Context,
		namespaceID namespace.ID,
		execution *commonpb.WorkflowExecution,
		lockPriority workflow.LockPriority,
	) (workflow.Context, ReleaseCacheFunc, error)
}

func NewHostLevelCache added in v1.23.0

func NewHostLevelCache(
	config *configs.Config,
	handler metrics.Handler,
) Cache

func NewShardLevelCache added in v1.23.0

func NewShardLevelCache(
	config *configs.Config,
	handler metrics.Handler,
) Cache

type CacheImpl

type CacheImpl struct {
	cache.Cache
	// contains filtered or unexported fields
}

func (*CacheImpl) GetOrCreateCurrentWorkflowExecution added in v1.20.1

func (c *CacheImpl) GetOrCreateCurrentWorkflowExecution(
	ctx context.Context,
	shardContext shard.Context,
	namespaceID namespace.ID,
	workflowID string,
	lockPriority workflow.LockPriority,
) (ReleaseCacheFunc, error)

func (*CacheImpl) GetOrCreateWorkflowExecution

func (c *CacheImpl) GetOrCreateWorkflowExecution(
	ctx context.Context,
	shardContext shard.Context,
	namespaceID namespace.ID,
	execution *commonpb.WorkflowExecution,
	lockPriority workflow.LockPriority,
) (workflow.Context, ReleaseCacheFunc, error)

func (*CacheImpl) Put added in v1.24.0

func (c *CacheImpl) Put(
	shardContext shard.Context,
	namespaceID namespace.ID,
	execution *commonpb.WorkflowExecution,
	workflowCtx workflow.Context,
	handler metrics.Handler,
) (workflow.Context, error)

type Key added in v1.23.0

type Key struct {
	// Those are exported because some unit tests uses the cache directly.
	// TODO: Update the unit tests and make those fields private.
	WorkflowKey definition.WorkflowKey
	ShardUUID   string
}

type MockCache

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

MockCache is a mock of Cache interface.

func NewMockCache

func NewMockCache(ctrl *gomock.Controller) *MockCache

NewMockCache creates a new mock instance.

func (*MockCache) EXPECT

func (m *MockCache) EXPECT() *MockCacheMockRecorder

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockCache) GetOrCreateCurrentWorkflowExecution added in v1.20.1

func (m *MockCache) GetOrCreateCurrentWorkflowExecution(ctx context.Context, shardContext shard.Context, namespaceID namespace.ID, workflowID string, lockPriority workflow.LockPriority) (ReleaseCacheFunc, error)

GetOrCreateCurrentWorkflowExecution mocks base method.

func (*MockCache) GetOrCreateWorkflowExecution

func (m *MockCache) GetOrCreateWorkflowExecution(ctx context.Context, shardContext shard.Context, namespaceID namespace.ID, execution *v1.WorkflowExecution, lockPriority workflow.LockPriority) (workflow.Context, ReleaseCacheFunc, error)

GetOrCreateWorkflowExecution mocks base method.

func (*MockCache) Put added in v1.24.0

func (m *MockCache) Put(shardContext shard.Context, namespaceID namespace.ID, execution *v1.WorkflowExecution, workflowCtx workflow.Context, handler metrics.Handler) (workflow.Context, error)

Put mocks base method.

type MockCacheMockRecorder

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

MockCacheMockRecorder is the mock recorder for MockCache.

func (*MockCacheMockRecorder) GetOrCreateCurrentWorkflowExecution added in v1.20.1

func (mr *MockCacheMockRecorder) GetOrCreateCurrentWorkflowExecution(ctx, shardContext, namespaceID, workflowID, lockPriority interface{}) *gomock.Call

GetOrCreateCurrentWorkflowExecution indicates an expected call of GetOrCreateCurrentWorkflowExecution.

func (*MockCacheMockRecorder) GetOrCreateWorkflowExecution

func (mr *MockCacheMockRecorder) GetOrCreateWorkflowExecution(ctx, shardContext, namespaceID, execution, lockPriority interface{}) *gomock.Call

GetOrCreateWorkflowExecution indicates an expected call of GetOrCreateWorkflowExecution.

func (*MockCacheMockRecorder) Put added in v1.24.0

func (mr *MockCacheMockRecorder) Put(shardContext, namespaceID, execution, workflowCtx, handler interface{}) *gomock.Call

Put indicates an expected call of Put.

type NewCacheFn

type NewCacheFn func(config *configs.Config, handler metrics.Handler) Cache

func NewCacheFnProvider

func NewCacheFnProvider() NewCacheFn

NewCacheFnProvider provide a NewCacheFn that can be used to create new workflow cache.

type ReleaseCacheFunc

type ReleaseCacheFunc func(err error)

ReleaseCacheFunc must be called to release the workflow context from the cache. Make sure not to access the mutable state or workflow context after releasing back to the cache. If there is any error when using the mutable state (e.g. mutable state is mutated and dirty), call release with the error so the in-memory copy will be thrown away.

var NoopReleaseFn ReleaseCacheFunc = func(err error) {}

Jump to

Keyboard shortcuts

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