types

package
v1.0.62 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2024 License: GPL-3.0 Imports: 9 Imported by: 4

Documentation

Overview

Copyright 2020 The CortexTheseus Authors This file is part of the CortexTheseus library.

The CortexTheseus library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

The CortexTheseus library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with the CortexTheseus library. If not, see <http://www.gnu.org/licenses/>.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrorCodeTypeMeta      = errors.New("meta should start with 0x0001 or 0x0002")
	ErrorCodeTypeModelMeta = errors.New("model meta should start with 0x0001")
	ErrorCodeTypeInputMeta = errors.New("input meta should start with 0x0002")
	ErrorDecodeModelMeta   = errors.New("model meta decode error")
	ErrorDecodeInputMeta   = errors.New("input meta decode error")
	ErrorNotMature         = errors.New("not mature")
	ErrorExpired           = errors.New("meta Expired")
	ErrorInvalidBlockNum   = errors.New("invalid block number")
)

Functions

This section is empty.

Types

type BitsFlow

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

func NewBitsFlow

func NewBitsFlow(ih string, request uint64) *BitsFlow

func (*BitsFlow) InfoHash

func (b *BitsFlow) InfoHash() string

func (*BitsFlow) Request

func (b *BitsFlow) Request() uint64

type Block

type Block struct {
	Number uint64      `json:"number"           gencodec:"required"`
	Hash   common.Hash `json:"Hash"             gencodec:"required"`
	//ParentHash common.Hash   `json:"parentHash"       gencodec:"required"`
	Txs []Transaction `json:"transactions"     gencodec:"required"`
}

func (*Block) EncodeRLP

func (obj *Block) EncodeRLP(_w io.Writer) error

func (Block) MarshalJSON

func (b Block) MarshalJSON() ([]byte, error)

MarshalJSON marshals as JSON.

func (*Block) UnmarshalJSON

func (b *Block) UnmarshalJSON(input []byte) error

UnmarshalJSON unmarshals from JSON.

type FileInfo

type FileInfo struct {
	Meta *FileMeta
	// Transaction hash
	//TxHash *common.Hash
	// Contract Address
	ContractAddr *common.Address
	LeftSize     uint64
	Relate       []common.Address
}

func (*FileInfo) EncodeRLP

func (obj *FileInfo) EncodeRLP(_w io.Writer) error

func (FileInfo) MarshalJSON

func (f FileInfo) MarshalJSON() ([]byte, error)

MarshalJSON marshals as JSON.

func (*FileInfo) UnmarshalJSON

func (f *FileInfo) UnmarshalJSON(input []byte) error

UnmarshalJSON unmarshals from JSON.

type FileMeta

type FileMeta struct {
	InfoHash string `json:"infoHash"         gencodec:"required"`
	//	Name     string        `json:"Name"             gencodec:"required"`
	// The raw size of the file counted in bytes
	RawSize uint64 `json:"rawSize"          gencodec:"required"`
}

func (*FileMeta) DecodeRLP added in v1.0.62

func (fm *FileMeta) DecodeRLP(s *rlp.Stream) error

func (*FileMeta) EncodeRLP

func (obj *FileMeta) EncodeRLP(_w io.Writer) error

func (FileMeta) MarshalJSON

func (f FileMeta) MarshalJSON() ([]byte, error)

MarshalJSON marshals as JSON.

func (*FileMeta) UnmarshalJSON

func (f *FileMeta) UnmarshalJSON(input []byte) error

UnmarshalJSON unmarshals from JSON.

type InferMeta

type InferMeta interface {
	TypeCode() []byte
	RawSize() uint64
	// Gas() uint64
	AuthorAddress() common.Address
	InfoHash() string
	Comment() string
}

type InputMeta

type InputMeta struct {
	Comment string         `json:"comment"`
	Hash    common.Address `json:"hash"`
	RawSize uint64         `json:"rawSize"`
	Shape   []uint64       `json:"shape"`
	//AuthorAddress common.Address `json:"AuthorAddress"`
	BlockNum big.Int `json:"blockNum"`
}

func ParseInputMeta

func ParseInputMeta(code []byte) (*InputMeta, error)

func (*InputMeta) DecodeJSON

func (im *InputMeta) DecodeJSON(s string) error

func (*InputMeta) DecodeRLP

func (im *InputMeta) DecodeRLP(code []byte) error

func (*InputMeta) EncodeJSON

func (im *InputMeta) EncodeJSON() (string, error)

func (*InputMeta) EncodeRLP

func (obj *InputMeta) EncodeRLP(_w io.Writer) error

func (*InputMeta) InfoHash

func (mm *InputMeta) InfoHash() (ih string)

func (InputMeta) MarshalJSON

func (i InputMeta) MarshalJSON() ([]byte, error)

MarshalJSON marshals as JSON.

func (*InputMeta) SetBlockNum

func (im *InputMeta) SetBlockNum(num big.Int) error

func (*InputMeta) ToBytes

func (im *InputMeta) ToBytes() ([]byte, error)

