socket

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrUnknownEvent    = fmt.Errorf("unknown event")
	ErrSocketClosed    = fmt.Errorf("socket closed")
	ErrInvalidResponse = fmt.Errorf("invalid response")
	ErrUnknown         = fmt.Errorf("unknown error")
)

Functions

This section is empty.

Types

type Client

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

func NewClient

func NewClient() (*Client, error)

func (*Client) Close

func (c *Client) Close() error

func (*Client) GetBlock

func (c *Client) GetBlock(chain string) ([]*ResGetBlock, error)

GetBlock sends GetBlock event to socket

func (*Client) GetMessageList

func (c *Client) GetMessageList(chain string, pagination *store.Pagination) (*ResMessageList, error)

GetMessageList sends GetMessageList event to socket

func (*Client) MessageRemove

func (c *Client) MessageRemove(chain string, sn uint64) (*ResMessageRemove, error)

MessageRemove sends MessageRemove event to socket

func (*Client) PruneDB

func (c *Client) PruneDB() (*ResPruneDB, error)

PruneDB sends PruneDB event to socket

func (*Client) RelayMessage

func (c *Client) RelayMessage(chain string, sn uint64) (*ResRelayMessage, error)

RelayMessage sends RelayMessage event to socket

func (*Client) RevertMessage

func (c *Client) RevertMessage(chain string, sn uint64) (*ResRevertMessage, error)

RevertMessage sends RevertMessage event to socket

type ErrResponse

type ErrResponse struct {
	Error string
}

type Event

type Event string
const (
	EventGetBlock       Event = "GetBlock"
	EventGetMessageList Event = "GetMessageList"
	EventRelayMessage   Event = "RelayMessage"
	EventMessageRemove  Event = "MessageRemove"
	EventPruneDB        Event = "PruneDB"
	EventRevertMessage  Event = "RevertMessage"
	EventError          Event = "Error"
)

type Message

type Message struct {
	Event Event
	Data  []byte
}

type ReqGetBlock

type ReqGetBlock struct {
	Chain string
	All   bool
}

type ReqMessageList

type ReqMessageList struct {
	Chain      string
	Pagination *store.Pagination
}

type ReqMessageRemove

type ReqMessageRemove struct {
	Chain string
	Sn    uint64
}

type ReqPruneDB

type ReqPruneDB struct {
	Chain string
}

type ReqRelayMessage

type ReqRelayMessage struct {
	Chain  string
	Sn     uint64
	Height uint64
}

type ReqRevertMessage

type ReqRevertMessage struct {
	Chain string
	Sn    uint64
}

type ResGetBlock

type ResGetBlock struct {
	Chain  string
	Height uint64
}

type ResMessageList

type ResMessageList struct {
	Messages []*types.RouteMessage
	Total    int
}

type ResMessageRemove

type ResMessageRemove struct {
	Sn     uint64
	Chain  string
	Dst    string
	Height uint64
	Event  string
}

type ResPruneDB

type ResPruneDB struct {
	Status string
}

type ResRelayMessage

type ResRelayMessage struct {
	*types.RouteMessage
}

type ResRevertMessage

type ResRevertMessage struct {
	Sn uint64
}

type Server

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

func NewSocket

func NewSocket(rly *relayer.Relayer) (*Server, error)

func (*Server) Close

func (s *Server) Close() error

func (*Server) IsClosed

func (s *Server) IsClosed() bool

func (*Server) Listen

func (s *Server) Listen()

Listen to socket

Jump to

Keyboard shortcuts

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