-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathservices.go
52 lines (42 loc) · 1.23 KB
/
services.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
package main
import (
"fmt"
"os"
"github.com/couchbase/goxdcr/v8/base"
"github.com/couchbase/goxdcr/v8/log"
"github.com/couchbase/goxdcr/v8/service_def"
"github.com/couchbase/goxdcr/v8/service_impl"
"github.com/couchbase/goxdcr/v8/utils"
)
type XdcrServices struct {
SecuritySvc service_def.SecuritySvc
TopSvc service_def.XDCRCompTopologySvc
Utils *utils.Utilities
}
var xsvc *XdcrServices
func InitXdcrServices(cfg *Config) (svc *XdcrServices, err error) {
securitySvc := service_impl.NewSecurityService(cfg.ClusterCAFile, log.GetOrCreateContext(base.SecuritySvcKey))
securitySvc = securitySvc.SetClientKeyFile(cfg.ClientKeyFile).SetClientCertFile(cfg.ClientCertFile)
err = securitySvc.Start()
if err != nil {
return
}
utils := utils.NewUtilities()
topSvc, err := service_impl.NewXDCRTopologySvc(
uint16(cfg.SourceKVAdminPort),
uint16(cfg.XdcrRestPort),
true, "required", "optional", securitySvc, log.GetOrCreateContext(base.TopoSvcKey), utils)
if err != nil {
fmt.Printf("Error starting xdcr topology service. err=%v\n", err)
os.Exit(1)
}
svc = &XdcrServices{
SecuritySvc: securitySvc,
TopSvc: topSvc,
Utils: utils,
}
return
}
func initServices(cfg *Config) (err error) {
return err
}