engine

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2024 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Timeout  = 2 * 60
	Interval = 1
	Tries    = 1
	ChSize   = 1024
	Works    = 8
)
View Source
var (
	Flow = CoinFlow{
		// contains filtered or unexported fields
	}
)

Functions

This section is empty.

Types

type AppContext

type AppContext struct {
	Wallets         uint64
	AbnormalWallets uint64

	Inflow map[string]decimal.Decimal

	Outflow map[string]decimal.Decimal
	Burn    decimal.Decimal

	// requests / day, for trongrid
	Grid uint64
}

type CoinFlow

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

func (*CoinFlow) AbnormalWallets

func (f *CoinFlow) AbnormalWallets(k string, n int)

func (*CoinFlow) GetFlow

func (f *CoinFlow) GetFlow(k string) *AppContext

func (*CoinFlow) Grid

func (f *CoinFlow) Grid(k string, n int)

func (*CoinFlow) In

func (f *CoinFlow) In(k string, diff decimal.Decimal, name string, info *utils.AppInfo)

func (*CoinFlow) Out

func (f *CoinFlow) Out(k string, diff decimal.Decimal, burn decimal.Decimal, name string, info *utils.AppInfo)

func (*CoinFlow) Wallets

func (f *CoinFlow) Wallets(k string, n int)

type Engine

type Engine struct {
	// St means static table
	St StaticTable

	Wallets wallets.TRCWallets

	Provider provider.Providerer

	W  utils.Writer
	RW utils.ReadWriter
	L  *log.Logger

	Certs cert.Cert

	// seconds
	Timeout int
	// seconds
	Interval int
	Tries    int

	Ch chan TaskType

	ExcepCount int64

	// count and closed togather to occupy one cache line
	Count  int64
	Closed int64
	// contains filtered or unexported fields
}

func New

func New(w utils.Writer, rw utils.ReadWriter) *Engine

func (*Engine) Alloc

func (e *Engine) Alloc(key string) (*wallets.TRCWallet, error)

func (*Engine) IsCerted

func (e *Engine) IsCerted(key []string) (map[string]*utils.AppInfo, error)

func (*Engine) Isclosed

func (e *Engine) Isclosed() bool

func (*Engine) Rel

func (e *Engine) Rel(w *wallets.TRCWallet) error

means release, or free

type StaticTable

type StaticTable struct {
	RWlock sync.RWMutex

	Table map[string]*wallets.TRCWallet
}

func (*StaticTable) Map

func (s *StaticTable) Map(address string) *wallets.TRCWallet

func (*StaticTable) Push

func (s *StaticTable) Push(address string, w *wallets.TRCWallet)

type TaskType

type TaskType = func()

Jump to

Keyboard shortcuts

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