chain_plugin

package
v0.0.0-...-c626c17 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2019 License: MIT Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const ChainPlug = PluginTypeName("ChainPlugin")
View Source
const (
	KEYi64 = "i64"
)
View Source
const SizeofGetCurrencyStatsResult int = 40

Variables

This section is empty.

Functions

func ClearDirectoryContents

func ClearDirectoryContents(p string)

func CopyInlineRow

func CopyInlineRow(obj *KeyValueObject, data *[]byte)

func GetAbi

func GetAbi(db *chain.Controller, account common.Name) abi_serializer.AbiDef

func GetTableType

func GetTableType(abi *abi_serializer.AbiDef, tableName common.TableName) string

Types

type AbiBinToJsonParams

type AbiBinToJsonParams struct {
	Code    common.Name `json:"code"`
	Action  common.Name `json:"action"`
	Binargs []byte      `json:"binargs"`
}

type AbiBinToJsonResult

type AbiBinToJsonResult struct {
	Args common.Variant `json:"args"`
}

type AbiJsonToBinParams

type AbiJsonToBinParams struct {
	Code   common.Name     `json:"code"`
	Action common.Name     `json:"action"`
	Args   common.Variants `json:"args"`
}

type AbiJsonToBinReuslt

type AbiJsonToBinReuslt struct {
	Binargs []byte `json:"binargs"`
}

type Blob

type Blob struct {
	Data []byte `json:"data"`
}

type ChainPlugin

type ChainPlugin struct {
	AbstractPlugin
	// contains filtered or unexported fields
}

func NewChainPlugin

func NewChainPlugin() *ChainPlugin

func (*ChainPlugin) AcceptBlock

func (c *ChainPlugin) AcceptBlock(block *types.SignedBlock)

func (*ChainPlugin) AcceptTransaction

func (c *ChainPlugin) AcceptTransaction(trx *types.PackedTransaction, next chain_interface.NextFunction)

func (*ChainPlugin) Chain

func (c *ChainPlugin) Chain() *chain.Controller

func (*ChainPlugin) ExportReversibleBlocks

func (c *ChainPlugin) ExportReversibleBlocks(reversibleDir string, reversibleBlocksFile string) bool

func (*ChainPlugin) GetAbiSerializerMaxTime

func (c *ChainPlugin) GetAbiSerializerMaxTime() Microseconds

func (*ChainPlugin) GetChainId

func (c *ChainPlugin) GetChainId() ChainIdType

func (*ChainPlugin) GetReadOnlyApi

func (c *ChainPlugin) GetReadOnlyApi() *ReadOnly

func (*ChainPlugin) GetReadWriteApi

func (c *ChainPlugin) GetReadWriteApi() *ReadWrite

func (*ChainPlugin) HandleDbExhaustion

func (c *ChainPlugin) HandleDbExhaustion()

func (*ChainPlugin) HandleGuardException

func (c *ChainPlugin) HandleGuardException(e GuardExceptions)

func (*ChainPlugin) ImportReversibleBlocks

func (c *ChainPlugin) ImportReversibleBlocks(reversibleDir string, cacheSize uint32, reversibleBlocksFile string) bool

func (*ChainPlugin) PluginInitialize

func (c *ChainPlugin) PluginInitialize(options *cli.Context)

func (*ChainPlugin) PluginShutdown

func (c *ChainPlugin) PluginShutdown()

func (*ChainPlugin) PluginStartup

func (c *ChainPlugin) PluginStartup()

func (*ChainPlugin) RecoverReversibleBlocks

func (c *ChainPlugin) RecoverReversibleBlocks(dbDir string, cacheSize uint32, newDbDir string, truncateAtBlock uint32) bool

func (*ChainPlugin) SetProgramOptions

func (c *ChainPlugin) SetProgramOptions(options *[]cli.Flag)

type ChainPluginImpl

type ChainPluginImpl struct {
	BlockDir asio.Path
	Readonly bool

	ForkDB      *chain.ForkDatabase
	BlockLogger *chain.BlockLog

	ChainConfig *chain.Config
	Chain       *chain.Controller
	ChainId     common.ChainIdType

	//fc::optional<vm_type>            wasm_runtime;
	AbiSerializerMaxTimeMs common.Microseconds

	// retained references to channels for easy publication
	PreAcceptedBlockChannel     include.Channel
	AcceptedBlockHeaderChannel  include.Channel
	AcceptedBlockChannel        include.Channel
	IrreversibleBlockChannel    include.Channel
	AcceptedTransactionChannel  include.Channel
	AppliedTransactionChannel   include.Channel
	AcceptedConfirmationChannel include.Channel
	IncomingBlockChannel        include.Channel

	// retained references to methods for easy calling
	IncomingBlockSyncMethod        *include.Method
	IncomingTransactionAsyncMethod *include.Method

	// method provider handles
	GetBlockByNumberProvider               *include.Method
	GetBlockByIdProvider                   *include.Method
	GetHeadBlockIdProvider                 *include.Method
	GetLastIrreversibleBlockNumberProvider *include.Method
}

