websocketOutportDriver

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2023 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewWebSocketPayloadParser

func NewWebSocketPayloadParser(uint64ByteSliceConverter Uint64ByteSliceConverter) (*websocketPayloadParser, error)

NewWebSocketPayloadParser returns a new instance of websocketPayloadParser

func NewWebsocketOutportDriverNodePart

func NewWebsocketOutportDriverNodePart(args WebsocketOutportDriverNodePartArgs) (*websocketOutportDriverNodePart, error)

NewWebsocketOutportDriverNodePart will create a new instance of websocketOutportDriverNodePart

Types

type Driver

type Driver interface {
	SaveBlock(args *outport.ArgsSaveBlockData) error
	RevertIndexedBlock(header data.HeaderHandler, body data.BodyHandler) error
	SaveRoundsInfo(roundsInfos []*outport.RoundInfo) error
	SaveValidatorsPubKeys(validatorsPubKeys map[uint32][][]byte, epoch uint32) error
	SaveValidatorsRating(indexID string, infoRating []*outport.ValidatorRatingInfo) error
	SaveAccounts(blockTimestamp uint64, acc map[string]*outport.AlteredAccount, shardID uint32) error
	FinalizedBlock(headerHash []byte) error
	Close() error
	IsInterfaceNil() bool
}

Driver is an interface for saving node specific data to other storage. This could be an elastic search index, a MySql database or any other external services.

type PayloadData

type PayloadData struct {
	WithAcknowledge bool
	Counter         uint64
	OperationType   data.OperationType
	Payload         []byte
}

PayloadData holds the arguments that should be parsed from a websocket payload

type Uint64ByteSliceConverter

type Uint64ByteSliceConverter interface {
	ToByteSlice(uint64) []byte
	ToUint64([]byte) (uint64, error)
	IsInterfaceNil() bool
}

Uint64ByteSliceConverter converts byte slice to/from uint64

type WebSocketSenderHandler

type WebSocketSenderHandler interface {
	Send(args outportSenderData.WsSendArgs) error
	AddClient(wss outportSenderData.WSConn, remoteAddr string)
	Close() error
	IsInterfaceNil() bool
}

WebSocketSenderHandler defines what the actions that a web socket sender should do

type WebsocketOutportDriverNodePartArgs

type WebsocketOutportDriverNodePartArgs struct {
	Enabled                  bool
	Marshaller               marshal.Marshalizer
	WebsocketSender          WebSocketSenderHandler
	WebSocketConfig          outportSenderData.WebSocketConfig
	Uint64ByteSliceConverter Uint64ByteSliceConverter
	Log                      core.Logger
}

WebsocketOutportDriverNodePartArgs holds the arguments needed for creating a new websocketOutportDriverNodePart

Directories

Path Synopsis
tests

Jump to

Keyboard shortcuts

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