pulsar

package
v0.0.0-...-05bc493 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2023 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Pulsar

type Pulsar struct {
	Config       configuration.Pulsar
	PublicKeyRaw string

	EntropyGenerator entropygenerator.EntropyGenerator

	Certificate                mandates.Certificate
	CryptographyService        cryptography.Service
	PlatformCryptographyScheme cryptography.PlatformCryptographyScheme
	KeyProcessor               cryptography.KeyProcessor
	PulseDistributor           PulseDistributor
	// contains filtered or unexported fields
}

Pulsar is a base struct for pulsar's node It contains all the stuff, which is needed for working of a pulsar

func NewPulsar

func NewPulsar(
	configuration configuration.Pulsar,
	cryptographyService cryptography.Service,
	scheme cryptography.PlatformCryptographyScheme,
	keyProcessor cryptography.KeyProcessor,
	pulseDistributor PulseDistributor,
	entropyGenerator entropygenerator.EntropyGenerator,
) *Pulsar

NewPulsar creates a new pulse with using of custom GeneratedEntropy Generator

func (*Pulsar) LastPN

func (p *Pulsar) LastPN() pulse.Number

func (*Pulsar) Send

func (p *Pulsar) Send(ctx context.Context, pulseNumber pulse.Number) error

type PulseDistributor

type PulseDistributor interface {
	// Distribute distributes a pulse across the network.
	Distribute(context.Context, PulsePacket)
}

PulseDistributor is interface for pulse distribution.

type PulseDistributorMock

type PulseDistributorMock struct {
	DistributeMock mPulseDistributorMockDistribute
	// contains filtered or unexported fields
}

PulseDistributorMock implements PulseDistributor

func NewPulseDistributorMock

func NewPulseDistributorMock(t minimock.Tester) *PulseDistributorMock

NewPulseDistributorMock returns a mock for PulseDistributor

func (*PulseDistributorMock) Distribute

func (mmDistribute *PulseDistributorMock) Distribute(ctx context.Context, p1 PulsePacket)

Distribute implements PulseDistributor

func (*PulseDistributorMock) DistributeAfterCounter

func (mmDistribute *PulseDistributorMock) DistributeAfterCounter() uint64

DistributeAfterCounter returns a count of finished PulseDistributorMock.Distribute invocations

func (*PulseDistributorMock) DistributeBeforeCounter

func (mmDistribute *PulseDistributorMock) DistributeBeforeCounter() uint64

DistributeBeforeCounter returns a count of PulseDistributorMock.Distribute invocations

func (*PulseDistributorMock) MinimockDistributeDone

func (m *PulseDistributorMock) MinimockDistributeDone() bool

MinimockDistributeDone returns true if the count of the Distribute invocations corresponds the number of defined expectations

func (*PulseDistributorMock) MinimockDistributeInspect

func (m *PulseDistributorMock) MinimockDistributeInspect()

MinimockDistributeInspect logs each unmet expectation

func (*PulseDistributorMock) MinimockFinish

func (m *PulseDistributorMock) MinimockFinish()

MinimockFinish checks that all mocked methods have been called the expected number of times

func (*PulseDistributorMock) MinimockWait

func (m *PulseDistributorMock) MinimockWait(timeout mm_time.Duration)

MinimockWait waits for all mocked methods to be called the expected number of times

type PulseDistributorMockDistributeExpectation

type PulseDistributorMockDistributeExpectation struct {
	Counter uint64
	// contains filtered or unexported fields
}

PulseDistributorMockDistributeExpectation specifies expectation struct of the PulseDistributor.Distribute

type PulseDistributorMockDistributeParams

type PulseDistributorMockDistributeParams struct {
	// contains filtered or unexported fields
}

PulseDistributorMockDistributeParams contains parameters of the PulseDistributor.Distribute

type PulsePacket

type PulsePacket struct {
	PulseNumber     pulse.Number
	PrevPulseNumber pulse.Number
	NextPulseNumber pulse.Number

	PulseTimestamp   int64
	EpochPulseNumber pulse.Epoch
	OriginID         [rms.OriginIDSize]byte

	Entropy rms.Entropy
	Signs   map[string]SenderConfirmation
}

PulsePacket is base data structure for a pulse.

type PulseSenderConfirmationPayload

type PulseSenderConfirmationPayload struct {
	SenderConfirmation
}

PulseSenderConfirmationPayload is a struct with info about pulse's confirmations

func (*PulseSenderConfirmationPayload) Hash

func (ps *PulseSenderConfirmationPayload) Hash(hashProvider cryptography.Hasher) ([]byte, error)

Hash calculates hash of payload

type SenderConfirmation

type SenderConfirmation struct {
	PulseNumber     pulse.Number
	ChosenPublicKey string
	Entropy         rms.Entropy
	Signature       []byte
}

SenderConfirmation contains confirmations of the pulse from other pulsars Because the system is using BFT for consensus between pulsars, because of it All pulsar send to the chosen pulsar their confirmations Every node in the network can verify the signatures

type TestPulsar

type TestPulsar struct {
	// contains filtered or unexported fields
}

func NewTestPulsar

func NewTestPulsar(
	configuration configuration.Pulsar,
	distributor PulseDistributor,
	generator entropygenerator.EntropyGenerator,
) *TestPulsar

func (*TestPulsar) SendPulse

func (p *TestPulsar) SendPulse(ctx context.Context) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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