server

package
v0.0.0-...-010ee05 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2023 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CORSMiddleware

func CORSMiddleware() gin.HandlerFunc

middleware we add so rest api can be called from any domain via javascript

Types

type ListType

type ListType interface {
	string | uint64
}

generalize our watchlist so in the future we can use this for addresses, applications and assets

type Processor

type Processor[L ListType] func(item L) error

generalized function that will take in whatever kind of list we setup

type QueueFailures

type QueueFailures[L ListType] struct {
	*sync.Mutex
	List map[L]error
}

type Server

type Server struct {
	*http.Server
	LocalTime *time.Location
	Sentry    *sentry.Client
	Algod     *algod.Client
	LastBlock uint64
	WatchList *WatchList[string]
}

func New

func New(mainnet bool, sentryDSN string, tz string, port string) *Server

New is our server constructor function this function takes in paramaters from the command line and returns a server struct ready to run

func (*Server) Close

func (s *Server) Close()

func (*Server) ProcessAddress

func (s *Server) ProcessAddress(address string) error

type SlimmedAccountState

type SlimmedAccountState struct {
	Amount uint64            `json:"amount"`
	Assets map[uint64]uint64 `json:"assets"`
}

type WatchList

type WatchList[L ListType] struct {
	Subs       *sync.Map
	Processors []Processor[L]
	ListChan   chan []L
}

func NewWatchList

func NewWatchList[L ListType](processors []Processor[L], ignoreFailures bool) *WatchList[L]

func (*WatchList[L]) AddToQueue

func (wl *WatchList[L]) AddToQueue(list []L) error

func (*WatchList[L]) Start

func (wl *WatchList[L]) Start()

Jump to

Keyboard shortcuts

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