2021-01-26 13:41:41 +08:00
|
|
|
package proxyservice
|
|
|
|
|
|
|
|
import (
|
|
|
|
"log"
|
|
|
|
|
|
|
|
"github.com/zilliztech/milvus-distributed/internal/util/paramtable"
|
|
|
|
)
|
|
|
|
|
|
|
|
type ParamTable struct {
|
|
|
|
paramtable.BaseTable
|
2021-01-28 20:51:44 +08:00
|
|
|
|
2021-02-03 20:04:29 +08:00
|
|
|
PulsarAddress string
|
|
|
|
MasterAddress string
|
|
|
|
NodeTimeTickChannel []string
|
|
|
|
ServiceTimeTickChannel string
|
|
|
|
DataServiceAddress string
|
|
|
|
InsertChannelPrefixName string
|
|
|
|
InsertChannelNum int64
|
2021-01-26 13:41:41 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
var Params ParamTable
|
|
|
|
|
|
|
|
func (pt *ParamTable) Init() {
|
|
|
|
pt.BaseTable.Init()
|
2021-01-28 20:51:44 +08:00
|
|
|
|
2021-02-03 20:04:29 +08:00
|
|
|
if err := pt.LoadYaml("advanced/data_service.yaml"); err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
|
2021-01-28 20:51:44 +08:00
|
|
|
pt.initPulsarAddress()
|
|
|
|
pt.initMasterAddress()
|
|
|
|
pt.initNodeTimeTickChannel()
|
|
|
|
pt.initServiceTimeTickChannel()
|
|
|
|
pt.initDataServiceAddress()
|
2021-02-03 20:04:29 +08:00
|
|
|
pt.initInsertChannelPrefixName()
|
|
|
|
pt.initInsertChannelNum()
|
2021-01-26 13:41:41 +08:00
|
|
|
}
|
|
|
|
|
2021-01-28 20:51:44 +08:00
|
|
|
func (pt *ParamTable) initPulsarAddress() {
|
2021-01-26 13:41:41 +08:00
|
|
|
ret, err := pt.Load("_PulsarAddress")
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
2021-01-28 20:51:44 +08:00
|
|
|
pt.PulsarAddress = ret
|
2021-01-26 13:41:41 +08:00
|
|
|
}
|
|
|
|
|
2021-01-28 20:51:44 +08:00
|
|
|
func (pt *ParamTable) initMasterAddress() {
|
2021-01-26 14:55:57 +08:00
|
|
|
ret, err := pt.Load("_MasterAddress")
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
2021-01-28 20:51:44 +08:00
|
|
|
pt.MasterAddress = ret
|
2021-01-26 14:55:57 +08:00
|
|
|
}
|
|
|
|
|
2021-01-28 20:51:44 +08:00
|
|
|
func (pt *ParamTable) initNodeTimeTickChannel() {
|
2021-01-26 13:41:41 +08:00
|
|
|
prefix, err := pt.Load("msgChannel.chanNamePrefix.proxyTimeTick")
|
|
|
|
if err != nil {
|
|
|
|
log.Panic(err)
|
|
|
|
}
|
|
|
|
prefix += "-0"
|
2021-01-28 20:51:44 +08:00
|
|
|
pt.NodeTimeTickChannel = []string{prefix}
|
2021-01-26 13:41:41 +08:00
|
|
|
}
|
|
|
|
|
2021-01-28 20:51:44 +08:00
|
|
|
func (pt *ParamTable) initServiceTimeTickChannel() {
|
2021-01-26 13:41:41 +08:00
|
|
|
ch, err := pt.Load("msgChannel.chanNamePrefix.proxyServiceTimeTick")
|
|
|
|
if err != nil {
|
|
|
|
log.Panic(err)
|
|
|
|
}
|
2021-01-28 20:51:44 +08:00
|
|
|
pt.ServiceTimeTickChannel = ch
|
2021-01-26 13:41:41 +08:00
|
|
|
}
|
|
|
|
|
2021-01-28 20:51:44 +08:00
|
|
|
func (pt *ParamTable) initDataServiceAddress() {
|
2021-01-26 13:41:41 +08:00
|
|
|
// NOT USED NOW
|
2021-01-28 20:51:44 +08:00
|
|
|
pt.DataServiceAddress = "TODO: read from config"
|
2021-01-26 13:41:41 +08:00
|
|
|
}
|
2021-02-03 20:04:29 +08:00
|
|
|
|
|
|
|
func (pt *ParamTable) initInsertChannelNum() {
|
|
|
|
pt.InsertChannelNum = pt.ParseInt64("dataservice.insertChannelNum")
|
|
|
|
}
|
|
|
|
|
|
|
|
func (pt *ParamTable) initInsertChannelPrefixName() {
|
|
|
|
var err error
|
|
|
|
pt.InsertChannelPrefixName, err = pt.Load("msgChannel.chanNamePrefix.dataServiceInsertChannel")
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
}
|