Documentation ¶
Index ¶
- Variables
- func WithForkDetectionMinimumDepth(depth int64) options.Option[Manager]
- type Chain
- type ChainID
- type Commitment
- func (c *Commitment) Chain() (chain *Chain)
- func (c *Commitment) Children() []*Commitment
- func (c *Commitment) Commitment() (commitment *commitment.Commitment)
- func (c *Commitment) FromObjectStorage(key, data []byte) (err error)
- func (c *Commitment) IsSolid() (isSolid bool)
- func (c *Commitment) ObjectStorageKey() (key []byte)
- func (c *Commitment) PublishCommitment(commitment *commitment.Commitment) (published bool)
- func (c *Commitment) PublishRoots(roots *commitment.Roots) (published bool)
- func (c *Commitment) SetSolid(solid bool) (updated bool)
- type Events
- type Fork
- type Manager
- func (m *Manager) Chain(ec commitment.ID) (chain *Chain)
- func (m *Manager) Commitments(id commitment.ID, amount int) (commitments []*Commitment, err error)
- func (m *Manager) EvictUntil(index slot.Index)
- func (m *Manager) ForkByForkingPoint(forkingPoint commitment.ID) (fork *Fork, exists bool)
- func (m *Manager) Initialize(c *commitment.Commitment)
- func (m *Manager) ProcessCandidateCommitment(commitment *commitment.Commitment) (isSolid bool, chain *Chain)
- func (m *Manager) ProcessCommitment(commitment *commitment.Commitment) (isSolid bool, chain *Chain)
- func (m *Manager) ProcessCommitmentFromSource(commitment *commitment.Commitment, source identity.ID) (isSolid bool, chain *Chain)
- func (m *Manager) RootCommitment() (rootCommitment *Commitment)
- func (m *Manager) SetRootCommitment(commitment *commitment.Commitment)
- func (m *Manager) SwitchMainChain(head commitment.ID) error
- type TestFramework
- func (t *TestFramework) AssertChainIsAlias(chain *Chain, alias string)
- func (t *TestFramework) AssertChainState(chains map[string]string)
- func (t *TestFramework) AssertCommitmentBelowRootCount(expected int)
- func (t *TestFramework) AssertCommitmentMissingCount(expected int)
- func (t *TestFramework) AssertEqualChainCommitments(commitments []*Commitment, aliases ...string)
- func (t *TestFramework) AssertForkDetectedCount(expected int)
- func (t *TestFramework) AssertMissingCommitmentReceivedCount(expected int)
- func (t *TestFramework) Chain(alias string) (chain *Chain)
- func (t *TestFramework) ChainCommitment(alias string) *Commitment
- func (t *TestFramework) CreateCommitment(alias string, prevAlias string)
- func (t *TestFramework) PrevSlotCommitment(alias string) commitment.ID
- func (t *TestFramework) ProcessCommitment(alias string) (isSolid bool, chain *Chain)
- func (t *TestFramework) ProcessCommitmentFromOtherSource(alias string) (isSolid bool, chain *Chain)
- func (t *TestFramework) SlotCommitment(alias string) commitment.ID
- func (t *TestFramework) SlotCommitmentRoot(alias string) types.Identifier
- func (t *TestFramework) SlotIndex(alias string) slot.Index
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrCommitmentUnknown = errors.New("unknown commitment") ErrCommitmentNotSolid = errors.New("commitment not solid") )
View Source
var NewEvents = event.CreateGroupConstructor(func() *Events { return &Events{ CommitmentMissing: event.New1[commitment.ID](), MissingCommitmentReceived: event.New1[commitment.ID](), CommitmentBelowRoot: event.New1[commitment.ID](), ForkDetected: event.New1[*Fork](), } })
Functions ¶
Types ¶
type Chain ¶
type Chain struct { ForkingPoint *Commitment syncutils.RWMutexFake // contains filtered or unexported fields }
func NewChain ¶
func NewChain(forkingPoint *Commitment) (fork *Chain)
func (*Chain) Commitment ¶
func (c *Chain) Commitment(index slot.Index) (commitment *Commitment)
func (*Chain) LatestCommitment ¶
func (c *Chain) LatestCommitment() *Commitment
type ChainID ¶
type ChainID = commitment.ID
type Commitment ¶
type Commitment struct { model.Storable[commitment.ID, Commitment, *Commitment, commitmentModel] `serix:"0"` // contains filtered or unexported fields }
func NewCommitment ¶
func NewCommitment(id commitment.ID) (newCommitment *Commitment)
func (*Commitment) Chain ¶
func (c *Commitment) Chain() (chain *Chain)
func (*Commitment) Children ¶
func (c *Commitment) Children() []*Commitment
func (*Commitment) Commitment ¶
func (c *Commitment) Commitment() (commitment *commitment.Commitment)
func (*Commitment) FromObjectStorage ¶
func (c *Commitment) FromObjectStorage(key, data []byte) (err error)
FromObjectStorage deserializes a model from the object storage. TODO: this is just a temporary fix
func (*Commitment) IsSolid ¶
func (c *Commitment) IsSolid() (isSolid bool)
func (*Commitment) ObjectStorageKey ¶
func (c *Commitment) ObjectStorageKey() (key []byte)
ObjectStorageKey returns the bytes, that are used as a key to store the object in the k/v store. TODO: this is just a temporary fix
func (*Commitment) PublishCommitment ¶
func (c *Commitment) PublishCommitment(commitment *commitment.Commitment) (published bool)
func (*Commitment) PublishRoots ¶
func (c *Commitment) PublishRoots(roots *commitment.Roots) (published bool)
func (*Commitment) SetSolid ¶
func (c *Commitment) SetSolid(solid bool) (updated bool)
type Fork ¶
type Fork struct { Source identity.ID Commitment *commitment.Commitment ForkingPoint *commitment.Commitment }
type Manager ¶
type Manager struct { Events *Events CommitmentRequester *eventticker.EventTicker[commitment.ID] // contains filtered or unexported fields }
func (*Manager) Commitments ¶
func (m *Manager) Commitments(id commitment.ID, amount int) (commitments []*Commitment, err error)
func (*Manager) EvictUntil ¶
func (*Manager) ForkByForkingPoint ¶
func (m *Manager) ForkByForkingPoint(forkingPoint commitment.ID) (fork *Fork, exists bool)
ForkByForkingPoint returns the fork generated by a peer for the given forking point.
func (*Manager) Initialize ¶
func (m *Manager) Initialize(c *commitment.Commitment)
func (*Manager) ProcessCandidateCommitment ¶
func (m *Manager) ProcessCandidateCommitment(commitment *commitment.Commitment) (isSolid bool, chain *Chain)
func (*Manager) ProcessCommitment ¶
func (m *Manager) ProcessCommitment(commitment *commitment.Commitment) (isSolid bool, chain *Chain)
func (*Manager) ProcessCommitmentFromSource ¶
func (m *Manager) ProcessCommitmentFromSource(commitment *commitment.Commitment, source identity.ID) (isSolid bool, chain *Chain)
func (*Manager) RootCommitment ¶
func (m *Manager) RootCommitment() (rootCommitment *Commitment)
RootCommitment returns the root commitment of the manager.
func (*Manager) SetRootCommitment ¶
func (m *Manager) SetRootCommitment(commitment *commitment.Commitment)
SetRootCommitment sets the root commitment of the manager.
func (*Manager) SwitchMainChain ¶
func (m *Manager) SwitchMainChain(head commitment.ID) error
type TestFramework ¶
type TestFramework struct { Instance *Manager syncutils.RWMutexFake // contains filtered or unexported fields }
func NewTestFramework ¶
func NewTestFramework(test *testing.T, opts ...options.Option[TestFramework]) (testFramework *TestFramework)
func (*TestFramework) AssertChainIsAlias ¶
func (t *TestFramework) AssertChainIsAlias(chain *Chain, alias string)
func (*TestFramework) AssertChainState ¶
func (t *TestFramework) AssertChainState(chains map[string]string)
func (*TestFramework) AssertCommitmentBelowRootCount ¶
func (t *TestFramework) AssertCommitmentBelowRootCount(expected int)
func (*TestFramework) AssertCommitmentMissingCount ¶
func (t *TestFramework) AssertCommitmentMissingCount(expected int)
func (*TestFramework) AssertEqualChainCommitments ¶
func (t *TestFramework) AssertEqualChainCommitments(commitments []*Commitment, aliases ...string)
func (*TestFramework) AssertForkDetectedCount ¶
func (t *TestFramework) AssertForkDetectedCount(expected int)
func (*TestFramework) AssertMissingCommitmentReceivedCount ¶
func (t *TestFramework) AssertMissingCommitmentReceivedCount(expected int)
func (*TestFramework) Chain ¶
func (t *TestFramework) Chain(alias string) (chain *Chain)
func (*TestFramework) ChainCommitment ¶
func (t *TestFramework) ChainCommitment(alias string) *Commitment
func (*TestFramework) CreateCommitment ¶
func (t *TestFramework) CreateCommitment(alias string, prevAlias string)
func (*TestFramework) PrevSlotCommitment ¶
func (t *TestFramework) PrevSlotCommitment(alias string) commitment.ID
func (*TestFramework) ProcessCommitment ¶
func (t *TestFramework) ProcessCommitment(alias string) (isSolid bool, chain *Chain)
func (*TestFramework) ProcessCommitmentFromOtherSource ¶
func (t *TestFramework) ProcessCommitmentFromOtherSource(alias string) (isSolid bool, chain *Chain)
func (*TestFramework) SlotCommitment ¶
func (t *TestFramework) SlotCommitment(alias string) commitment.ID
func (*TestFramework) SlotCommitmentRoot ¶
func (t *TestFramework) SlotCommitmentRoot(alias string) types.Identifier
Click to show internal directories.
Click to hide internal directories.