statusservice

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2024 License: GPL-3.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func StartStatusHandler

func StartStatusHandler(ctx context.Context, data *HandlerData) (chan struct{}, error)

StartStatusHandler starts the event queue listener for status events returns channel for tracking if all jobs are finished

func StartWebServer

func StartWebServer(data *Data) error

StartWebServer starts echo web service

Types

type DB

type DB interface {
	LoadStatus(ctx context.Context, id string) (*persistence.Status, error)
}

DB loads status info

type Data

type Data struct {
	Port      int
	DB        DB
	WSHandler WSConnHandler
}

Data keeps data required for service work

type HandlerData

type HandlerData struct {
	GueClient   *gue.Client
	WorkerCount int
	DB          StatusDB
	WSHandler   WSConnHandler
}

HandlerData keeps data required for handler

type StatusDB

type StatusDB interface {
	LoadStatus(ctx context.Context, id string) (*persistence.Status, error)
}

StatusDB provides persistance functionality

type WSConnHandler

type WSConnHandler interface {
	HandleConnection(WsConn) error
	GetConnections(id string) ([]WsConn, bool)
}

WSConnHandler WwbSocketConnection wrapper

type WSConnKeeper

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

WSConnKeeper implements connection management

func NewWSConnKeeper

func NewWSConnKeeper() *WSConnKeeper

NewWSConnKeeper creates manager

func (*WSConnKeeper) GetConnections

func (kp *WSConnKeeper) GetConnections(id string) ([]WsConn, bool)

GetConnections returns saved connections by provided id

func (*WSConnKeeper) HandleConnection

func (kp *WSConnKeeper) HandleConnection(conn WsConn) error

HandleConnection loops until connection active and save connection with provided ID as key

type WsConn

type WsConn interface {
	ReadMessage() (messageType int, p []byte, err error)
	Close() error
	WriteJSON(v interface{}) error
}

WsConn is interface for websocket handling in status service

Jump to

Keyboard shortcuts

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