sse

package
v0.0.0-...-91dbc65 Latest Latest
Warning

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

Go to latest
Published: May 18, 2024 License: AGPL-3.0 Imports: 19 Imported by: 0

Documentation

Overview

Package sse contains utilities for working with server sent events.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Server

type Server interface {
	Close()
	CreateStream(id string) *sse.Stream
	HTTPHandler(w http.ResponseWriter, r *http.Request)
	Publish(id string, event *sse.Event)
}

Server is in charge of managing the streams to which the events are sent to.

type ServerMock

type ServerMock struct {
	mock.Mock
}

ServerMock is a mocked implementation of event server.

func NewServerMock

func NewServerMock() *ServerMock

NewServerMock returns a mocked event server.

func (*ServerMock) Close

func (s *ServerMock) Close()

Close mock.

func (*ServerMock) CreateStream

func (s *ServerMock) CreateStream(id string) *sse.Stream

CreateStream mock.

func (*ServerMock) HTTPHandler

func (s *ServerMock) HTTPHandler(w http.ResponseWriter, r *http.Request)

HTTPHandler mock.

func (*ServerMock) Publish

func (s *ServerMock) Publish(id string, event *sse.Event)

Publish mock.

type Streamer

type Streamer interface {
	http.Handler
	io.Closer
	TrackPayment(rHash, publicKey string, amount uint64) uint64
}

Streamer is in charge of tracking payments and executing actions based on them.

func NewStreamer

func NewStreamer(
	config config.SSE,
	db *db.DB,
	lnd lightning.Client,
	winnersCh <-chan []db.Winner,
	blocksCh chan<- *chainrpc.BlockEpoch,
) (Streamer, error)

NewStreamer returns a new event streamer.

type StreamerMock

type StreamerMock struct {
	mock.Mock
}

StreamerMock is a mocked implementation of an event streamer.

func NewStreamerMock

func NewStreamerMock() *StreamerMock

NewStreamerMock returns a mocked event streamer.

func (*StreamerMock) Close

func (s *StreamerMock) Close() error

Close mock.

func (*StreamerMock) ServeHTTP

func (s *StreamerMock) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServerHTTP mock.

func (*StreamerMock) TrackPayment

func (s *StreamerMock) TrackPayment(rHash, publicKey string, amount uint64) uint64

TrackPayment mock.

Jump to

Keyboard shortcuts

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