commontypes

package
v0.0.0-...-adbe570 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2024 License: MIT Imports: 5 Imported by: 75

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BinaryMessageWithSender

type BinaryMessageWithSender struct {
	Msg    []byte
	Sender OracleID
}

BinaryMessageWithSender contains the information from a Receive() channel message: The binary representation of the message, and the ID of its sender.

type BinaryNetworkEndpoint

type BinaryNetworkEndpoint interface {
	// SendTo(msg, to) sends msg to "to"
	SendTo(payload []byte, to OracleID)
	// Broadcast(msg) sends msg to all oracles
	Broadcast(payload []byte)
	// Receive returns channel which carries all messages sent to this oracle.
	Receive() <-chan BinaryMessageWithSender
	// Start starts the endpoint
	Start() error
	// Close stops the endpoint. Calling this multiple times may return an
	// error, but must not panic.
	Close() error
}

BinaryNetworkEndpoint contains the network methods a consumer must implement SendTo and Broadcast must not block. They should buffer messages and (optionally) drop the oldest buffered messages if the buffer reaches capacity.

The protocol trusts the sender in BinaryMessageWithSender. Implementors of this interface are responsible for securely authenticating that messages come from their indicated senders.

All its functions should be thread-safe.

type Bootstrapper

type Bootstrapper interface {
	Start() error
	// Close closes the bootstrapper. Calling this multiple times may return an
	// error, but must not panic.
	Close() error
}

Bootstrapper helps nodes find each other on the network level by providing peer-discovery services.

All its functions should be thread-safe.

type BootstrapperLocator

type BootstrapperLocator struct {
	// PeerID is the libp2p-style peer ID of the bootstrapper
	PeerID string

	// Addrs contains the addresses of the bootstrapper. An address must be of the form "<host>:<port>",
	// such as "52.49.198.28:80" or "chain.link:443".
	Addrs []string
}

BootstrapperLocator contains information for locating a bootstrapper on the network. It is encoded like PeerID@Addr[0]/Addr[1]/.../Addr[len(Addr)-1]. Sample encoding: 12D3KooWQzePGqHw66cV1Qsm71eGZKiPEgALYYM3inPtFYibZ67e@192.168.1.1:1234/192.168.1.2:2345

func NewBootstrapperLocator

func NewBootstrapperLocator(peerID string, addrs []string) (*BootstrapperLocator, error)

func (*BootstrapperLocator) MarshalText

func (b *BootstrapperLocator) MarshalText() ([]byte, error)

func (*BootstrapperLocator) UnmarshalText

func (b *BootstrapperLocator) UnmarshalText(text []byte) error

type LogFields

type LogFields map[string]interface{}

type Logger

type Logger interface {
	Trace(msg string, fields LogFields)
	Debug(msg string, fields LogFields)
	Info(msg string, fields LogFields)
	Warn(msg string, fields LogFields)
	Error(msg string, fields LogFields)
	Critical(msg string, fields LogFields)
}

Loggers logs things using a structured-logging approach. All its functions should be thread-safe. It is acceptable to pass a nil LogFields to all of its functions.

type MonitoringEndpoint

type MonitoringEndpoint interface {
	SendLog(log []byte)
}

MonitoringEndpoint is where the OCR protocol sends monitoring output

All its functions should be thread-safe.

type OracleID

type OracleID uint8

OracleID is an index over the oracles, used as a succinct attribution to an oracle in communication with the on-chain contract. It is not a cryptographic commitment to the oracle's private key, like a public key is.

Jump to

Keyboard shortcuts

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