func NewChainPluginImpl

func NewChainPluginImpl() *ChainPluginImpl

type GetAbiParams

type GetAbiParams struct {
	AccountName common.Name `json:"account_name"`
}

type GetAbiResult

type GetAbiResult struct {
	AccountName common.Name           `json:"account_name"`
	Abi         abi_serializer.AbiDef `json:"abi"`
}

type GetAccountParams

type GetAccountParams struct {
	AccountName        common.AccountName `json:"account_name"`
	ExpectedCoreSymbol *common.Symbol     `json:"expected_core_symbol"`
}

type GetAccountResult

type GetAccountResult struct {
	AccountName            common.AccountName         `json:"account_name"`
	HeadBlockNum           uint32                     `json:"head_block_num"`
	HeadBlockTime          common.TimePoint           `json:"head_block_time"`
	Privileged             bool                       `json:"privileged"`
	LastCodeUpdate         common.TimePoint           `json:"last_code_update"`
	Created                common.TimePoint           `json:"created"`
	CoreLiquidBalance      common.Asset               `json:"core_liquid_balance"`
	RAMQuota               int64                      `json:"ram_quota"`
	NetWeight              int64                      `json:"net_weight"`
	CPUWeight              int64                      `json:"cpu_weight"`
	NetLimit               types.AccountResourceLimit `json:"net_limit"`
	CpuLimit               types.AccountResourceLimit `json:"cpu_limit"`
	RAMUsage               int64                      `json:"ram_usage"`
	Permissions            []Permission               `json:"permissions"`
	TotalResources         common.Variant             `json:"total_resources"`
	SelfDelegatedBandwidth common.Variant             `json:"self_delegated_bandwidth"`
	RefundRequest          common.Variant             `json:"refund_request"`
	VoterInfo              common.Variant             `json:"voter_info"`
}

type GetBlockHeaderStateParams

type GetBlockHeaderStateParams struct {
	BlockNumOrID string `json:"block_num_or_id"`
}

type GetBlockHeaderStateResult

type GetBlockHeaderStateResult = types.BlockHeaderState

type GetBlockParams

type GetBlockParams struct {
	BlockNumOrID string `json:"block_num_or_id"`
}

type GetBlockResult

type GetBlockResult struct {
	SignedBlock    *types.SignedBlock `json:"signed_block"`
	ID             common.BlockIdType `json:"id"`
	BlockNum       uint32             `json:"block_num"`
	RefBlockPrefix uint32             `json:"ref_block_prefix"`
}

type GetCodeHashParams

type GetCodeHashParams struct {
	AccountName common.AccountName `json:"account_name"`
}

type GetCodeHashResults

type GetCodeHashResults struct {
	AccountName common.Name   `json:"account_name"`
	CodeHash    crypto.Sha256 `json:"code_hash"`
}

type GetCodeParams

type GetCodeParams struct {
	AccountName common.Name `json:"account_name"`
	CodeAsWasm  bool        `json:"code_as_wasm"`
}

type GetCodeResult

type GetCodeResult struct {
	AccountName common.Name           `json:"account_name"`
	Wast        string                `json:"wast"`
	Wasm        string                `json:"wasm"`
	CodeHash    crypto.Sha256         `json:"code_hash"`
	Abi         abi_serializer.AbiDef `json:"abi"`
}

type GetCurrencyBalanceParams

type GetCurrencyBalanceParams struct {
	Code    common.Name `json:"code"`
	Account common.Name `json:"account_name"`
	Symbol  string      `json:"symbol"`
}

type GetCurrencyBalanceResult

type GetCurrencyBalanceResult = []common.Asset

type GetCurrencyStatsParams

type GetCurrencyStatsParams struct {
	Code   common.Name `json:"code"`
	Symbol string      `json:"symbol"`
}

type GetCurrencyStatsResult

type GetCurrencyStatsResult struct {
	Supply    common.Asset       `json:"supply"`
	MaxSupply common.Asset       `json:"max_supply"`
	Issuer    common.AccountName `json:"issuer"`
}

type GetInfoResult

