transform

package
v0.0.0-...-5db7df5 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2023 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Abi

func Abi(b []byte) (abi json.RawMessage, err error)

func Account

func Account(b []byte, kind string) (trace json.RawMessage, err error)

func BadK1SumToPub

func BadK1SumToPub(pk string) (ecc.PublicKey, string, error)

BadK1SumToPub handles an issue where we are getting invalid checksums on public keys

func Block

func Block(b []byte, fallbackUrl string) (header json.RawMessage, schedule json.RawMessage, err error)

Block splits a block into the header and a schedule (if present), it also calculates block number and id

func BuildTrie

func BuildTrie() (intTrie *trie.Trie, floatTrie *trie.Trie, boolTrie *trie.Trie)

BuildTrie creates a trie used to search for type casts, it is slightly faster than trying every possible value.

func Fixup

func Fixup(fixme map[string]interface{}) map[string]interface{}

Fixup applies type casting for fields that need changed. For example an amount that should be an int but is a string most of these could be handled by logstash but because they are deeply nested it would require using the ruby plugin so this should be faster. It still slows the ingest process by roughly double, but not having the numeric types is not ok.

func Table

func Table(b []byte) (j json.RawMessage, err error)

func Trace

func Trace(b []byte) (trace json.RawMessage, err error)

Trace handles various type casts and enhances with a block id and other expected metadata

Types

type AbiUpdate

type AbiUpdate struct {
	Id             string          `json:"id"`
	RecordType     string          `json:"record_type"`
	BlockNum       interface{}     `json:"block_num"`
	BlockTimestamp string          `json:"block_timestamp"`
	Account        string          `json:"account"`
	Abi            json.RawMessage `json:"abi"`
	AbiBytes       string          `json:"abi_bytes"`
}

type AccountUpdate

type AccountUpdate struct {
	Id         string          `json:"id"`
	RecordType string          `json:"record_type"`
	BlockNum   interface{}     `json:"block_num"`
	BlockTime  string          `json:"block_timestamp"`
	Data       json.RawMessage `json:"data"`
}

type BlockFinished

type BlockFinished struct {
	Data struct {
		BlockNum string `json:"block_num"`
	} `json:"data"`
}

type BlockHeader

type BlockHeader struct {
	Timestamp        eos.BlockTimestamp `json:"timestamp"`
	Producer         eos.AccountName    `json:"producer"`
	Confirmed        interface{}        `json:"confirmed"`
	Previous         eos.Checksum256    `json:"previous"`
	TransactionMRoot eos.Checksum256    `json:"transaction_mroot"`
	ActionMRoot      eos.Checksum256    `json:"action_mroot"`
	ScheduleVersion  interface{}        `json:"schedule_version"`
	//NewProducers     *ProducerSchedule  `json:"new_producers" eos:"optional"`
	NewProducers     map[string]interface{} `json:"new_producers" eos:"optional"`
	HeaderExtensions []*Extension           `json:"header_extensions"`
	deadlock.Mutex
}

func (*BlockHeader) BlockID

func (b *BlockHeader) BlockID() (string, []ProducerKeyString, error)

func (*BlockHeader) BlockNumber

func (b *BlockHeader) BlockNumber() uint32

type Extension

type Extension struct {
	Type interface{}
	Data eos.HexBytes
}

type FullBlock

type FullBlock struct {
	RecordType string      `json:"record_type"`
	BlockTime  time.Time   `json:"block_time"`
	Block      SignedBlock `json:"block"`
	BlockNum   interface{} `json:"block_num"`
	BlockId    string      `json:"id"`
}

FullBlock duplicates eos.SignedBlock because the provided json has metadata

type FullTrace

type FullTrace struct {
	NetUsageWords   string                   `json:"net_usage_words"`
	Scheduled       string                   `json:"scheduled"`
	Partial         map[string]interface{}   `json:"partial"`
	AccountRamDelta interface{}              `json:"account_ram_delta"`
	NetUsage        string                   `json:"net_usage"`
	Elapsed         string                   `json:"elapsed"`
	ErrorCode       interface{}              `json:"error_code"`
	CpuUsageUs      string                   `json:"cpu_usage_us"`
	FailedDtrxTrace interface{}              `json:"failed_dtrx_trace"`
	Except          string                   `json:"except"`
	Status          string                   `json:"status"`
	Id              string                   `json:"id"`
	ActionTraces    []map[string]interface{} `json:"action_traces"`
}

type Kvo

type Kvo struct {
	Code           string      `json:"code"`
	Scope          string      `json:"scope"`
	Table          string      `json:"table"`
	PrimaryKey     interface{} `json:"primary_key"`
	PrimaryKeyName string      `json:"primary_key_name"`
	Value          interface{} `json:"value"`
}

type MsgData

type MsgData struct {
	Data json.RawMessage `json:"data"`
}

type ProducerKeyString

type ProducerKeyString struct {
	AccountName     string `json:"producer_name"`
	BlockSigningKey string `json:"block_signing_key"`
}

type ProducerSchedule

type ProducerSchedule struct {
	Version   interface{}       `json:"version"`
	Producers []eos.ProducerKey `json:"producers"`
}

type ProducerScheduleString

type ProducerScheduleString struct {
	Version   uint32              `json:"version"`
	Producers []ProducerKeyString `json:"producers"`
}

type Schedule

type Schedule struct {
	Id              string              `json:"id"`
	RecordType      string              `json:"record_type"`
	Producers       []ProducerKeyString `json:"producers"`
	ScheduleVersion interface{}         `json:"schedule"`
	BlockNum        interface{}         `json:"block_num"`
	BlockTime       time.Time           `json:"block_time"`
}

Schedule duplicates an eos.OptionalProducerSchedule but adds some metadata

type SignedBlock

type SignedBlock struct {
	RecordType string `json:"record_type"`
	SignedBlockHeader
	Transactions    []map[string]interface{} `json:"transactions"`
	BlockExtensions json.RawMessage          `json:"block_extensions"`
}

type SignedBlockHeader

type SignedBlockHeader struct {
	BlockHeader
	ProducerSignature ecc.Signature `json:"producer_signature"`
}

type TableData

type TableData struct {
	Id             string       `json:"id"`
	RecordType     string       `json:"record_type"`
	BlockNum       interface{}  `json:"block_num"`
	BlockTimeStamp eos.JSONTime `json:"block_timestamp"`
	Added          interface{}  `json:"added"`
	Kvo            *Kvo         `json:"kvo"`
}

type TraceResult

type TraceResult struct {
	Id         string      `json:"id"`
	RecordType string      `json:"record_type"`
	BlockNum   interface{} `json:"block_num"`
	BlockTime  string      `json:"block_timestamp"`
	Trace      FullTrace   `json:"trace"`
}

Jump to

Keyboard shortcuts

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