-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinterfaces.go
More file actions
38 lines (29 loc) · 818 Bytes
/
interfaces.go
File metadata and controls
38 lines (29 loc) · 818 Bytes
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
package pkg
import "context"
type Plugin interface {
Init([]byte) error
IsInit() bool
}
// Producer describes the producer type.
type Producer interface {
Close() error
// Publish provides channel for reading source incoming data.
Publish() <-chan []byte
// Run starts reading data from source and publish it to channel.
Run(ctx context.Context) error
}
// Consumer describes the consumer type.
type Consumer interface {
Close() error
// Consume provided.
// args is json representation of the expected structure.
Consume(args []byte) error
}
// Transform provides filtration/transformation mechanism.
type Transform interface {
/*
Eval evaluates provided object to bytes of JSON object.
It can be not only struct but also bool, string, int, etc..
*/
EvalBytes(obj []byte) ([]byte, error)
}