value

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: May 5, 2020 License: Apache-2.0 Imports: 9 Imported by: 18

Documentation

Index

Constants

View Source
const (
	TypeCodeInt       uint8 = 0
	TypeCodeCodePoint uint8 = 1
	TypeCodeHashOnly  uint8 = 2
	TypeCodeTuple     uint8 = 3
)
View Source
const BytesPerInt = 32
View Source
const MaxTupleSize = 8

Variables

This section is empty.

Functions

func Eq

func Eq(x, y Value) bool

func IsValidTupleSize

func IsValidTupleSize(size *big.Int) bool

func IsValidTupleSizeI64

func IsValidTupleSizeI64(size int64) bool

func MarshalOperation

func MarshalOperation(op Operation, wr io.Writer) error

func MarshalOperationProof

func MarshalOperationProof(op Operation, wr io.Writer, includeVal bool) error

func MarshalValue

func MarshalValue(v Value, w io.Writer) error

func MarshalValueForProof added in v0.4.0

func MarshalValueForProof(v Value, w io.Writer) error

func MarshalValueToBytes added in v0.4.0

func MarshalValueToBytes(val Value) []byte

func TypeCodeName

func TypeCodeName(code uint8) string

Types

type BasicOperation

type BasicOperation struct {
	Op Opcode
}

func NewBasicOperationFromReader

func NewBasicOperationFromReader(rd io.Reader) (BasicOperation, error)

func (BasicOperation) GetOp

func (op BasicOperation) GetOp() Opcode

func (BasicOperation) Marshal

func (op BasicOperation) Marshal(wr io.Writer) error

func (BasicOperation) MarshalProof

func (op BasicOperation) MarshalProof(wr io.Writer, includeVal bool) error

func (BasicOperation) String added in v0.4.0

func (op BasicOperation) String() string

func (BasicOperation) TypeCode

func (op BasicOperation) TypeCode() uint8

type CodePointValue

type CodePointValue struct {
	InsnNum  int64
	Op       Operation
	NextHash common.Hash
}
var ErrorCodePoint CodePointValue

func NewCodePointForProofFromReader

func NewCodePointForProofFromReader(rd io.Reader) (CodePointValue, error)

func NewCodePointValueFromReader

func NewCodePointValueFromReader(rd io.Reader) (CodePointValue, error)

func (CodePointValue) Clone

func (cv CodePointValue) Clone() Value

func (CodePointValue) CloneShallow

func (cv CodePointValue) CloneShallow() Value

func (CodePointValue) Equal

func (cv CodePointValue) Equal(val Value) bool

func (CodePointValue) Hash

func (cv CodePointValue) Hash() common.Hash

func (CodePointValue) InternalTypeCode

func (cv CodePointValue) InternalTypeCode() uint8

func (CodePointValue) Marshal

func (cv CodePointValue) Marshal(w io.Writer) error

func (CodePointValue) MarshalForProof

func (cv CodePointValue) MarshalForProof(w io.Writer) error

func (CodePointValue) Size

func (cv CodePointValue) Size() int64

func (CodePointValue) String

func (cv CodePointValue) String() string

func (CodePointValue) TypeCode

func (cv CodePointValue) TypeCode() uint8

type HashOnlyValue

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

func NewHashOnlyValue

func NewHashOnlyValue(hash common.Hash, size int64) HashOnlyValue

func NewHashOnlyValueFromReader

func NewHashOnlyValueFromReader(rd io.Reader) (HashOnlyValue, error)

func NewHashOnlyValueFromValue

func NewHashOnlyValueFromValue(val Value) HashOnlyValue

func (HashOnlyValue) Clone

func (nv HashOnlyValue) Clone() Value

func (HashOnlyValue) CloneShallow

func (nv HashOnlyValue) CloneShallow() Value

func (HashOnlyValue) Equal

func (nv HashOnlyValue) Equal(val Value) bool

func (HashOnlyValue) Hash

func (nv HashOnlyValue) Hash() common.Hash

func (HashOnlyValue) InternalTypeCode

func (nv HashOnlyValue) InternalTypeCode() byte

func (HashOnlyValue) Marshal

func (nv HashOnlyValue) Marshal(wr io.Writer) error

func (HashOnlyValue) MarshalForProof added in v0.4.0

func (tv HashOnlyValue) MarshalForProof(wr io.Writer) error

func (HashOnlyValue) Size

func (nv HashOnlyValue) Size() int64

func (HashOnlyValue) String

func (nv HashOnlyValue) String() string

func (HashOnlyValue) TypeCode

func (nv HashOnlyValue) TypeCode() byte

type ImmediateOperation

type ImmediateOperation struct {
	Op  Opcode
	Val Value
}

func NewImmediateOperationFromReader

func NewImmediateOperationFromReader(rd io.Reader) (ImmediateOperation, error)

func (ImmediateOperation) GetOp

func (op ImmediateOperation) GetOp() Opcode

func (ImmediateOperation) Marshal

func (op ImmediateOperation) Marshal(wr io.Writer) error

func (ImmediateOperation) MarshalProof

func (op ImmediateOperation) MarshalProof(wr io.Writer, includeVal bool) error

func (ImmediateOperation) String added in v0.4.0

func (op ImmediateOperation) String() string

func (ImmediateOperation) TypeCode

func (op ImmediateOperation) TypeCode() uint8

type IntValue

type IntValue struct {
	// contains filtered or unexported fields
}
var IntegerZero IntValue

func NewBooleanValue

func NewBooleanValue(val bool) IntValue

func NewInt64Value

func NewInt64Value(x int64) IntValue

func NewIntValue

func NewIntValue(x *big.Int) IntValue

func NewIntValueFromReader

func NewIntValueFromReader(rd io.Reader) (IntValue, error)

func (IntValue) BigInt

func (iv IntValue) BigInt() *big.Int

func (IntValue) Clone

func (iv IntValue) Clone() Value

func (IntValue) CloneShallow

func (iv IntValue) CloneShallow() Value

func (IntValue) Equal

func (iv IntValue) Equal(val Value) bool

func (IntValue) Hash

func (iv IntValue) Hash() common.Hash

func (IntValue) InternalTypeCode

func (iv IntValue) InternalTypeCode() uint8

func (IntValue) Marshal

func (iv IntValue) Marshal(w io.Writer) error

func (IntValue) MarshalForProof added in v0.4.0

func (tv IntValue) MarshalForProof(wr io.Writer) error

func (IntValue) Size

func (iv IntValue) Size() int64

func (IntValue) String

func (iv IntValue) String() string

func (IntValue) ToBytes

func (iv IntValue) ToBytes() [32]byte

func (IntValue) TypeCode

func (iv IntValue) TypeCode() uint8

type Opcode

type Opcode uint8

func NewOpcodeFromReader

func NewOpcodeFromReader(rd io.Reader) (Opcode, error)

func (Opcode) Marshal

func (o Opcode) Marshal(wr io.Writer) error

type Operation

type Operation interface {
	GetOp() Opcode
	TypeCode() uint8
	Marshal(wr io.Writer) error
	MarshalProof(wr io.Writer, includeVal bool) error
}

func NewOperationFromReader

func NewOperationFromReader(rd io.Reader) (Operation, error)

type TupleValue

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

func NewEmptyTuple

func NewEmptyTuple() TupleValue

func NewRepeatedTuple

func NewRepeatedTuple(value Value, size int64) (TupleValue, error)

func NewSizedTupleFromReader

func NewSizedTupleFromReader(rd io.Reader, size byte) (TupleValue, error)

func NewTuple2

func NewTuple2(value1 Value, value2 Value) TupleValue

func NewTupleFromSlice

func NewTupleFromSlice(slice []Value) (TupleValue, error)

func NewTupleOfSizeWithContents

func NewTupleOfSizeWithContents(contents [MaxTupleSize]Value, size int8) (TupleValue, error)

func (TupleValue) Clone

func (tv TupleValue) Clone() Value

func (TupleValue) CloneShallow

func (tv TupleValue) CloneShallow() Value

func (TupleValue) Contents

func (tv TupleValue) Contents() []Value

func (TupleValue) Equal

func (tv TupleValue) Equal(val Value) bool

func (TupleValue) Get

func (tv TupleValue) Get(idx IntValue) (Value, error)

func (TupleValue) GetByInt64

func (tv TupleValue) GetByInt64(idx int64) (Value, error)

func (TupleValue) Hash

func (tv TupleValue) Hash() common.Hash

func (TupleValue) InternalTypeCode

func (tv TupleValue) InternalTypeCode() uint8

func (TupleValue) IsValidIndex

func (tv TupleValue) IsValidIndex(idx IntValue) bool

func (TupleValue) Len

func (tv TupleValue) Len() int64

func (TupleValue) Marshal

func (tv TupleValue) Marshal(wr io.Writer) error

func (TupleValue) MarshalForProof added in v0.4.0

func (tv TupleValue) MarshalForProof(wr io.Writer) error

func (TupleValue) Set

func (tv TupleValue) Set(idx IntValue, val Value) (TupleValue, error)

func (TupleValue) SetByInt64

func (tv TupleValue) SetByInt64(idx int64, val Value) (TupleValue, error)

func (TupleValue) Size

func (tv TupleValue) Size() int64

func (TupleValue) String

func (tv TupleValue) String() string

func (TupleValue) TypeCode

func (tv TupleValue) TypeCode() uint8

type UnmarshalError

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

func (UnmarshalError) Error

func (e UnmarshalError) Error() string

type Value

type Value interface {
	TypeCode() uint8
	InternalTypeCode() uint8
	Clone() Value
	CloneShallow() Value
	Equal(Value) bool
	Hash() common.Hash
	Size() int64
	Marshal(io.Writer) error
	MarshalForProof(io.Writer) error
}

func UnmarshalValue

func UnmarshalValue(r io.Reader) (Value, error)

func UnmarshalValueFromBytes added in v0.4.0

func UnmarshalValueFromBytes(val []byte) (Value, error)

func UnmarshalValueWithType

func UnmarshalValueWithType(tipe byte, r io.Reader) (Value, error)

Jump to

Keyboard shortcuts

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