503
}
504
505
>
func NewService(app *fx.App, serviceName primitives.ServiceName, logger log.Logger) ServicesGroupOut {
fx.go
506
>
return ServicesGroupOut{
507
>
Services: &ServicesMetadata{
508
>
app: app,
509
>
serviceName: serviceName,
510
>
logger: logger,
511
>
},
512
>
}
513
>
}
514
515
func HistoryServiceProvider(
516
params ServiceProviderParamsCommon,
517
>
) (ServicesGroupOut, error) {
fx.go
518
>
serviceName := primitives.HistoryService
519
>
520
>
if _, ok := params.ServiceNames[serviceName]; !ok {
521
params.Logger.Info("Service is not requested, skipping initialization.", tag.Service(serviceName))
522
return ServicesGroupOut{}, nil
523
}
524
525
>
app := fx.New(
fx.go
526
>
params.GetCommonServiceOptions(serviceName),
527
>
history.QueueModule,
528
>
history.Module,
529
>
replication.Module,
530
>
)
531
>
532
>
return NewService(app, serviceName, params.Logger), app.Err()
533
}
534
535
func MatchingServiceProvider(
536
params ServiceProviderParamsCommon,
537
>
) (ServicesGroupOut, error) {
fx.go
538
>
serviceName := primitives.MatchingService
539
>
540
>
if _, ok := params.ServiceNames[serviceName]; !ok {
541
params.Logger.Info("Service is not requested, skipping initialization.", tag.Service(serviceName))
542
return ServicesGroupOut{}, nil
543
}
544
545
>
app := fx.New(
fx.go
546
>
params.GetCommonServiceOptions(serviceName),
547
>
matching.Module,
548
>
)
549
>
550
>
return NewService(app, serviceName, params.Logger), app.Err()
551
}
552
553
func FrontendServiceProvider(
554
params ServiceProviderParamsCommon,
555
>
) (ServicesGroupOut, error) {
fx.go
556
>
return genericFrontendServiceProvider(params, primitives.FrontendService)
557
>
}
558
559
func InternalFrontendServiceProvider(
560
params ServiceProviderParamsCommon,
561
>
) (ServicesGroupOut, error) {
fx.go
562
>
return genericFrontendServiceProvider(params, primitives.InternalFrontendService)
563
>
}
564
565
func genericFrontendServiceProvider(
566
params ServiceProviderParamsCommon,
567
serviceName primitives.ServiceName,
568
>
) (ServicesGroupOut, error) {
fx.go
569
>
if _, ok := params.ServiceNames[serviceName]; !ok {
570
>
params.Logger.Info("Service is not requested, skipping initialization.", tag.Service(serviceName))
571
>
return ServicesGroupOut{}, nil
572
>
}
573
574
>
app := fx.New(
fx.go
575
>
params.GetCommonServiceOptions(serviceName),
576
>
fx.Supply(params.CustomFrontendInterceptors),
577
>
fx.Supply([]grpc.StreamServerInterceptor{}),
578
>
fx.Decorate(func() authorization.ClaimMapper {
579
>
switch serviceName {
580
>
case primitives.FrontendService:
581
>
return params.ClaimMapper
582
case primitives.InternalFrontendService:
583
return authorization.NewInternalClaimMapper()