Documentation
¶
Index ¶
- Variables
- type Block
- func (b *Block) Accept(context.Context) error
- func (b *Block) Bytes() []byte
- func (b *Block) Height() uint64
- func (b *Block) ID() ids.ID
- func (b *Block) Parent() ids.ID
- func (b *Block) ParentID() ids.ID
- func (b *Block) Reject(context.Context) error
- func (b *Block) Status() choices.Status
- func (b *Block) Timestamp() time.Time
- func (b *Block) Verify(ctx context.Context) error
- type ChainDataSource
- type ChainSyncEvent
- type DataIndex
- type Factory
- type GConfig
- type GraphSchema
- type IndexUpdate
- type Query
- type QueryResult
- type QueryStatus
- type SchemaUpdate
- type Subscription
- type VM
- func (vm *VM) AppGossip(ctx context.Context, nodeID ids.NodeID, msg []byte) error
- func (vm *VM) AppRequest(ctx context.Context, nodeID ids.NodeID, requestID uint32, deadline time.Time, ...) error
- func (vm *VM) AppRequestFailed(ctx context.Context, nodeID ids.NodeID, requestID uint32, appErr *warp.Error) error
- func (vm *VM) AppResponse(ctx context.Context, nodeID ids.NodeID, requestID uint32, response []byte) error
- func (vm *VM) BuildBlock(ctx context.Context) (block.Block, error)
- func (vm *VM) ConnectChainSource(chainID ids.ID, chainName string) error
- func (vm *VM) Connected(ctx context.Context, nodeID ids.NodeID, nodeVersion interface{}) error
- func (vm *VM) CreateHandlers(context.Context) (map[string]http.Handler, error)
- func (vm *VM) CrossChainAppRequest(ctx context.Context, chainID ids.ID, requestID uint32, deadline time.Time, ...) error
- func (vm *VM) CrossChainAppRequestFailed(ctx context.Context, chainID ids.ID, requestID uint32, appErr *warp.Error) error
- func (vm *VM) CrossChainAppResponse(ctx context.Context, chainID ids.ID, requestID uint32, msg []byte) error
- func (vm *VM) Disconnected(ctx context.Context, nodeID ids.NodeID) error
- func (vm *VM) ExecuteQuery(query *Query) error
- func (vm *VM) GetBlock(ctx context.Context, blkID ids.ID) (block.Block, error)
- func (vm *VM) GetBlockIDAtHeight(ctx context.Context, height uint64) (ids.ID, error)
- func (vm *VM) HealthCheck(context.Context) (any, error)
- func (vm *VM) Initialize(ctx context.Context, chainCtx interface{}, db interface{}, genesisBytes []byte, ...) error
- func (vm *VM) LastAccepted(context.Context) (ids.ID, error)
- func (vm *VM) NewHTTPHandler(ctx context.Context) (interface{}, error)
- func (vm *VM) ParseBlock(ctx context.Context, blockBytes []byte) (block.Block, error)
- func (vm *VM) RegisterSchema(schema *GraphSchema) error
- func (vm *VM) SetPreference(ctx context.Context, blkID ids.ID) error
- func (vm *VM) SetState(ctx context.Context, state uint32) error
- func (vm *VM) Shutdown(context.Context) error
- func (vm *VM) Version(context.Context) (string, error)
- func (vm *VM) WaitForEvent(ctx context.Context) (interface{}, error)
Constants ¶
This section is empty.
Variables ¶
var (
Version = &nodeversion.Semantic{
Major: 1,
Minor: 0,
Patch: 0,
}
)
Functions ¶
This section is empty.
Types ¶
type Block ¶
type Block struct {
// contains filtered or unexported fields
}
Block represents a block in the Graph Chain
type ChainDataSource ¶
type ChainDataSource struct {
ChainID ids.ID `json:"chainId"`
ChainName string `json:"chainName"`
Connected bool `json:"connected"`
LastSync int64 `json:"lastSync"`
BlockHeight uint64 `json:"blockHeight"`
}
ChainDataSource represents a connected chain data source
type ChainSyncEvent ¶
type ChainSyncEvent struct {
ChainID ids.ID `json:"chainId"`
BlockHeight uint64 `json:"blockHeight"`
BlockHash ids.ID `json:"blockHash"`
Timestamp int64 `json:"timestamp"`
}
ChainSyncEvent represents a chain synchronization event
type DataIndex ¶
type DataIndex struct {
ID string `json:"id"`
ChainID ids.ID `json:"chainId"`
IndexType string `json:"indexType"`
Fields []string `json:"fields"`
Status string `json:"status"`
}
DataIndex represents an index for optimized queries
type GConfig ¶
type GConfig struct {
// DGraph configuration
DgraphEndpoint string `serialize:"true" json:"dgraphEndpoint"`
SchemaVersion string `serialize:"true" json:"schemaVersion"`
EnableFederation bool `serialize:"true" json:"enableFederation"`
// Query configuration
MaxQueryDepth int `serialize:"true" json:"maxQueryDepth"`
QueryTimeoutMs int `serialize:"true" json:"queryTimeoutMs"`
MaxResultSize int `serialize:"true" json:"maxResultSize"`
// Index configuration
AutoIndex bool `serialize:"true" json:"autoIndex"`
IndexBatchSize int `serialize:"true" json:"indexBatchSize"`
}
GConfig contains VM configuration
type GraphSchema ¶
type GraphSchema struct {
ID string `json:"id"`
Name string `json:"name"`
Version string `json:"version"`
Schema string `json:"schema"`
Types []string `json:"types"`
Directives []string `json:"directives"`
CreatedAt int64 `json:"createdAt"`
UpdatedAt int64 `json:"updatedAt"`
}
GraphSchema represents a GraphQL schema definition
type IndexUpdate ¶
type IndexUpdate struct {
IndexID string `json:"indexId"`
ChainID ids.ID `json:"chainId"`
Operation string `json:"operation"` // create, update, rebuild
Status string `json:"status"`
}
IndexUpdate represents an index update
type Query ¶
type Query struct {
ID ids.ID `json:"id"`
QueryText string `json:"queryText"`
Variables []byte `json:"variables"`
ChainScope []ids.ID `json:"chainScope"`
Result []byte `json:"result,omitempty"`
Status QueryStatus `json:"status"`
SubmittedAt int64 `json:"submittedAt"`
CompletedAt int64 `json:"completedAt,omitempty"`
}
Query represents a GraphQL query
type QueryResult ¶
type QueryResult struct {
QueryID ids.ID `json:"queryId"`
ResultHash []byte `json:"resultHash"`
Status string `json:"status"`
}
QueryResult represents a query result to be committed
type QueryStatus ¶
type QueryStatus uint8
QueryStatus represents the status of a query
const ( QueryPending QueryStatus = iota QueryProcessing QueryCompleted QueryFailed )
type SchemaUpdate ¶
type SchemaUpdate struct {
SchemaID string `json:"schemaId"`
Operation string `json:"operation"` // create, update, delete
NewVersion string `json:"newVersion,omitempty"`
Schema string `json:"schema,omitempty"`
}
SchemaUpdate represents an update to a GraphQL schema
type Subscription ¶
type Subscription struct {
ID ids.ID `json:"id"`
QueryText string `json:"queryText"`
ChainScope []ids.ID `json:"chainScope"`
Active bool `json:"active"`
CreatedAt int64 `json:"createdAt"`
}
Subscription represents a GraphQL subscription
type VM ¶
type VM struct {
// contains filtered or unexported fields
}
VM implements the chain.ChainVM interface for the Graph Chain (G-Chain)
func (*VM) AppRequest ¶
func (vm *VM) AppRequest(ctx context.Context, nodeID ids.NodeID, requestID uint32, deadline time.Time, request []byte) error
AppRequest implements the common.AppHandler interface
func (*VM) AppRequestFailed ¶
func (vm *VM) AppRequestFailed(ctx context.Context, nodeID ids.NodeID, requestID uint32, appErr *warp.Error) error
AppRequestFailed implements the common.AppHandler interface
func (*VM) AppResponse ¶
func (vm *VM) AppResponse(ctx context.Context, nodeID ids.NodeID, requestID uint32, response []byte) error
AppResponse implements the common.AppHandler interface
func (*VM) BuildBlock ¶
BuildBlock implements the chain.ChainVM interface
func (*VM) ConnectChainSource ¶
ConnectChainSource connects a chain as a data source
func (*VM) CreateHandlers ¶
CreateHandlers implements the common.VM interface
func (*VM) CrossChainAppRequest ¶
func (vm *VM) CrossChainAppRequest(ctx context.Context, chainID ids.ID, requestID uint32, deadline time.Time, msg []byte) error
CrossChainAppRequest implements the common.VM interface
func (*VM) CrossChainAppRequestFailed ¶
func (vm *VM) CrossChainAppRequestFailed(ctx context.Context, chainID ids.ID, requestID uint32, appErr *warp.Error) error
CrossChainAppRequestFailed implements the common.VM interface
func (*VM) CrossChainAppResponse ¶
func (vm *VM) CrossChainAppResponse(ctx context.Context, chainID ids.ID, requestID uint32, msg []byte) error
CrossChainAppResponse implements the common.VM interface
func (*VM) Disconnected ¶
Disconnected implements the validators.Connector interface
func (*VM) ExecuteQuery ¶
ExecuteQuery executes a GraphQL query
func (*VM) GetBlockIDAtHeight ¶
GetBlockIDAtHeight implements the chain.ChainVM interface
func (*VM) HealthCheck ¶
HealthCheck implements the health.Checker interface
func (*VM) Initialize ¶
func (vm *VM) Initialize( ctx context.Context, chainCtx interface{}, db interface{}, genesisBytes []byte, upgradeBytes []byte, configBytes []byte, msgChan interface{}, fxs []interface{}, appSender interface{}, ) error
Initialize implements the common.VM interface
func (*VM) LastAccepted ¶
LastAccepted implements the chain.ChainVM interface
func (*VM) NewHTTPHandler ¶
NewHTTPHandler returns HTTP handlers for the VM
func (*VM) ParseBlock ¶
ParseBlock implements the chain.ChainVM interface
func (*VM) RegisterSchema ¶
func (vm *VM) RegisterSchema(schema *GraphSchema) error
RegisterSchema registers a new GraphQL schema
func (*VM) SetPreference ¶
SetPreference implements the chain.ChainVM interface