Documentation ¶
Index ¶
- type Conflicts
- type Consensus
- type Directed
- func (m *Directed) Accepted(id ids.ID)
- func (dg *Directed) Add(tx choices.Decidable) error
- func (dg *Directed) Conflicts(tx choices.Decidable) (ids.Set, error)
- func (dg *Directed) Finalized() bool
- func (dg *Directed) Initialize(ctx *snow.Context, conflicts Conflicts, params sbcon.Parameters) error
- func (dg *Directed) IsVirtuous(tx choices.Decidable) (bool, error)
- func (dg *Directed) Issued(tx choices.Decidable) bool
- func (dg *Directed) Parameters() sbcon.Parameters
- func (dg *Directed) Preferences() ids.Set
- func (dg *Directed) Quiesce() bool
- func (dg *Directed) RecordPoll(votes ids.Bag) (bool, error)
- func (m *Directed) Rejected(id ids.ID)
- func (dg *Directed) String() string
- func (dg *Directed) Virtuous() ids.Set
- type DirectedFactory
- type Factory
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Conflicts ¶
type Conflicts interface { // Add this transaction to conflict tracking Add(tx choices.Decidable) error // Conflicts returns true if there are no transactions currently tracked IsVirtuous(tx choices.Decidable) (bool, error) // Conflicts returns the transactions that conflict with the provided // transaction Conflicts(tx choices.Decidable) ([]choices.Decidable, error) // Mark this transaction as conditionally accepted Accept(txID ids.ID) // Updateable returns the transactions that can be accepted and rejected. // Assumes that returned transactions are accepted or rejected before the // next time this function is called. Acceptable transactions must have been // identified as having been confitionally accepted. If an acceptable // transaction was marked as having a conflict, then that conflict should be // returned in the same call as the acceptable transaction was returned or // in a prior call. Updateable() (acceptable []choices.Decidable, rejectable []choices.Decidable) }
type Consensus ¶
type Consensus interface { fmt.Stringer // Takes in the context, alpha, betaVirtuous, and betaRogue Initialize(*snow.Context, Conflicts, sbcon.Parameters) error // Returns the parameters that describe this snowstorm instance Parameters() sbcon.Parameters // Returns the set of virtuous transactions // that have not yet been accepted or rejected Virtuous() ids.Set // Returns the currently preferred transactions to be finalized Preferences() ids.Set // Returns true iff all remaining transactions are rogue. Note, it is // possible that after returning quiesce, a new decision may be added such // that this instance should no longer quiesce. Quiesce() bool // Returns true iff all added transactions have been finalized. Note, it is // possible that after returning finalized, a new decision may be added such // that this instance is no longer finalized. Finalized() bool // Returns true if transaction <Tx> is virtuous. // That is, no transaction has been added that conflicts with <Tx> IsVirtuous(choices.Decidable) (bool, error) // Returns the set of transactions conflicting with <Tx> Conflicts(choices.Decidable) (ids.Set, error) // Returns true iff transaction <Tx> has been added Issued(choices.Decidable) bool // Adds a new transaction to vote on. Returns if a critical error has // occurred. Add(choices.Decidable) error // Collects the results of a network poll. Assumes all transactions // have been previously added. Returns true is any statuses or preferences // changed. Returns if a critical error has occurred. RecordPoll(ids.Bag) (bool, error) }
Consensus is a snowball instance deciding between an unbounded number of non-transitive conflicts. After performing a network sample of k nodes, you should call collect with the responses.
type Directed ¶
type Directed struct {
// contains filtered or unexported fields
}
Directed is an implementation of a multi-color, non-transitive, snowball instance
func (*Directed) Accepted ¶
Accepted marks that a transaction with the provided ID was accepted. It is assumed that Issued was previously called with this ID.
func (*Directed) Initialize ¶
func (dg *Directed) Initialize( ctx *snow.Context, conflicts Conflicts, params sbcon.Parameters, ) error
Initialize implements the Consensus interface
func (*Directed) IsVirtuous ¶
IsVirtuous implements the Consensus interface
func (*Directed) Parameters ¶
func (dg *Directed) Parameters() sbcon.Parameters
Parameters implements the Snowstorm interface
func (*Directed) Preferences ¶
Preferences implements the ConflictGraph interface
func (*Directed) RecordPoll ¶
RecordPoll implements the Consensus interface
type DirectedFactory ¶
type DirectedFactory struct{}
DirectedFactory implements Factory by returning a directed struct