type GetInfoResult struct {
	ServerVersion            string             `json:"server_version"`
	ChainID                  common.ChainIdType `json:"chain_id"`
	HeadBlockNum             uint32             `json:"head_block_num"`
	LastIrreversibleBlockNum uint32             `json:"last_irreversible_block_num"`
	LastIrreversibleBlockID  common.BlockIdType `json:"last_irreversible_block_id"`
	HeadBlockID              common.BlockIdType `json:"head_block_id"`
	HeadBlockTime            common.TimePoint   `json:"head_block_time"`
	HeadBlockProducer        common.AccountName `json:"head_block_producer"`
	VirtualBlockCPULimit     uint64             `json:"virtual_block_cpu_limit"`
	VirtualBlockNetLimit     uint64             `json:"virtual_block_net_limit"`
	BlockCPULimit            uint64             `json:"block_cpu_limit"`
	BlockNetLimit            uint64             `json:"block_net_limit"`
	ServerVersionString      string             `json:"server_version_string"`
}

type GetProducerScheduleParams

type GetProducerScheduleParams struct {
}

type GetProducerScheduleResult

type GetProducerScheduleResult struct {
	Active   common.Variants `json:"active"`
	Pending  common.Variants `json:"pending"`
	Proposed common.Variants `json:"proposed"`
}

type GetProducersParams

type GetProducersParams struct {
	Json       bool   `json:"json"` //defaults false
	LowerBound string `json:"lower_bound"`
	Limit      uint32 `json:"limit"` //defaults 50
}

type GetProducersResult

type GetProducersResult struct {
	Rows                    []common.Variant `json:"rows"`                       //one row per item, either encoded as hex string or JSON object
	TotalProducerVoteWeight float64          `json:"total_producer_vote_weight"` //TODO C++ double
	More                    string           `json:"more"`                       //fill lower_bound with this value to fetch more rows
}

type GetRawAbiParams

type GetRawAbiParams struct {
	AccountName common.Name   `json:"account_name"`
	AbiHash     crypto.Sha256 `json:"abi_hash"` //optional
}

type GetRawAbiResult

type GetRawAbiResult struct {
	AccountName common.Name   `json:"account_name"`
	CodeHash    crypto.Sha256 `json:"code_hash"`
	AbiHash     crypto.Sha256 `json:"abi_hash"`
	Abi         *Blob         `json:"abi"` //TODO C++ optional<chain::blob>
}

type GetRawCodeAndAbiParams

type GetRawCodeAndAbiParams struct {
	AccountName common.Name `json:"account_name"`
}

type GetRawCodeAndAbiResults

type GetRawCodeAndAbiResults struct {
	AccountName common.Name `json:"account_name"`
	Wasm        Blob        `json:"wasm"` //chain::blob
	Abi         Blob        `json:"abi"`  //chain::blob
}

type GetRequiredKeysParams

type GetRequiredKeysParams struct {
	Transaction   common.Variant `json:"transaction"`
	AvailableKeys PublicKeySet   `json:"available_keys"`
}

type GetRequiredKeysResult

type GetRequiredKeysResult struct {
	RequiredKeys PublicKeySet `json:"required_keys"`
}

type GetScheduleTransactionReuslt

type GetScheduleTransactionReuslt struct {
	Transaction common.Variants `json:"transaction"`
	More        string          `json:"more"` //fill lower_bound with this to fetch next set of transactions
}

type GetScheduledTransactionParams

type GetScheduledTransactionParams struct {
	Json       bool   `json:"json"`
	LowerBound string `json:"lower_bound"` //timestamp OR transaction ID
	Limit      uint32 `json:"limit"`       //default 50
}

type GetTableByScopeParams

type GetTableByScopeParams struct {
	Code       common.Name `json:"code"`        // mandatory
	Table      common.Name `json:"table"`       // optional, act as filter =0
	LowerBound string      `json:"lower_bound"` // lower bound of scope, optional
	UpperBound string      `json:"upper_bound"` // upper bound of scope, optional
	Limit      uint32      `json:"limit"`       //=10
}

type GetTableByScopeResult

type GetTableByScopeResult struct {
	Rows []GetTableByScopeResultRow
	More string //< fill lower_bound with this value to fetch more rows
}

type GetTableByScopeResultRow

type GetTableByScopeResultRow struct {
	Code  common.Name `json:"code"`
	Scope common.Name `json:"scope"`
	Table common.Name `json:"table"`
	Payer common.Name `json:"payer"`
	Count uint32      `json:"count"`
}

type GetTableRowsParams

