cache

package
v1.32.1 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2026 License: MIT Imports: 26 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(NewHostLevelCache),
	fx.Invoke(func(
		lc fx.Lifecycle,
		cache Cache,
	) {
		lc.Append(fx.Hook{
			OnStop: func(_ context.Context) error {
				ci, ok := cache.(*cacheImpl)
				if ok {
					ci.stop()
				}
				return nil
			},
		})
	}),
)
View Source
var NoopReleaseFn historyi.ReleaseWorkflowContextFunc = func(err error) {}

Functions

func ClearMutableState

func ClearMutableState(cache Cache, key Key)

ClearMutableState clears cached mutable state for the given key to force a reload from persistence on the next access.

func GetCurrentRunID

func GetCurrentRunID(
	ctx context.Context,
	shardContext historyi.ShardContext,
	workflowCache Cache,
	namespaceID string,
	workflowID string,
	archetypeID chasm.ArchetypeID,
	lockPriority locks.Priority,
) (runID string, retErr error)

func GetMutableState

func GetMutableState(cache Cache, key Key) historyi.MutableState

GetMutableState returns the MutableState for the given key from the cache. Exported for testing purposes.

func PutContextIfNotExist

func PutContextIfNotExist(cache Cache, key Key, value historyi.WorkflowContext) error

PutContextIfNotExist puts the given workflow Context into the cache, if it doens't already exist. Exported for testing purposes.

Types

type Cache

type Cache interface {
	GetOrCreateCurrentExecution(
		ctx context.Context,
		shardContext historyi.ShardContext,
		namespaceID namespace.ID,
		workflowID string,
		archetypeID chasm.ArchetypeID,
		lockPriority locks.Priority,
	) (historyi.ReleaseWorkflowContextFunc, error)

	GetOrCreateWorkflowExecution(
		ctx context.Context,
		shardContext historyi.ShardContext,
		namespaceID namespace.ID,
		execution *commonpb.WorkflowExecution,
		lockPriority locks.Priority,
	) (historyi.WorkflowContext, historyi.ReleaseWorkflowContextFunc, error)

	GetOrCreateChasmExecution(
		ctx context.Context,
		shardContext historyi.ShardContext,
		namespaceID namespace.ID,
		execution *commonpb.WorkflowExecution,
		archetypeID chasm.ArchetypeID,
		lockPriority locks.Priority,
	) (historyi.WorkflowContext, historyi.ReleaseWorkflowContextFunc, error)
}

func NewHostLevelCache

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

type Key

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
	ArchetypeID chasm.ArchetypeID
	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) GetOrCreateChasmExecution

func (m *MockCache) GetOrCreateChasmExecution(ctx context.Context, shardContext interfaces.ShardContext, namespaceID namespace.ID, execution *common.WorkflowExecution, archetypeID chasm.ArchetypeID, lockPriority locks.Priority) (interfaces.WorkflowContext, interfaces.ReleaseWorkflowContextFunc, error)

GetOrCreateChasmExecution mocks base method.

func (*MockCache) GetOrCreateCurrentExecution

func (m *MockCache) GetOrCreateCurrentExecution(ctx context.Context, shardContext interfaces.ShardContext, namespaceID namespace.ID, workflowID string, archetypeID chasm.ArchetypeID, lockPriority locks.Priority) (interfaces.ReleaseWorkflowContextFunc, error)

GetOrCreateCurrentExecution mocks base method.

func (*MockCache) GetOrCreateWorkflowExecution

func (m *MockCache) GetOrCreateWorkflowExecution(ctx context.Context, shardContext interfaces.ShardContext, namespaceID namespace.ID, execution *common.WorkflowExecution, lockPriority locks.Priority) (interfaces.WorkflowContext, interfaces.ReleaseWorkflowContextFunc, error)

GetOrCreateWorkflowExecution mocks base method.

type MockCacheMockRecorder

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

MockCacheMockRecorder is the mock recorder for MockCache.

func (*MockCacheMockRecorder) GetOrCreateChasmExecution

func (mr *MockCacheMockRecorder) GetOrCreateChasmExecution(ctx, shardContext, namespaceID, execution, archetypeID, lockPriority any) *gomock.Call

GetOrCreateChasmExecution indicates an expected call of GetOrCreateChasmExecution.

func (*MockCacheMockRecorder) GetOrCreateCurrentExecution

func (mr *MockCacheMockRecorder) GetOrCreateCurrentExecution(ctx, shardContext, namespaceID, workflowID, archetypeID, lockPriority any) *gomock.Call

GetOrCreateCurrentExecution indicates an expected call of GetOrCreateCurrentExecution.

func (*MockCacheMockRecorder) GetOrCreateWorkflowExecution

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

GetOrCreateWorkflowExecution indicates an expected call of GetOrCreateWorkflowExecution.

Jump to

Keyboard shortcuts

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