-
Notifications
You must be signed in to change notification settings - Fork 12
/
interfaces.go
55 lines (42 loc) · 1016 Bytes
/
interfaces.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
package transform
import (
"time"
"github.com/streamingfast/bstream"
pbbstream "github.com/streamingfast/bstream/pb/sf/bstream/v1"
"google.golang.org/protobuf/proto"
)
type Transform interface {
String() string
}
type PreprocessTransform interface {
Transform(readOnlyBlk *pbbstream.Block, in Input) (Output, error)
}
type Input interface {
Type() string
Obj() proto.Message // Most of the time a `pbsol.Block` or `pbeth.Block`
}
type Output proto.Message
type BlockMetadata struct {
Ref bstream.BlockRef
ParentRef bstream.BlockRef
LibNum uint64
Timestamp time.Time
}
const (
NilObjectType string = "nil"
)
type NilObj struct{}
func NewNilObj() *NilObj { return &NilObj{} }
func (n *NilObj) Type() string { return NilObjectType }
func (n *NilObj) Obj() proto.Message { return nil }
type InputObj struct {
_type string
obj proto.Message
ttl int
}
func (i *InputObj) Obj() proto.Message {
return i.obj
}
func (i *InputObj) Type() string {
return i._type
}