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 ¶
- Variables
- type BitsFlow
- type Block
- type FileInfo
- type FileMeta
- type InferMeta
- type InputMeta
- func (im *InputMeta) DecodeJSON(s string) error
- func (im *InputMeta) DecodeRLP(code []byte) error
- func (im *InputMeta) EncodeJSON() (string, error)
- func (obj *InputMeta) EncodeRLP(_w io.Writer) error
- func (mm *InputMeta) InfoHash() (ih string)
- func (i InputMeta) MarshalJSON() ([]byte, error)
- func (im *InputMeta) SetBlockNum(num big.Int) error
- func (im *InputMeta) ToBytes() ([]byte, error)
- func (i *InputMeta) UnmarshalJSON(input []byte) error
- type Meta
- type ModelMeta
- func (mm *ModelMeta) DecodeJSON(s string) error
- func (mm *ModelMeta) DecodeRLP(code []byte) error
- func (mm *ModelMeta) EncodeJSON() (string, error)
- func (obj *ModelMeta) EncodeRLP(_w io.Writer) error
- func (mm *ModelMeta) InfoHash() (ih string)
- func (m ModelMeta) MarshalJSON() ([]byte, error)
- func (mm *ModelMeta) SetBlockNum(num big.Int) error
- func (mm *ModelMeta) SetGas(gas uint64) error
- func (mm *ModelMeta) ToBytes() ([]byte, error)
- func (m *ModelMeta) UnmarshalJSON(input []byte) error
- type Receipt
- type Transaction
- func (t *Transaction) Data() []byte
- func (obj *Transaction) EncodeRLP(_w io.Writer) error
- func (t *Transaction) IsFlowControl() bool
- func (t Transaction) MarshalJSON() ([]byte, error)
- func (t *Transaction) Op() (op int)
- func (t *Transaction) Parse() *FileMeta
- func (t *Transaction) UnmarshalJSON(input []byte) error
Constants ¶
This section is empty.
Variables ¶
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 ¶
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) MarshalJSON ¶
MarshalJSON marshals as JSON.
func (*Block) UnmarshalJSON ¶
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) MarshalJSON ¶
MarshalJSON marshals as JSON.
func (*FileInfo) UnmarshalJSON ¶
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) MarshalJSON ¶
MarshalJSON marshals as JSON.
func (*FileMeta) UnmarshalJSON ¶
UnmarshalJSON unmarshals from JSON.
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 (*InputMeta) DecodeJSON ¶
func (*InputMeta) EncodeJSON ¶
func (InputMeta) MarshalJSON ¶
MarshalJSON marshals as JSON.
func (*InputMeta) UnmarshalJSON ¶
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 (*Meta) UnmarshalJSON ¶
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 (*ModelMeta) DecodeJSON ¶
func (*ModelMeta) EncodeJSON ¶
func (ModelMeta) MarshalJSON ¶
MarshalJSON marshals as JSON.
func (*ModelMeta) UnmarshalJSON ¶
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) MarshalJSON ¶
MarshalJSON marshals as JSON.
func (*Receipt) UnmarshalJSON ¶
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) MarshalJSON ¶
func (t Transaction) MarshalJSON() ([]byte, error)
MarshalJSON marshals as JSON.
func (*Transaction) Parse ¶
func (t *Transaction) Parse() *FileMeta
func (*Transaction) UnmarshalJSON ¶
func (t *Transaction) UnmarshalJSON(input []byte) error
UnmarshalJSON unmarshals from JSON.
Source Files ¶
- common.go
- gen_block_json.go
- gen_block_rlp.go
- gen_fileinfo_json.go
- gen_fileinfo_rlp.go
- gen_filemeta_json.go
- gen_filemeta_rlp.go
- gen_input_json.go
- gen_input_rlp.go
- gen_meta_json.go
- gen_meta_rlp.go
- gen_model_json.go
- gen_model_rlp.go
- gen_receipt_json.go
- gen_receipt_rlp.go
- gen_tx_json.go
- gen_tx_rlp.go
- infer_meta.go