republisher

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2020 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DuplicatePayloadError = &duplicatePayloadError{&repuberr{errors.New("duplicatePayloadError")}}

DuplicatePayloadError is the error returned when the republisher detects a duplicate

View Source
var EncodingError = &encodingError{&repuberr{errors.New("encoding failed")}}

EncodingError is returned when wire un- marshaling fails

View Source
var InvalidError = &invalidError{&repuberr{errors.New("invalid payload")}}

InvalidError is returned when the payload is invalid

Functions

This section is empty.

Types

type Republisher

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

Republisher handles the repropagation of messages propagated with a specified topic

func New

func New(eb eventbus.Broker, tpc topics.Topic, v ...Validator) *Republisher

New creates a Republisher for a given topic. Multiple Validator functions can be specified for the Republisher to run before forwarding the message

func (*Republisher) Activate

func (r *Republisher) Activate() uint32

Activate the Republisher by listening to topic through a callback listener

func (*Republisher) Republish

func (r *Republisher) Republish(m message.Message) error

Republish intercepts a topic and repropagates it immediately after applying any eventual validation logic. Note: the logic for marshaling should be moved after the Gossip

func (*Republisher) Stop

func (r *Republisher) Stop()

Stop a Republisher

type Validator

type Validator func(message.Message) error

Validator is a function used by the Republisher to establish if the message should be forwarded to the network or otherwise. For instance, the republisher should not propagate transaction being invalid, or messages which Signature check fails, etc

Jump to

Keyboard shortcuts

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