Files
tasks/service/history/history_engine_factory.go
Yichao YangandGitHub 6f0a405a4a Remove shard level workflow cache logic (#7763)
## What changed?
- Remove shard level workflow cache logic and always use host level
workflow cache.

## Why?
- Simplify code. Host level workflow cache has been enabled by default
for a long time.

## How did you test it?
- [x] built
- [ ] run locally and tested manually
- [x] covered by existing tests
- [ ] added new unit test(s)
- [ ] added new functional test(s)
2025-05-30 19:50:24 -07:00

83 lines
2.8 KiB
Go

package history
import (
"go.opentelemetry.io/otel/trace"
"go.temporal.io/server/client"
"go.temporal.io/server/common/persistence"
"go.temporal.io/server/common/persistence/serialization"
"go.temporal.io/server/common/persistence/visibility/manager"
"go.temporal.io/server/common/resource"
"go.temporal.io/server/common/sdk"
"go.temporal.io/server/common/testing/testhooks"
"go.temporal.io/server/service/history/api"
"go.temporal.io/server/service/history/circuitbreakerpool"
"go.temporal.io/server/service/history/configs"
"go.temporal.io/server/service/history/events"
historyi "go.temporal.io/server/service/history/interfaces"
"go.temporal.io/server/service/history/replication"
"go.temporal.io/server/service/history/tasks"
"go.temporal.io/server/service/history/workflow"
wcache "go.temporal.io/server/service/history/workflow/cache"
"go.uber.org/fx"
)
type (
HistoryEngineFactoryParams struct {
fx.In
ClientBean client.Bean
MatchingClient resource.MatchingClient
SdkClientFactory sdk.ClientFactory
EventNotifier events.Notifier
Config *configs.Config
RawMatchingClient resource.MatchingRawClient
WorkflowCache wcache.Cache
ReplicationProgressCache replication.ProgressCache
EventSerializer serialization.Serializer
QueueFactories []QueueFactory `group:"queueFactory"`
ReplicationTaskFetcherFactory replication.TaskFetcherFactory
ReplicationTaskExecutorProvider replication.TaskExecutorProvider
TracerProvider trace.TracerProvider
PersistenceVisibilityMgr manager.VisibilityManager
EventBlobCache persistence.XDCCache
TaskCategoryRegistry tasks.TaskCategoryRegistry
ReplicationDLQWriter replication.DLQWriter
CommandHandlerRegistry *workflow.CommandHandlerRegistry
OutboundQueueCBPool *circuitbreakerpool.OutboundQueueCircuitBreakerPool
TestHooks testhooks.TestHooks
}
historyEngineFactory struct {
HistoryEngineFactoryParams
}
)
func (f *historyEngineFactory) CreateEngine(
shard historyi.ShardContext,
) historyi.Engine {
return NewEngineWithShardContext(
shard,
f.ClientBean,
f.MatchingClient,
f.SdkClientFactory,
f.EventNotifier,
f.Config,
f.RawMatchingClient,
f.WorkflowCache,
f.ReplicationProgressCache,
f.EventSerializer,
f.QueueFactories,
f.ReplicationTaskFetcherFactory,
f.ReplicationTaskExecutorProvider,
api.NewWorkflowConsistencyChecker(shard, f.WorkflowCache),
f.TracerProvider,
f.PersistenceVisibilityMgr,
f.EventBlobCache,
f.TaskCategoryRegistry,
f.ReplicationDLQWriter,
f.CommandHandlerRegistry,
f.OutboundQueueCBPool,
f.TestHooks,
)
}