shared.go 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. // Copyright 2021 EMQ Technologies Co., Ltd.
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. package runtime
  15. const (
  16. TYPE_SOURCE = "source"
  17. TYPE_SINK = "sink"
  18. TYPE_FUNC = "func"
  19. )
  20. type Meta struct {
  21. RuleId string `json:"ruleId"`
  22. OpId string `json:"opId"`
  23. InstanceId int `json:"instanceId"`
  24. }
  25. type FuncMeta struct {
  26. Meta
  27. FuncId int `json:"funcId"`
  28. }
  29. type Control struct {
  30. SymbolName string `json:"symbolName"`
  31. Meta *Meta `json:"meta,omitempty"`
  32. PluginType string `json:"pluginType"`
  33. DataSource string `json:"dataSource,omitempty"`
  34. Config map[string]interface{} `json:"config,omitempty"`
  35. }
  36. type Command struct {
  37. Cmd string `json:"cmd"`
  38. Arg string `json:"arg"`
  39. }
  40. const (
  41. CMD_START = "start"
  42. CMD_STOP = "stop"
  43. )
  44. const (
  45. REPLY_OK = "ok"
  46. )
  47. type PortableConfig struct {
  48. SendTimeout int64 `json:"sendTimeout"`
  49. }
  50. type FuncData struct {
  51. Func string `json:"func"`
  52. Arg interface{} `json:"arg"`
  53. }
  54. type FuncReply struct {
  55. State bool `json:"state"`
  56. Result interface{} `json:"result"`
  57. }