Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Engine ¶
type Engine interface {
core.Engine
// Initialize this engine.
Initialize(ctx context.Context, params Parameters) error
// GetVertex retrieves a vertex by its ID.
GetVertex(vtxID ids.ID) (Vertex, error)
// GetVtx retrieves a vertex by its ID.
GetVtx(vtxID ids.ID) (Vertex, error)
// Issued returns true if the vertex has been issued.
Issued(vtx Vertex) bool
// StopVertexAccepted returns true if all new vertices should be rejected.
StopVertexAccepted() bool
}
Engine is a DAG consensus engine.
type Manager ¶
type Manager interface {
Storage
// Add a vertex to the DAG.
Add(vtx Vertex) error
// Remove a vertex from the DAG.
Remove(vtxID ids.ID) error
// GetAncestors returns the ancestors of a vertex.
GetAncestors(vtxID ids.ID) ([]ids.ID, error)
// GetDescendants returns the descendants of a vertex.
GetDescendants(vtxID ids.ID) ([]ids.ID, error)
}
Manager manages vertices in the DAG.
type Parameters ¶
type Parameters struct {
// Parents is the number of parents a vertex should have.
Parents int
// BatchSize is the number of vertices to batch together.
BatchSize int
// The consensus parameters.
ConsensusParams interface{}
}
Parameters defines the parameters for the DAG consensus engine.
type Storage ¶
type Storage interface {
// Get a vertex by its ID.
GetVertex(vtxID ids.ID) (Vertex, error)
// Put a vertex into storage.
PutVertex(vtx Vertex) error
// HasVertex returns true if the vertex exists in storage.
HasVertex(vtxID ids.ID) bool
// Edge returns the edge from source to destination.
Edge(src, dst ids.ID) bool
// SetEdge sets an edge from source to destination.
SetEdge(src, dst ids.ID) error
}
Storage defines the storage interface for the DAG engine.
type Vertex ¶
type Vertex interface {
choices.Decidable
// Vertex returns the unique ID of this vertex.
Vertex() ids.ID
// Parents returns the parents of this vertex.
Parents() []ids.ID
// Height returns the height of this vertex.
Height() uint64
// Epoch returns the epoch of this vertex.
Epoch() uint32
// Verify that this vertex is valid.
Verify(context.Context) error
// Bytes returns the byte representation of this vertex.
Bytes() []byte
}
Vertex is a vertex in the DAG.
Click to show internal directories.
Click to hide internal directories.