Documentation ¶
Index ¶
- Constants
- Variables
- type Conflict
- type Conflicts
- type Entry
- type Opinion
- type Opinions
- type Registry
- type Statement
- type Timestamp
- type Timestamps
- type View
- func (v *View) AddConflict(c Conflict)
- func (v *View) AddConflicts(conflicts Conflicts)
- func (v *View) AddTimestamp(t Timestamp)
- func (v *View) AddTimestamps(timestamps Timestamps)
- func (v *View) ConflictOpinion(id ledgerstate.TransactionID) Opinions
- func (v *View) ID() identity.ID
- func (v *View) Query(ctx context.Context, conflictIDs []string, timestampIDs []string) (opinion.Opinions, error)
- func (v *View) TimestampOpinion(id tangle.MessageID) Opinions
- func (v *View) UpdateLastStatementReceivedTime(statementReceivingTime time.Time)
Constants ¶
const ( // ConflictLength defines the Conflict length in bytes. ConflictLength = ledgerstate.TransactionIDLength + OpinionLength )
const (
// ObjectName defines the name of the Statement object.
ObjectName = "Statement"
)
const (
// OpinionLength defines the opinion length in bytes.
OpinionLength = 2
)
const ( // TimestampLength defines the Timestamp length in bytes. TimestampLength = tangle.MessageIDLength + OpinionLength )
Variables ¶
var StatementType payload.Type
StatementType represents the payload Type of a Statement.
Functions ¶
This section is empty.
Types ¶
type Conflict ¶
type Conflict struct { ID ledgerstate.TransactionID Opinion }
Conflict holds the conflicting transaction ID and its opinion.
func ConflictFromBytes ¶
ConflictFromBytes parses a conflict statement from a byte slice.
func ConflictFromMarshalUtil ¶
func ConflictFromMarshalUtil(marshalUtil *marshalutil.MarshalUtil) (conflict Conflict, err error)
ConflictFromMarshalUtil is a wrapper for simplified unmarshaling in a byte stream using the marshalUtil package.
type Conflicts ¶
type Conflicts []Conflict
Conflicts is a slice of Conflict.
func ConflictsFromBytes ¶
ConflictsFromBytes parses a slice of conflict statements from a byte slice.
func ConflictsFromMarshalUtil ¶
func ConflictsFromMarshalUtil(marshalUtil *marshalutil.MarshalUtil, n uint32) (conflicts Conflicts, err error)
ConflictsFromMarshalUtil is a wrapper for simplified unmarshaling in a byte stream using the marshalUtil package.
type Opinion ¶
Opinion holds the opinion at a specific round.
func OpinionFromBytes ¶
OpinionFromBytes parses an opinion from a byte slice.
func OpinionFromMarshalUtil ¶
func OpinionFromMarshalUtil(marshalUtil *marshalutil.MarshalUtil) (result Opinion, err error)
OpinionFromMarshalUtil is a wrapper for simplified unmarshaling in a byte stream using the marshalUtil package.
type Opinions ¶
type Opinions []Opinion
Opinions is a slice of Opinion.
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry holds the opinions of all the nodes.
type Statement ¶
type Statement struct { ConflictsCount uint32 Conflicts Conflicts TimestampsCount uint32 Timestamps Timestamps // contains filtered or unexported fields }
Statement defines a Statement payload.
func New ¶
func New(conflicts Conflicts, timestamps Timestamps) *Statement
New creates a new Statement payload.
func Parse ¶
func Parse(marshalUtil *marshalutil.MarshalUtil) (statement *Statement, err error)
Parse unmarshals a statement using the given marshalUtil (for easier marshaling/unmarshaling).
type Timestamp ¶
Timestamp holds the message ID and its timestamp opinion.
func TimestampFromBytes ¶
TimestampFromBytes parses a conflict statement from a byte slice.
func TimestampFromMarshalUtil ¶
func TimestampFromMarshalUtil(marshalUtil *marshalutil.MarshalUtil) (timestamp Timestamp, err error)
TimestampFromMarshalUtil is a wrapper for simplified unmarshaling in a byte stream using the marshalUtil package.
type Timestamps ¶
type Timestamps []Timestamp
Timestamps is a slice of Timestamp.
func TimestampsFromBytes ¶
func TimestampsFromBytes(bytes []byte, n uint32) (timestamps Timestamps, consumedBytes int, err error)
TimestampsFromBytes parses a slice of timestamp statements from a byte slice.
func TimestampsFromMarshalUtil ¶
func TimestampsFromMarshalUtil(marshalUtil *marshalutil.MarshalUtil, n uint32) (timestamps Timestamps, err error)
TimestampsFromMarshalUtil is a wrapper for simplified unmarshaling in a byte stream using the marshalUtil package.
func (Timestamps) Bytes ¶
func (t Timestamps) Bytes() (bytes []byte)
Bytes returns the timestamps statements encoded as bytes.
func (Timestamps) String ¶
func (t Timestamps) String() string
String returns a human readable version of the Timestamps.
type View ¶
type View struct { NodeID identity.ID Conflicts map[ledgerstate.TransactionID]Entry Timestamps map[tangle.MessageID]Entry LastStatementReceivedTimestamp time.Time // contains filtered or unexported fields }
View holds the node's opinion about conflicts and timestamps.
func (*View) AddConflict ¶
AddConflict appends the given conflict to the given view.
func (*View) AddConflicts ¶
AddConflicts appends the given conflicts to the given view.
func (*View) AddTimestamp ¶
AddTimestamp appends the given timestamp to the given view.
func (*View) AddTimestamps ¶
func (v *View) AddTimestamps(timestamps Timestamps)
AddTimestamps appends the given timestamps to the given view.
func (*View) ConflictOpinion ¶
func (v *View) ConflictOpinion(id ledgerstate.TransactionID) Opinions
ConflictOpinion returns the opinion history of a given transaction ID.
func (*View) Query ¶
func (v *View) Query(ctx context.Context, conflictIDs []string, timestampIDs []string) (opinion.Opinions, error)
Query retrieves the opinions about the given conflicts and timestamps.
func (*View) TimestampOpinion ¶
TimestampOpinion returns the opinion history of a given message ID.
func (*View) UpdateLastStatementReceivedTime ¶ added in v0.5.5
UpdateLastStatementReceivedTime updates last statement issuing time in node's View.