gvm

package
v1.22.22 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 21, 2025 License: BSD-3-Clause Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
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

func (*Block) Accept

func (b *Block) Accept(context.Context) error

Accept implements the chain.Block interface

func (*Block) Bytes

func (b *Block) Bytes() []byte

Bytes implements the chain.Block interface

func (*Block) Height

func (b *Block) Height() uint64

Height implements the chain.Block interface

func (*Block) ID

func (b *Block) ID() ids.ID

ID implements the chain.Block interface

func (*Block) Parent

func (b *Block) Parent() ids.ID

Parent implements the chain.Block interface

func (*Block) ParentID

func (b *Block) ParentID() ids.ID

ParentID returns the parent block ID

func (*Block) Reject

func (b *Block) Reject(context.Context) error

Reject implements the chain.Block interface

func (*Block) Status

func (b *Block) Status() choices.Status

Status implements the chain.Block interface

func (*Block) Timestamp

func (b *Block) Timestamp() time.Time

Timestamp implements the chain.Block interface

func (*Block) Verify

func (b *Block) Verify(ctx context.Context) error

Verify implements the chain.Block interface

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 Factory

type Factory struct{}

Factory creates new instances of the Graph VM

func (*Factory) New

func (f *Factory) New(log.Logger) (interface{}, error)

New returns a new instance of the Graph VM

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) AppGossip

func (vm *VM) AppGossip(ctx context.Context, nodeID ids.NodeID, msg []byte) error

AppGossip implements the common.AppHandler interface

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

func (vm *VM) BuildBlock(ctx context.Context) (block.Block, error)

BuildBlock implements the chain.ChainVM interface

func (*VM) ConnectChainSource

func (vm *VM) ConnectChainSource(chainID ids.ID, chainName string) error

ConnectChainSource connects a chain as a data source

func (*VM) Connected

func (vm *VM) Connected(ctx context.Context, nodeID ids.NodeID, nodeVersion interface{}) error

Connected implements the validators.Connector interface

func (*VM) CreateHandlers

func (vm *VM) CreateHandlers(context.Context) (map[string]http.Handler, error)

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

func (vm *VM) Disconnected(ctx context.Context, nodeID ids.NodeID) error

Disconnected implements the validators.Connector interface

func (*VM) ExecuteQuery

func (vm *VM) ExecuteQuery(query *Query) error

ExecuteQuery executes a GraphQL query

func (*VM) GetBlock

func (vm *VM) GetBlock(ctx context.Context, blkID ids.ID) (block.Block, error)

GetBlock implements the chain.ChainVM interface

func (*VM) GetBlockIDAtHeight

func (vm *VM) GetBlockIDAtHeight(ctx context.Context, height uint64) (ids.ID, error)

GetBlockIDAtHeight implements the chain.ChainVM interface

func (*VM) HealthCheck

func (vm *VM) HealthCheck(context.Context) (any, error)

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

func (vm *VM) LastAccepted(context.Context) (ids.ID, error)

LastAccepted implements the chain.ChainVM interface

func (*VM) NewHTTPHandler

func (vm *VM) NewHTTPHandler(ctx context.Context) (interface{}, error)

NewHTTPHandler returns HTTP handlers for the VM

func (*VM) ParseBlock

func (vm *VM) ParseBlock(ctx context.Context, blockBytes []byte) (block.Block, error)

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

func (vm *VM) SetPreference(ctx context.Context, blkID ids.ID) error

SetPreference implements the chain.ChainVM interface

func (*VM) SetState

func (vm *VM) SetState(ctx context.Context, state uint32) error

SetState implements the common.VM interface

func (*VM) Shutdown

func (vm *VM) Shutdown(context.Context) error

Shutdown implements the common.VM interface

func (*VM) Version

func (vm *VM) Version(context.Context) (string, error)

Version implements the common.VM interface

func (*VM) WaitForEvent

func (vm *VM) WaitForEvent(ctx context.Context) (interface{}, error)

WaitForEvent blocks until an event occurs that should trigger block building

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL