-
Notifications
You must be signed in to change notification settings - Fork 0
/
input_handler.go
57 lines (41 loc) · 833 Bytes
/
input_handler.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
package ext
import (
"github.com/tri-star/mixtail/mixtail/entity"
"github.com/tri-star/mixtail/lib"
)
const (
INPUT_STATE_NOT_STARTED = iota
INPUT_STATE_RUNNING
INPUT_STATE_DONE
INPUT_STATE_ERROR
)
type InputHandlerFactory interface {
lib.ExtensionPoint
NewInputHandler(entity.InputEntry) InputHandler
}
type InputHandler interface {
GetName() string
GetType() string
GetState() uint8
GetError() error
ReadInput(ch chan entity.InputData)
}
type BaseHandler struct {
TypeName string
State uint8
Err error
}
func (b *BaseHandler) GetName() string {
return ""
}
func (b *BaseHandler) GetType() string {
return b.TypeName
}
func (b *BaseHandler) GetState() uint8 {
return b.State
}
func (b *BaseHandler) GetError() error {
return b.Err
}
func (b *BaseHandler) ReadInput(ch chan *entity.InputData) {
}