core

package
v1.0.0-alpha.9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 8, 2024 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var NewEvents = event.CreateGroupConstructor(func() (newEvents *Events) {
	return &Events{
		BlockReceived:                 event.New2[*model.Block, peer.ID](),
		BlockRequestReceived:          event.New2[iotago.BlockID, peer.ID](),
		SlotCommitmentReceived:        event.New2[*model.Commitment, peer.ID](),
		SlotCommitmentRequestReceived: event.New2[iotago.CommitmentID, peer.ID](),
		AttestationsReceived:          event.New4[*model.Commitment, []*iotago.Attestation, *merklehasher.Proof[iotago.Identifier], peer.ID](),
		AttestationsRequestReceived:   event.New2[iotago.CommitmentID, peer.ID](),
		WarpSyncRequestReceived:       event.New2[iotago.CommitmentID, peer.ID](),
		WarpSyncResponseReceived:      event.New6[iotago.CommitmentID, map[iotago.CommitmentID]iotago.BlockIDs, *merklehasher.Proof[iotago.Identifier], iotago.TransactionIDs, *merklehasher.Proof[iotago.Identifier], peer.ID](),
		Error:                         event.New2[error, peer.ID](),
	}
})

NewEvents contains the constructor of the Events object (it is generated by a generic factory).

Functions

This section is empty.

Types

type Events

type Events struct {
	BlockReceived                 *event.Event2[*model.Block, peer.ID]
	BlockRequestReceived          *event.Event2[iotago.BlockID, peer.ID]
	SlotCommitmentReceived        *event.Event2[*model.Commitment, peer.ID]
	SlotCommitmentRequestReceived *event.Event2[iotago.CommitmentID, peer.ID]
	AttestationsReceived          *event.Event4[*model.Commitment, []*iotago.Attestation, *merklehasher.Proof[iotago.Identifier], peer.ID]
	AttestationsRequestReceived   *event.Event2[iotago.CommitmentID, peer.ID]
	WarpSyncRequestReceived       *event.Event2[iotago.CommitmentID, peer.ID]
	WarpSyncResponseReceived      *event.Event6[iotago.CommitmentID, map[iotago.CommitmentID]iotago.BlockIDs, *merklehasher.Proof[iotago.Identifier], iotago.TransactionIDs, *merklehasher.Proof[iotago.Identifier], peer.ID]
	Error                         *event.Event2[error, peer.ID]

	event.Group[Events, *Events]
}

type Protocol

type Protocol struct {
	Events *Events
	// contains filtered or unexported fields
}

func NewProtocol

func NewProtocol(network network.Endpoint, workerPool *workerpool.WorkerPool, apiProvider iotago.APIProvider, opts ...options.Option[Protocol]) (protocol *Protocol)

func (*Protocol) OnAttestationsReceived

func (p *Protocol) OnAttestationsReceived(callback func(*model.Commitment, []*iotago.Attestation, *merklehasher.Proof[iotago.Identifier], peer.ID)) (unsubscribe func())

func (*Protocol) OnAttestationsRequestReceived

func (p *Protocol) OnAttestationsRequestReceived(callback func(commitmentID iotago.CommitmentID, src peer.ID)) (unsubscribe func())

func (*Protocol) OnBlockReceived

func (p *Protocol) OnBlockReceived(callback func(block *model.Block, src peer.ID)) (unsubscribe func())

func (*Protocol) OnBlockRequestReceived

func (p *Protocol) OnBlockRequestReceived(callback func(blockID iotago.BlockID, src peer.ID)) (unsubscribe func())

func (*Protocol) OnCommitmentReceived

func (p *Protocol) OnCommitmentReceived(callback func(commitment *model.Commitment, src peer.ID)) (unsubscribe func())

func (*Protocol) OnCommitmentRequestReceived

func (p *Protocol) OnCommitmentRequestReceived(callback func(commitmentID iotago.CommitmentID, src peer.ID)) (unsubscribe func())

func (*Protocol) OnError

func (p *Protocol) OnError(callback func(err error, src peer.ID)) (unsubscribe func())

func (*Protocol) OnShutdown

func (p *Protocol) OnShutdown(callback func()) (unsubscribe func())

func (*Protocol) OnWarpSyncRequestReceived

func (p *Protocol) OnWarpSyncRequestReceived(callback func(commitmentID iotago.CommitmentID, src peer.ID)) (unsubscribe func())

func (*Protocol) OnWarpSyncResponseReceived

func (p *Protocol) OnWarpSyncResponseReceived(callback func(commitmentID iotago.CommitmentID, blockIDs map[iotago.CommitmentID]iotago.BlockIDs, proof *merklehasher.Proof[iotago.Identifier], transactionIDs iotago.TransactionIDs, mutationProof *merklehasher.Proof[iotago.Identifier], src peer.ID)) (unsubscribe func())

func (*Protocol) RequestAttestations

func (p *Protocol) RequestAttestations(id iotago.CommitmentID, to ...peer.ID)

func (*Protocol) RequestBlock

func (p *Protocol) RequestBlock(id iotago.BlockID, to ...peer.ID)

func (*Protocol) RequestSlotCommitment

func (p *Protocol) RequestSlotCommitment(id iotago.CommitmentID, to ...peer.ID)

func (*Protocol) SendAttestations

func (p *Protocol) SendAttestations(cm *model.Commitment, attestations []*iotago.Attestation, merkleProof *merklehasher.Proof[iotago.Identifier], to ...peer.ID) error

func (*Protocol) SendBlock

func (p *Protocol) SendBlock(block *model.Block, to ...peer.ID)

func (*Protocol) SendSlotCommitment

func (p *Protocol) SendSlotCommitment(cm *model.Commitment, to ...peer.ID)

func (*Protocol) SendWarpSyncRequest

func (p *Protocol) SendWarpSyncRequest(id iotago.CommitmentID, to ...peer.ID)

func (*Protocol) SendWarpSyncResponse

func (p *Protocol) SendWarpSyncResponse(id iotago.CommitmentID, blockIDsBySlotCommitmentID map[iotago.CommitmentID]iotago.BlockIDs, tangleMerkleProof *merklehasher.Proof[iotago.Identifier], transactionIDs iotago.TransactionIDs, mutationsMerkleProof *merklehasher.Proof[iotago.Identifier], to ...peer.ID)

func (*Protocol) Shutdown

func (p *Protocol) Shutdown()

type WarpSyncPayload

type WarpSyncPayload struct {
	BlockIDsBySlotCommitmentID map[iotago.CommitmentID]iotago.BlockIDs `serix:",lenPrefix=uint32"`
	TangleMerkleProof          *merklehasher.Proof[iotago.Identifier]  `serix:""`
	TransactionIDs             iotago.TransactionIDs                   `serix:""`
	MutationsMerkleProof       *merklehasher.Proof[iotago.Identifier]  `serix:""`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL