Documentation ¶
Index ¶
- type ChainType
- type GetIntermediateFunc
- type Receipt
- func (r *Receipt) Build(getIntermediate GetIntermediateFunc, anchorState *State) error
- func (r *Receipt) Combine(rm *Receipt) (*Receipt, error)
- func (r *Receipt) Contains(other *Receipt) bool
- func (v *Receipt) Copy() *Receipt
- func (v *Receipt) CopyAsInterface() interface{}
- func (v *Receipt) Equal(u *Receipt) bool
- func (v *Receipt) IsValid() error
- func (v *Receipt) MarshalBinary() ([]byte, error)
- func (v *Receipt) MarshalJSON() ([]byte, error)
- func (v *Receipt) UnmarshalBinary(data []byte) error
- func (v *Receipt) UnmarshalBinaryFrom(rd io.Reader) error
- func (v *Receipt) UnmarshalJSON(data []byte) error
- func (r *Receipt) Validate() bool
- type ReceiptEntry
- func (v *ReceiptEntry) Copy() *ReceiptEntry
- func (v *ReceiptEntry) CopyAsInterface() interface{}
- func (v *ReceiptEntry) Equal(u *ReceiptEntry) bool
- func (v *ReceiptEntry) IsValid() error
- func (v *ReceiptEntry) MarshalBinary() ([]byte, error)
- func (v *ReceiptEntry) MarshalJSON() ([]byte, error)
- func (v *ReceiptEntry) UnmarshalBinary(data []byte) error
- func (v *ReceiptEntry) UnmarshalBinaryFrom(rd io.Reader) error
- func (v *ReceiptEntry) UnmarshalJSON(data []byte) error
- type State
- func (m *State) Add(hash_ []byte)
- func (m *State) Anchor() (anchor []byte)
- func (v *State) Copy() *State
- func (v *State) CopyAsInterface() interface{}
- func (m *State) Equal(m2 *State) (isEqual bool)
- func (m *State) Marshal() (MSBytes []byte, err error)
- func (m *State) MarshalBinary() ([]byte, error)
- func (v *State) MarshalJSON() ([]byte, error)
- func (m *State) Pad()
- func (m *State) Trim()
- func (m *State) UnMarshal(MSBytes []byte) (err error)
- func (m *State) UnmarshalBinary(data []byte) error
- func (m *State) UnmarshalBinaryFrom(rd io.Reader) error
- func (v *State) UnmarshalJSON(data []byte) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ChainType ¶
type ChainType uint64
ChainType is the type of a chain belonging to an account.
const ChainTypeAnchor ChainType = 2
ChainTypeAnchor holds chain anchors.
const ChainTypeIndex ChainType = 4
ChainTypeIndex indexes other chains.
const ChainTypeTransaction ChainType = 1
ChainTypeTransaction holds transaction hashes.
const ChainTypeUnknown ChainType = 0
ChainTypeUnknown is used when the chain type is not known.
func ChainTypeByName ¶
ChainTypeByName returns the named Chain Type.
func (ChainType) GetEnumValue ¶
GetEnumValue returns the value of the Chain Type
func (ChainType) MarshalJSON ¶
MarshalJSON marshals the Chain Type to JSON as a string.
func (*ChainType) SetEnumValue ¶
SetEnumValue sets the value. SetEnumValue returns false if the value is invalid.
func (*ChainType) UnmarshalJSON ¶
UnmarshalJSON unmarshals the Chain Type from JSON as a string.
type GetIntermediateFunc ¶
type Receipt ¶
type Receipt struct { // Start is the entry for which we want a proof. Start []byte `json:"start,omitempty" form:"start" query:"start" validate:"required"` StartIndex int64 `json:"startIndex,omitempty" form:"startIndex" query:"startIndex" validate:"required"` // End is the entry at the index where the anchor was created. End []byte `json:"end,omitempty" form:"end" query:"end" validate:"required"` EndIndex int64 `json:"endIndex,omitempty" form:"endIndex" query:"endIndex" validate:"required"` // Anchor is the root expected once all nodes are applied. Anchor []byte `json:"anchor,omitempty" form:"anchor" query:"anchor" validate:"required"` // Entries is the list of hashes to apply to create an anchor. Entries []*ReceiptEntry `json:"entries,omitempty" form:"entries" query:"entries" validate:"required"` // contains filtered or unexported fields }
func CombineReceipts ¶
CombineReceipts combines multiple receipts.
func (*Receipt) Build ¶
func (r *Receipt) Build(getIntermediate GetIntermediateFunc, anchorState *State) error
BuildReceipt takes the values collected by GetReceipt and flushes out the data structures in the receipt to represent a fully populated version.
func (*Receipt) Combine ¶
Combine Take a 2nd receipt, attach it to a root receipt, and return the resulting receipt. The idea is that if this receipt is anchored into another chain, Then we can create a receipt that proves the element in this receipt all the way down to an anchor in the root receipt. Note that both this receipt and the root receipt are expected to be good.
func (*Receipt) Contains ¶
Contains returns true if the 2nd receipt is equal to or contained within the first.
func (*Receipt) CopyAsInterface ¶
func (v *Receipt) CopyAsInterface() interface{}
func (*Receipt) MarshalBinary ¶
func (*Receipt) MarshalJSON ¶
func (*Receipt) UnmarshalBinary ¶
func (*Receipt) UnmarshalJSON ¶
type ReceiptEntry ¶
type ReceiptEntry struct { Right bool `json:"right,omitempty" form:"right" query:"right" validate:"required"` Hash []byte `json:"hash,omitempty" form:"hash" query:"hash" validate:"required"` // contains filtered or unexported fields }
func (*ReceiptEntry) Copy ¶
func (v *ReceiptEntry) Copy() *ReceiptEntry
func (*ReceiptEntry) CopyAsInterface ¶
func (v *ReceiptEntry) CopyAsInterface() interface{}
func (*ReceiptEntry) Equal ¶
func (v *ReceiptEntry) Equal(u *ReceiptEntry) bool
func (*ReceiptEntry) IsValid ¶
func (v *ReceiptEntry) IsValid() error
func (*ReceiptEntry) MarshalBinary ¶
func (v *ReceiptEntry) MarshalBinary() ([]byte, error)
func (*ReceiptEntry) MarshalJSON ¶
func (v *ReceiptEntry) MarshalJSON() ([]byte, error)
func (*ReceiptEntry) UnmarshalBinary ¶
func (v *ReceiptEntry) UnmarshalBinary(data []byte) error
func (*ReceiptEntry) UnmarshalBinaryFrom ¶
func (v *ReceiptEntry) UnmarshalBinaryFrom(rd io.Reader) error
func (*ReceiptEntry) UnmarshalJSON ¶
func (v *ReceiptEntry) UnmarshalJSON(data []byte) error
type State ¶
type State struct { // Count is the count of hashes added to the tree. Count int64 `json:"count,omitempty" form:"count" query:"count" validate:"required"` // Pending is the hashes that represent the left edge of the tree. Pending [][]byte `json:"pending,omitempty" form:"pending" query:"pending" validate:"required"` // HashList is the hashes added to the tree. HashList [][]byte `json:"hashList,omitempty" form:"hashList" query:"hashList" validate:"required"` }
func (*State) Anchor ¶
Anchor Compute the Merkle Directed Acyclic Graph (Merkle DAG or ChainHead) for the ChainHead at this point We take any trailing hashes in ChainHead, hash them up and combine to create the Merkle Dag Root. Getting the closing ListMDRoot is non-destructive, which is useful for some use cases.
Returns a nil if the MerkleSate is empty.
func (*State) CopyAsInterface ¶
func (v *State) CopyAsInterface() interface{}
func (*State) Equal ¶
Equal Compares one MerkleState to another, and returns true if they are the same
func (*State) MarshalBinary ¶
func (*State) MarshalJSON ¶
func (*State) Pad ¶
func (m *State) Pad()
Pad Add a nil to the end of the Pending list if one isn't there. We need to be able to add an element to Pending if needed while building receipts
func (*State) UnMarshal ¶
UnMarshal Take the state of an MSMarshal instance defined by MSBytes, and set all the values in this instance of MSMarshal to the state defined by MSBytes. It is assumed that the hash function has been set by the caller.