defs.go 1.3 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 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. SaveCache()
  33. }
  34. type BufferOrEvent struct {
  35. Data interface{}
  36. Channel string
  37. }
  38. type StreamCheckpointContext interface {
  39. Snapshot() error
  40. SaveState(checkpointId int64) error
  41. }
  42. type Message int
  43. const (
  44. STOP Message = iota
  45. ACK
  46. DEC
  47. )
  48. type Signal struct {
  49. Message Message
  50. Barrier
  51. }
  52. type Barrier struct {
  53. CheckpointId int64
  54. OpId string
  55. }