@@ -70,89 +70,80 @@ func NewResourceFactory() ResourceFactory {
70
70
71
71
type resourceImplFactory struct {}
72
72
73
- func (* resourceImplFactory ) NewResource (params * Params ,
73
+ func (* resourceImplFactory ) NewResource (
74
+ params * Params ,
74
75
serviceName string ,
75
76
serviceConfig * service.Config ,
76
77
) (resource Resource , err error ) {
77
78
return New (params , serviceName , serviceConfig )
78
79
}
79
80
80
- type (
81
+ // Impl contains all common resources shared across frontend / matching / history / worker
82
+ type Impl struct {
83
+ status int32
81
84
82
- // VisibilityManagerInitializer is the function each service should implement
83
- // for visibility manager initialization
84
- VisibilityManagerInitializer func (
85
- persistenceBean persistenceClient. Bean ,
86
- logger log. Logger ,
87
- ) (persistence. VisibilityManager , error )
85
+ // static infos
86
+ numShards int
87
+ serviceName string
88
+ hostInfo membership. HostInfo
89
+ metricsScope tally. Scope
90
+ clusterMetadata cluster. Metadata
88
91
89
- // Impl contains all common resources shared across frontend / matching / history / worker
90
- Impl struct {
91
- status int32
92
+ // other common resources
92
93
93
- // static infos
94
- numShards int
95
- serviceName string
96
- hostInfo membership.HostInfo
97
- metricsScope tally.Scope
98
- clusterMetadata cluster.Metadata
94
+ domainCache cache.DomainCache
95
+ domainMetricsScopeCache cache.DomainMetricsScopeCache
96
+ timeSource clock.TimeSource
97
+ payloadSerializer persistence.PayloadSerializer
98
+ metricsClient metrics.Client
99
+ messagingClient messaging.Client
100
+ blobstoreClient blobstore.Client
101
+ archivalMetadata archiver.ArchivalMetadata
102
+ archiverProvider provider.ArchiverProvider
103
+ domainReplicationQueue domain.ReplicationQueue
99
104
100
- // other common resources
105
+ // membership infos
101
106
102
- domainCache cache.DomainCache
103
- domainMetricsScopeCache cache.DomainMetricsScopeCache
104
- timeSource clock.TimeSource
105
- payloadSerializer persistence.PayloadSerializer
106
- metricsClient metrics.Client
107
- messagingClient messaging.Client
108
- blobstoreClient blobstore.Client
109
- archivalMetadata archiver.ArchivalMetadata
110
- archiverProvider provider.ArchiverProvider
111
- domainReplicationQueue domain.ReplicationQueue
107
+ membershipResolver membership.Resolver
112
108
113
- // membership infos
109
+ // internal services clients
114
110
115
- membershipResolver membership.Resolver
111
+ sdkClient workflowserviceclient.Interface
112
+ frontendRawClient frontend.Client
113
+ frontendClient frontend.Client
114
+ matchingRawClient matching.Client
115
+ matchingClient matching.Client
116
+ historyRawClient history.Client
117
+ historyClient history.Client
118
+ clientBean client.Bean
116
119
117
- // internal services clients
120
+ // persistence clients
121
+ persistenceBean persistenceClient.Bean
118
122
119
- sdkClient workflowserviceclient.Interface
120
- frontendRawClient frontend.Client
121
- frontendClient frontend.Client
122
- matchingRawClient matching.Client
123
- matchingClient matching.Client
124
- historyRawClient history.Client
125
- historyClient history.Client
126
- clientBean client.Bean
123
+ // hostName
124
+ hostName string
127
125
128
- // persistence clients
129
- persistenceBean persistenceClient.Bean
126
+ // loggers
127
+ logger log.Logger
128
+ throttledLogger log.Logger
130
129
131
- // hostName
132
- hostName string
130
+ // for registering handlers
131
+ dispatcher * yarpc. Dispatcher
133
132
134
- // loggers
135
- logger log.Logger
136
- throttledLogger log.Logger
133
+ // internal vars
137
134
138
- // for registering handlers
139
- dispatcher * yarpc.Dispatcher
135
+ pprofInitializer common.PProfInitializer
136
+ runtimeMetricsReporter * metrics.RuntimeMetricsReporter
137
+ rpcFactory rpc.Factory
140
138
141
- // internal vars
142
-
143
- pprofInitializer common.PProfInitializer
144
- runtimeMetricsReporter * metrics.RuntimeMetricsReporter
145
- rpcFactory rpc.Factory
139
+ isolationGroups isolationgroup.State
140
+ isolationGroupConfigStore configstore.Client
141
+ partitioner partition.Partitioner
146
142
147
- isolationGroups isolationgroup.State
148
- isolationGroupConfigStore configstore.Client
149
- partitioner partition.Partitioner
143
+ asyncWorkflowQueueProvider queue.Provider
150
144
151
- asyncWorkflowQueueProvider queue.Provider
152
-
153
- ratelimiterAggregatorClient qrpc.Client
154
- }
155
- )
145
+ ratelimiterAggregatorClient qrpc.Client
146
+ }
156
147
157
148
var _ Resource = (* Impl )(nil )
158
149
@@ -195,7 +186,11 @@ func New(
195
186
return nil , err
196
187
}
197
188
198
- persistenceBean , err := persistenceClient .NewBeanFromFactory (persistenceClient .NewFactory (
189
+ newPersistenceBeanFn := persistenceClient .NewBeanFromFactory
190
+ if params .NewPersistenceBeanFn != nil {
191
+ newPersistenceBeanFn = params .NewPersistenceBeanFn
192
+ }
193
+ persistenceBean , err := newPersistenceBeanFn (persistenceClient .NewFactory (
199
194
& params .PersistenceConfig ,
200
195
func () float64 {
201
196
return permember .PerMember (
@@ -613,9 +608,7 @@ func (h *Impl) GetHistoryManager() persistence.HistoryManager {
613
608
}
614
609
615
610
// GetExecutionManager return execution manager for given shard ID
616
- func (h * Impl ) GetExecutionManager (
617
- shardID int ,
618
- ) (persistence.ExecutionManager , error ) {
611
+ func (h * Impl ) GetExecutionManager (shardID int ) (persistence.ExecutionManager , error ) {
619
612
620
613
return h .persistenceBean .GetExecutionManager (shardID )
621
614
}
0 commit comments