Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Base ¶
type Base struct {
Intrinsics
*Definition
ID string // QmHELLOWORLD as fetched when necessary
Log *zap.Logger
}
Base contains initialized values for a Subgraph instance, wrapped in a struct for future-proofness.
type DDL ¶
type DDL interface {
InitiateSchema(handleStatement func(statement string) error) error
CreateTables(handleStatement func(table string, statement string) error) error
CreateIndexes(handleStatement func(table string, statement string) error) error
DropIndexes(handleStatement func(table string, statement string) error) error
}
type Definition ¶
type Definition struct {
PackageName string
HighestParallelStep int
StartBlock uint64
IncludeFilter string
Entities *graphnode.Registry
DDL DDL
Manifest string
GraphQLSchema string
Abis map[string]string
New func(Base) Subgraph
MergeFunc func(step int, current, next graphnode.Entity) graphnode.Entity
}
var MainSubgraphDef *Definition
type Intrinsics ¶
type Intrinsics interface {
Save(entity graphnode.Entity) error
Load(entity graphnode.Entity) error
LoadAllDistinct(model graphnode.Entity, blockNum uint64) ([]graphnode.Entity, error)
Remove(entity graphnode.Entity) error
// Block returns the current block being processed by your subgraph handler.
Block() BlockRef
/// Reproc
Step() int
StepBelow(step int) bool
StepAbove(step int) bool
/// JSON-RPC
RPC(calls []*RPCCall) ([]*RPCResponse, error)
}
Intrinsics is per subgraph and should be unique for each subgraph. The underlying implementation should know about its surrounding context to know when to close when at which block it's currently at.
It's expected that the implementation will be called by one go routine at a time.
type RPCResponse ¶
Click to show internal directories.
Click to hide internal directories.