|
|
@ -22,6 +22,7 @@ type (
|
|
|
|
DevMode bool `json:",default=false"` // 开发模式
|
|
|
|
DevMode bool `json:",default=false"` // 开发模式
|
|
|
|
MaxMessageId uint64 `json:",default=9999999"` // 最大消息ID
|
|
|
|
MaxMessageId uint64 `json:",default=9999999"` // 最大消息ID
|
|
|
|
Timeout time.Duration `json:""` // 单条命令最大等待时间,默认10min
|
|
|
|
Timeout time.Duration `json:""` // 单条命令最大等待时间,默认10min
|
|
|
|
|
|
|
|
LineBufferSize int `json:""` // LineBufferSize
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Option func(options *Options)
|
|
|
|
Option func(options *Options)
|
|
|
|
|
|
|
|
|
|
|
@ -63,6 +64,9 @@ func NewKatagoAnalysisEngine(opts ...Option) *AnalysisEngine {
|
|
|
|
if ret.Timeout == 0 {
|
|
|
|
if ret.Timeout == 0 {
|
|
|
|
ret.Timeout = DefaultTimeout
|
|
|
|
ret.Timeout = DefaultTimeout
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if ret.LineBufferSize == 0 {
|
|
|
|
|
|
|
|
ret.LineBufferSize = ncmd.DEFAULT_LINE_BUFFER_SIZE * 4
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
ret.serializer = serializer
|
|
|
|
ret.serializer = serializer
|
|
|
|
ret.Cmd = ncmd.NewCmd(ncmd.WithOptions(&ncmd.Options{
|
|
|
|
ret.Cmd = ncmd.NewCmd(ncmd.WithOptions(&ncmd.Options{
|
|
|
@ -70,7 +74,7 @@ func NewKatagoAnalysisEngine(opts ...Option) *AnalysisEngine {
|
|
|
|
Buffered: false,
|
|
|
|
Buffered: false,
|
|
|
|
CombinedOutput: false,
|
|
|
|
CombinedOutput: false,
|
|
|
|
Streaming: true,
|
|
|
|
Streaming: true,
|
|
|
|
LineBufferSize: ncmd.DEFAULT_LINE_BUFFER_SIZE,
|
|
|
|
LineBufferSize: ncmd.DEFAULT_LINE_BUFFER_SIZE * 4,
|
|
|
|
DevMode: ret.DevMode,
|
|
|
|
DevMode: ret.DevMode,
|
|
|
|
}))
|
|
|
|
}))
|
|
|
|
|
|
|
|
|
|
|
|