pvm

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2020 License: BSD-3-Clause Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrSerializationTooLong = errors.New("serialization is too long")
)
View Source
var (
	ErrUnknownBlockType = errors.New("unknown block type")
)

Functions

func NewAPIRouter

func NewAPIRouter(params api.RouterParams) error

Types

type APIContext

type APIContext struct {
	*api.RootRequestContext
	// contains filtered or unexported fields
}

func (*APIContext) ListBlocks

func (c *APIContext) ListBlocks(w web.ResponseWriter, r *web.Request)

func (*APIContext) ListChains

func (c *APIContext) ListChains(w web.ResponseWriter, r *web.Request)

func (*APIContext) ListSubnets

func (c *APIContext) ListSubnets(w web.ResponseWriter, r *web.Request)

func (*APIContext) ListValidators

func (c *APIContext) ListValidators(w web.ResponseWriter, r *web.Request)

func (*APIContext) Overview

func (c *APIContext) Overview(w web.ResponseWriter, _ *web.Request)

type Block

type Block struct {
	ID        models.StringID `json:"id"`
	ParentID  models.StringID `json:"parentID"`
	ChainID   models.StringID `json:"chainID"`
	Type      BlockType       `json:"type"`
	CreatedAt time.Time       `json:"createdAt"`
}

type BlockList

type BlockList struct {
	Blocks []*Block `json:"blocks"`
}

type BlockSort

type BlockSort string

type BlockType

type BlockType uint8
const (
	VMName = "pvm"

	BlockTypeProposal BlockType = iota
	BlockTypeAbort
	BlockTypeCommit
	BlockTypeStandard
	BlockTypeAtomic
)

type Chain

type Chain struct {
	ID                models.StringID    `json:"id"`
	SubnetID          models.StringID    `json:"subnetID"`
	Name              string             `json:"name"`
	VMID              models.StringID    `json:"vmID" db:"vm_id"`
	ControlSignatures []ControlSignature `json:"controlSignatures"`
	FxIDs             []models.StringID  `json:"fxIDs"`
	GenesisData       []byte             `json:"genesisData"`
}

type ChainList

type ChainList struct {
	Chains []*Chain `json:"chains"`
}

type ControlKey

type ControlKey struct {
	Address   models.StringShortID `json:"address"`
	PublicKey []byte               `json:"publicKey"`
}

type ControlSignature

type ControlSignature []byte

type DB

type DB struct {
	// contains filtered or unexported fields
}

func NewDBIndex

func NewDBIndex(stream *health.Stream, db *dbr.Connection, networkID uint32, chainID string, codec codec.Codec) *DB

NewDBIndex creates a new DB for the given config

func (*DB) Bootstrap

func (db *DB) Bootstrap(ctx context.Context) error

func (*DB) Close

func (db *DB) Close(context.Context) error

func (*DB) Consume

func (db *DB) Consume(ctx context.Context, c services.Consumable) error

func (*DB) ListBlocks

func (db *DB) ListBlocks(ctx context.Context, params ListBlocksParams) (*BlockList, error)

func (*DB) ListChains

func (db *DB) ListChains(ctx context.Context, params ListChainsParams) (*ChainList, error)

func (*DB) ListSubnets

func (db *DB) ListSubnets(ctx context.Context, params ListSubnetsParams) (*SubnetList, error)

func (*DB) ListValidators

func (db *DB) ListValidators(ctx context.Context, params ListValidatorsParams) (*ValidatorList, error)

type Index

type Index struct {
	// contains filtered or unexported fields
}

func New

func New(conf cfg.Services, networkID uint32, chainID string) (*Index, error)

func (*Index) Bootstrap

func (i *Index) Bootstrap(ctx context.Context) error

func (*Index) Close

func (i *Index) Close(ctx context.Context) error

func (*Index) Consume

func (i *Index) Consume(ctx context.Context, ingestable services.Consumable) error

func (*Index) GetBlock

func (i *Index) GetBlock(ctx context.Context, id ids.ID) (*Block, error)

func (*Index) GetChain

func (i *Index) GetChain(ctx context.Context, id ids.ID) (*Chain, error)

func (*Index) GetChainInfo

func (i *Index) GetChainInfo(alias string, networkID uint32) (*models.ChainInfo, error)

func (*Index) GetSubnet

func (i *Index) GetSubnet(ctx context.Context, id ids.ID) (*Subnet, error)

func (*Index) GetValidator

func (i *Index) GetValidator(ctx context.Context, id ids.ID) (*Validator, error)

func (*Index) ListBlocks

func (i *Index) ListBlocks(ctx context.Context, p ListBlocksParams) (*BlockList, error)

func (*Index) ListChains

func (i *Index) ListChains(ctx context.Context, p ListChainsParams) (*ChainList, error)

func (*Index) ListSubnets

func (i *Index) ListSubnets(ctx context.Context, p ListSubnetsParams) (*SubnetList, error)

func (*Index) ListValidators

func (i *Index) ListValidators(ctx context.Context, p ListValidatorsParams) (*ValidatorList, error)

func (*Index) Name

func (i *Index) Name() string

type ListBlocksParams

type ListBlocksParams struct {
	params.ListParams

	ID        *ids.ID
	Types     []BlockType
	StartTime time.Time
	EndTime   time.Time
	Sort      BlockSort
}

type ListChainsParams

type ListChainsParams struct {
	params.ListParams

	ID      *ids.ID
	Subnets []ids.ID
	VMID    *ids.ID
}

type ListSubnetsParams

type ListSubnetsParams struct {
	params.ListParams

	ID *ids.ID
}

type ListValidatorsParams

type ListValidatorsParams struct {
	params.ListParams

	ID           *ids.ID
	Subnets      []ids.ID
	Destinations []ids.ShortID
	StartTime    time.Time
	EndTime      time.Time
}

type SearchParams

type SearchParams struct {
	params.ListParams
}

type Subnet

type Subnet struct {
	ID          models.StringID `json:"id"`
	Threshold   uint64          `json:"threshold"`
	ControlKeys []ControlKey    `json:"controlKeys"`
	CreatedAt   time.Time       `json:"createdAt"`
}

type SubnetList

type SubnetList struct {
	Subnets []*Subnet `json:"subnets"`
}

type Transaction

type Transaction struct{}

type TransactionList

type TransactionList struct{}

type TransactionType

type TransactionType uint8
const (
	// Timed
	TransactionTypeAddDefaultSubnetValidator TransactionType = (iota * 2) + 11
	TransactionTypeAddNonDefaultSubnetValidator
	TransactionTypeAddDefaultSubnetDelegator

	// Decision
	TransactionTypeCreateChain
	TransactionTypeCreateSubnet

	// Atomic
	TransactionTypeImport
	TransactionTypeExport
)

type Validator

type Validator struct {
	TransactionID models.StringID `json:"transactionID"`

	NodeID models.StringShortID `json:"nodeID"`
	Weight string               `json:"weight"`

	StartTime time.Time `json:"startTime"`
	EndTime   time.Time `json:"endTime"`

	Destination models.StringShortID `json:"destination"`
	Shares      uint32               `json:"shares"`

	SubnetID models.StringID `json:"subnetID"`
}

type ValidatorList

type ValidatorList struct {
	Validators []*Validator `json:"validators"`
}

Jump to

Keyboard shortcuts

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