func (*InputMeta) UnmarshalJSON

func (i *InputMeta) UnmarshalJSON(input []byte) error

UnmarshalJSON unmarshals from JSON.

type Meta

type Meta struct {
	Comment  string         `json:"comment"`
	Hash     common.Address `json:"hash"`
	RawSize  uint64         `json:"rawSize"`
	Shape    []uint64       `json:"shape"`
	BlockNum big.Int        `json:"blockNum"`
}

func ParseMeta

func ParseMeta(code []byte) (*Meta, error)

func (*Meta) EncodeRLP

func (obj *Meta) EncodeRLP(_w io.Writer) error

func (*Meta) InfoHash

func (mm *Meta) InfoHash() (ih string)

func (Meta) MarshalJSON

func (m Meta) MarshalJSON() ([]byte, error)

MarshalJSON marshals as JSON.

func (*Meta) UnmarshalJSON

func (m *Meta) UnmarshalJSON(input []byte) error

UnmarshalJSON unmarshals from JSON.

type ModelMeta

type ModelMeta struct {
	Comment       string         `json:"comment"`
	Hash          common.Address `json:"hash"`
	RawSize       uint64         `json:"rawSize"`
	InputShape    []uint64       `json:"inputShape"`
	OutputShape   []uint64       `json:"outputShape"`
	Gas           uint64         `json:"gas"`
	AuthorAddress common.Address `json:"authorAddress"`
	BlockNum      big.Int        `json:"blockNum"`
}

func ParseModelMeta

func ParseModelMeta(code []byte) (*ModelMeta, error)

func (*ModelMeta) DecodeJSON

func (mm *ModelMeta) DecodeJSON(s string) error

func (*ModelMeta) DecodeRLP

func (mm *ModelMeta) DecodeRLP(code []byte) error

func (*ModelMeta) EncodeJSON

func (mm *ModelMeta) EncodeJSON() (string, error)

func (*ModelMeta) EncodeRLP

func (obj *ModelMeta) EncodeRLP(_w io.Writer) error

func (*ModelMeta) InfoHash

func (mm *ModelMeta) InfoHash() (ih string)

func (ModelMeta) MarshalJSON

func (m ModelMeta) MarshalJSON() ([]byte, error)

MarshalJSON marshals as JSON.

func (*ModelMeta) SetBlockNum

func (mm *ModelMeta) SetBlockNum(num big.Int) error

func (*ModelMeta) SetGas

func (mm *ModelMeta) SetGas(gas uint64) error

func (*ModelMeta) ToBytes

func (mm *ModelMeta) ToBytes() ([]byte, error)

func (*ModelMeta) UnmarshalJSON

func (m *ModelMeta) UnmarshalJSON(input []byte) error

UnmarshalJSON unmarshals from JSON.

type Receipt

type Receipt struct {
	// Contract Address
	ContractAddr *common.Address `json:"contractAddress"`
	// Transaction Hash
	//TxHash *common.Hash `json:"transactionHash"  gencodec:"required"`
	//Receipt   *TxReceipt      `json:"receipt"  rlp:"nil"`
	GasUsed uint64 `json:"gasUsed" gencodec:"required"`
	Status  uint64 `json:"status"`
}

func (*Receipt) EncodeRLP

func (obj *Receipt) EncodeRLP(_w io.Writer) error

func (Receipt) MarshalJSON

func (r Receipt) MarshalJSON() ([]byte, error)

MarshalJSON marshals as JSON.

func (*Receipt) UnmarshalJSON

func (r *Receipt) UnmarshalJSON(input []byte) error

UnmarshalJSON unmarshals from JSON.

type Transaction

type Transaction struct {
	//Price     *big.Int        `json:"gasPrice" gencodec:"required"`
	Amount   *big.Int `json:"value"    gencodec:"required"`
	GasLimit uint64   `json:"gas"      gencodec:"required"`
	Payload  []byte   `json:"input"    gencodec:"required"`
	//From      *common.Address `json:"from"     gencodec:"required"`
	Recipient *common.Address `json:"to"       rlp:"nil"` // nil means contract creation
	Hash      *common.Hash    `json:"hash"     gencodec:"required"`
}

func (*Transaction) Data

func (t *Transaction) Data() []byte

Data ...

func (*Transaction) EncodeRLP

func (obj *Transaction) EncodeRLP(_w io.Writer) error

func (*Transaction) IsFlowControl

func (t *Transaction) IsFlowControl() bool

IsFlowControl ...

func (Transaction) MarshalJSON

func (t Transaction) MarshalJSON() ([]byte, error)

MarshalJSON marshals as JSON.

func (*Transaction) Op

func (t *Transaction) Op() (op int)

Op ...

func (*Transaction) Parse

func (t *Transaction) Parse() *FileMeta

func (*Transaction) UnmarshalJSON

func (t *Transaction) UnmarshalJSON(input []byte) error

UnmarshalJSON unmarshals from JSON.

Jump to

Keyboard shortcuts

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