Documentation ¶
Overview ¶
Copyright 2022 Huawei Cloud Computing Technologies Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2022 Huawei Cloud Computing Technologies Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2022 Huawei Cloud Computing Technologies Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2022 Huawei Cloud Computing Technologies Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2022 Huawei Cloud Computing Technologies Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Index ¶
- Constants
- Variables
- func BuildNumericRecord() array.Record
- func GetMetaValueFromRecord(data array.Record, key string) (string, *errno.Error)
- func IsInternalKey(key string) bool
- func MockPyWorker(addr string) error
- func NewRespChan(size int) (*respChan, *errno.Error)
- type ByteReadReader
- type Service
- func (s *Service) Close() error
- func (s *Service) DeregisterResultChan(id string)
- func (s *Service) HandleData(record array.Record)
- func (s *Service) IsAlive() bool
- func (s *Service) Open() error
- func (s *Service) RegisterResultChan(id string, ch *respChan)
- func (s *Service) ResultChan() chan<- array.Record
Constants ¶
const ( DataId internalTagKey = "_dataID" Algorithm internalTagKey = "_algo" ConfigFile internalTagKey = "_cfg" ProcessType internalTagKey = "_processType" MessageType internalTagKey = "_msgType" ErrInfo internalTagKey = "_errInfo" TaskID internalTagKey = "_taskID" AnomalyNum internalTagKey = "_anomalyNum" QueryMode internalTagKey = "_queryMode" ConnID internalTagKey = "_connID" FieldKeys internalTagKey = "field_keys" PostProcessType internalTagKey = "type" ResultSeries internalTagKey = "series" OutputInfo internalTagKey = "_outputInfo" )
const ( AnomalyLevel resultFieldKey = "anomalyLevel" DataTime resultFieldKey = "time" )
const ( NormalQuery queryMode = "0" ContinuousQuery queryMode = "1" )
const (
DATA messageType = "data"
)
Variables ¶
var DesiredFieldKeySet = map[string]struct{}{ string(AnomalyLevel): {}, }
Functions ¶
func GetMetaValueFromRecord ¶
return value from record's metadata according to key
func NewRespChan ¶
return response channel with buffer size
Types ¶
type ByteReadReader ¶
type ByteReadReader interface { io.Reader io.ByteReader }
type Service ¶
type Service struct { services.Base Config config.Castor // contains filtered or unexported fields }
func MockCastorService ¶
func MockCastorService(port int) (*Service, *observer.ObservedLogs, error)
use default configuration and replace logger with observable one for test
func NewService ¶
NewService return an new service instance
func (*Service) Close ¶
Close release internal client and close channel, service will mark as not alive, any castor query will not be processed
func (*Service) DeregisterResultChan ¶
DeregisterResultChan deregister an channel with id, response from computation node will be dropped if correspond id not found
func (*Service) HandleData ¶
HandleData will send data to computation node through internal client
func (*Service) RegisterResultChan ¶
RegisterResultChan register an channel with id, response from computation node will be dispatched according to id
func (*Service) ResultChan ¶
ResultChan store result from computation node