data

package
v1.2.3 Latest Latest
Warning

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

Go to latest
Published: May 17, 2023 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// WSRoute is the route which data will be sent over websocket
	WSRoute = "/save"
)

Variables

View Source
var ErrEmptyDataToSend = errors.New("empty data to send")

ErrEmptyDataToSend signals that the data that should be sent via websocket is empty

View Source
var ErrNilHttpServer = errors.New("nil http server")

ErrNilHttpServer signals that a nil http server has been provided

View Source
var ErrNilLogger = errors.New("nil logger")

ErrNilLogger signals that a nil instance of logger has been provided

View Source
var ErrNilMarshaller = errors.New("nil marshaller")

ErrNilMarshaller signals that a nil marshaller has been provided

View Source
var ErrNilUint64ByteSliceConverter = errors.New("nil uint64 byte slice converter")

ErrNilUint64ByteSliceConverter signals that a nil uint64 byte slice converter has been provided

View Source
var ErrNilWebSocketClient = errors.New("nil websocket client")

ErrNilWebSocketClient signals that a nil websocket client has been provided

View Source
var ErrNilWebSocketSender = errors.New("nil sender sender")

ErrNilWebSocketSender signals that a nil web socket sender has been provided

View Source
var ErrNoClientToSendTo = errors.New("no client to send to")

ErrNoClientToSendTo signals that the list of clients listening to messages is empty

View Source
var ErrServerIsClosed = errors.New("http: Server closed")

ErrServerIsClosed represents the error thrown by the server's ListenAndServe() function when the server is closed

View Source
var ErrWebSocketClientNotFound = errors.New("websocket client not found")

ErrWebSocketClientNotFound signals that the provided websocket client was not found

View Source
var ErrWebSocketServerIsClosed = errors.New("server is closed")

ErrWebSocketServerIsClosed signals that the web socket server was closed while trying to perform actions

Functions

This section is empty.

Types

type ArgsFinalizedBlock

type ArgsFinalizedBlock struct {
	HeaderHash []byte
}

ArgsFinalizedBlock holds the driver's arguments needed for handling a finalized block

type ArgsRevertIndexedBlock

type ArgsRevertIndexedBlock struct {
	HeaderType core.HeaderType
	Header     data.HeaderHandler
	Body       data.BodyHandler
}

ArgsRevertIndexedBlock holds the driver's arguments needed for reverting an indexed block

type ArgsSaveAccounts

type ArgsSaveAccounts struct {
	ShardID        uint32
	BlockTimestamp uint64
	Acc            map[string]*outport.AlteredAccount
}

ArgsSaveAccounts holds the driver's arguments needed for indexing accounts

type ArgsSaveBlock

type ArgsSaveBlock struct {
	HeaderType core.HeaderType
	outport.ArgsSaveBlockData
}

ArgsSaveBlock holds the driver's arguments needed for handling a save block

type ArgsSaveRoundsInfo

type ArgsSaveRoundsInfo struct {
	RoundsInfos []*outport.RoundInfo
}

ArgsSaveRoundsInfo holds the driver's arguments needed for indexing rounds info

type ArgsSaveValidatorsPubKeys

type ArgsSaveValidatorsPubKeys struct {
	ValidatorsPubKeys map[uint32][][]byte
	Epoch             uint32
}

ArgsSaveValidatorsPubKeys holds the driver's arguments needed for indexing validator public keys

type ArgsSaveValidatorsRating

type ArgsSaveValidatorsRating struct {
	IndexID    string
	InfoRating []*outport.ValidatorRatingInfo
}

ArgsSaveValidatorsRating holds the driver's arguments needed for indexing validators' rating

type OperationType

type OperationType uint8

OperationType defines the type to be used to group web socket operations

const (
	// OperationSaveBlock is the operation that triggers a block saving
	OperationSaveBlock OperationType = 0
	// OperationRevertIndexedBlock is the operation that triggers a reverting of an indexed block
	OperationRevertIndexedBlock OperationType = 1
	// OperationSaveRoundsInfo is the operation that triggers the saving of rounds info
	OperationSaveRoundsInfo OperationType = 2
	// OperationSaveValidatorsPubKeys is the operation that triggers the saving of validators' public keys
	OperationSaveValidatorsPubKeys OperationType = 3
	// OperationSaveValidatorsRating is the operation that triggers the saving of the validators' rating
	OperationSaveValidatorsRating OperationType = 4
	// OperationSaveAccounts is the operation that triggers the saving of accounts
	OperationSaveAccounts OperationType = 5
	// OperationFinalizedBlock is the operation that triggers the handling of a finalized block
	OperationFinalizedBlock OperationType = 6
)

func OperationTypeFromUint64

func OperationTypeFromUint64(value uint64) OperationType

OperationTypeFromUint64 returns the operation type based on the provided uint64 value

func (OperationType) String

func (ot OperationType) String() string

String will return the string representation of the operation

func (OperationType) Uint32

func (ot OperationType) Uint32() uint32

Uint32 will return the uint32 representation of the operation

type WSConn

type WSConn interface {
	io.Closer
	ReadMessage() (messageType int, payload []byte, err error)
	WriteMessage(messageType int, data []byte) error
}

WSConn defines what a sender shall do

type WebSocketConfig

type WebSocketConfig struct {
	URL             string
	WithAcknowledge bool
}

WebSocketConfig holds the configuration needed for instantiating a new web socket server

type WsSendArgs

type WsSendArgs struct {
	Payload []byte
}

WsSendArgs holds the arguments needed for performing a web socket request

Jump to

Keyboard shortcuts

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