defs.go 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. // Copyright 2021-2022 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 checkpoint
  15. import (
  16. "github.com/lf-edge/ekuiper/pkg/api"
  17. )
  18. type StreamTask interface {
  19. Broadcast(data interface{}) error
  20. GetName() string
  21. GetStreamContext() api.StreamContext
  22. SetQos(api.Qos)
  23. }
  24. type NonSourceTask interface {
  25. StreamTask
  26. GetInputCount() int
  27. AddInputCount()
  28. SetBarrierHandler(BarrierHandler)
  29. }
  30. type SinkTask interface {
  31. NonSourceTask
  32. }
  33. type BufferOrEvent struct {
  34. Data interface{}
  35. Channel string
  36. }
  37. type StreamCheckpointContext interface {
  38. Snapshot() error
  39. SaveState(checkpointId int64) error
  40. }
  41. type Message int
  42. const (
  43. STOP Message = iota
  44. ACK
  45. DEC
  46. )
  47. type Signal struct {
  48. Message Message
  49. Barrier
  50. }
  51. type Barrier struct {
  52. CheckpointId int64
  53. OpId string
  54. }