type GetTableRowsParams struct {
	JSON          bool        `json:"json"`
	Code          common.Name `json:"code"`
	Scope         string      `json:"scope"`
	Table         common.Name `json:"table"`
	TableKey      string      `json:"table_key"`
	LowerBound    string      `json:"lower_bound"`
	UpperBound    string      `json:"upper_bound"`
	Limit         uint32      `json:"limit,omitempty"` // defaults to 10 => chain_plugin.hpp:struct get_table_rows_params
	KeyType       string      `json:"key_type"`        // type of key specified by index_position
	IndexPosition string      `json:"index_position"`  // 1 - primary (first), 2 - secondary index (in order defined by multi_index), 3 - third index, etc
	EncodeType    string      `json:"encode_type"`     //dec, hex , default=dec
}

type GetTableRowsResult

type GetTableRowsResult struct {
	Rows []common.Variants `json:"rows"` // true if last element in data is not the end and sizeof data() < limit
	More bool              `json:"more"` // one row per item, either encoded as hex String or JSON object
}

type Permission

type Permission struct {
	PermName     common.Name
	Parent       common.Name
	RequiredAuth types.Authority
}

type PushBlockParams

type PushBlockParams = types.SignedBlock

type PushTransactionParams

type PushTransactionParams = map[string]interface{}

type PushTransactionResult

type PushTransactionResult struct {
	TransactionId common.TransactionIdType
	Processed     map[string]interface{}
}

type RamMarketExchangeState

type RamMarketExchangeState struct {
	Ignore1    common.Asset
	Ignore2    common.Asset
	Ignore3    common.Asset
	CoreSymbol common.Asset
	Ignore4    common.Asset
}

type ReadOnly

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

func NewReadOnly

func NewReadOnly(db *chain.Controller, abiSerializerMaxTime common.Microseconds) *ReadOnly

func (*ReadOnly) ExtractCoreSymbol

func (ro *ReadOnly) ExtractCoreSymbol() common.Symbol

func (*ReadOnly) GetAbi

func (ro *ReadOnly) GetAbi(params GetAbiParams) GetAbiResult

func (*ReadOnly) GetAccount

func (ro *ReadOnly) GetAccount(params GetAccountParams) GetAccountResult

func (*ReadOnly) GetBlock

func (ro *ReadOnly) GetBlock(params GetBlockParams) *GetBlockResult

func (*ReadOnly) GetBlockHeaderState

func (ro *ReadOnly) GetBlockHeaderState(params GetBlockHeaderStateParams) GetBlockHeaderStateResult

func (*ReadOnly) GetCode

func (ro *ReadOnly) GetCode(params GetCodeParams) GetCodeResult

func (*ReadOnly) GetCurrencyBalance

func (ro *ReadOnly) GetCurrencyBalance(params GetCurrencyBalanceParams) GetCurrencyBalanceResult

func (*ReadOnly) GetCurrencyStats

func (ro *ReadOnly) GetCurrencyStats(params GetCurrencyStatsParams) map[string]GetCurrencyStatsResult

func (*ReadOnly) GetInfo

func (ro *ReadOnly) GetInfo() *GetInfoResult

func (*ReadOnly) GetProducerSchedule

func (ro *ReadOnly) GetProducerSchedule() GetProducerScheduleResult

func (*ReadOnly) GetRequiredKeys

func (ro *ReadOnly) GetRequiredKeys(params GetRequiredKeysParams) GetRequiredKeysResult

func (*ReadOnly) GetTableByScope

func (ro *ReadOnly) GetTableByScope(p GetTableByScopeParams) GetTableByScopeResult

func (*ReadOnly) GetTableIndexName

func (ro *ReadOnly) GetTableIndexName(p GetTableRowsParams, primary *bool) uint64

func (*ReadOnly) GetTableRows

func (ro *ReadOnly) GetTableRows(p GetTableRowsParams) GetTableRowsResult

func (*ReadOnly) GetTableRowsEx

func (*ReadOnly) SetShortenAbiErrors

func (ro *ReadOnly) SetShortenAbiErrors(f bool)

func (*ReadOnly) WalkKeyValueTable

func (ro *ReadOnly) WalkKeyValueTable(code, scope, table common.Name, f func(KeyValueObject) bool)

type ReadWrite

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

func NewReadWrite

func NewReadWrite(db *chain.Controller, abiSerializerMaxTime common.Microseconds) *ReadWrite

func (*ReadWrite) PushBlock

func (rw *ReadWrite) PushBlock(params PushBlockParams, next NextFunction)

func (*ReadWrite) PushTransaction

func (rw *ReadWrite) PushTransaction(params PushTransactionParams, next NextFunction)

func (*ReadWrite) Validate

func (rw *ReadWrite) Validate()

Jump to

Keyboard shortcuts

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