server

package
v0.0.0-...-602aa65 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2024 License: MIT Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BalancerTypeRoundRobin = "round_robin"
	BalancerTypeFailOver   = "fail_over"
)
View Source
const HitTypeBackend = "backend"
View Source
const HitTypeCache = "cache"
View Source
const HitTypeEmulated = "emulated"
View Source
const HitTypeFailedInternal = "failed_internal"
View Source
const HitTypeFailedValidate = "failed_validate"
View Source
const HitTypeGPCache = "gp_cache"
View Source
const HitTypeInflightCache = "inflight_cache"

Variables

View Source
var ErrTimeout = ton.LSError{
	Code: 652,
	Text: "timeout",
}

Functions

This section is empty.

Types

type Backend

type Backend struct {
	Name   string
	Client *liteclient.ConnectionPool
	Weight uint64
	// contains filtered or unexported fields
}

func (*Backend) QueryLiteserver

func (b *Backend) QueryLiteserver(ctx context.Context, payload tl.Serializable, result tl.Serializable) (err error)

func (*Backend) StickyContext

func (b *Backend) StickyContext(ctx context.Context) context.Context

func (*Backend) StickyContextNextNode

func (b *Backend) StickyContextNextNode(ctx context.Context) (context.Context, error)

func (*Backend) StickyNodeID

func (b *Backend) StickyNodeID(ctx context.Context) uint32

type BackendBalancer

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

func NewBackendBalancer

func NewBackendBalancer(backends []config.BackendLiteserver, typ BalancerType) (*BackendBalancer, error)

func (*BackendBalancer) GetClient

func (b *BackendBalancer) GetClient() ton.LiteClient

type BalancerType

type BalancerType string

type Block

type Block struct {
	ID            *ton.BlockIDExt
	Data          *cell.Cell
	DataRaw       []byte // TODO: align boc serialization to be same with c++, because of file hash
	ShardAccounts *tlb.ShardAccountBlocks

	MasterID *ton.BlockIDExt
	// contains filtered or unexported fields
}

type BlockCache

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

func NewBlockCache

func NewBlockCache(config config.CacheConfig, balancer *BackendBalancer) *BlockCache

func (*BlockCache) CacheBlockIfNeeded

func (c *BlockCache) CacheBlockIfNeeded(ctx context.Context, id *ton.BlockIDExt) (*Block, bool, error)

func (*BlockCache) GetAccountState

func (c *BlockCache) GetAccountState(ctx context.Context, id *ton.BlockIDExt, addr *address.Address) (*ton.AccountState, bool, error)

func (*BlockCache) GetAccountStateInBlock

func (c *BlockCache) GetAccountStateInBlock(ctx context.Context, block *Block, addr *address.Address) (*ton.AccountState, bool, error)

func (*BlockCache) GetLastMasterBlock

func (c *BlockCache) GetLastMasterBlock(ctx context.Context) (*MasterBlock, bool, error)

func (*BlockCache) GetLibraries

func (c *BlockCache) GetLibraries(ctx context.Context, hashes [][]byte) (*cell.Dictionary, bool, error)

func (*BlockCache) GetMasterBlock

func (c *BlockCache) GetMasterBlock(ctx context.Context, id *ton.BlockIDExt) (*MasterBlock, bool, error)

func (*BlockCache) GetTransaction

func (c *BlockCache) GetTransaction(ctx context.Context, block *Block, account *ton.AccountID, lt int64) (*ton.TransactionInfo, error)

func (*BlockCache) GetZeroState

func (c *BlockCache) GetZeroState() (*ton.ZeroStateIDExt, error)

func (*BlockCache) LookupBlockInCache

func (c *BlockCache) LookupBlockInCache(id *ton.BlockInfoShort) (*ton.BlockHeader, error)

func (*BlockCache) WaitMasterBlock

func (c *BlockCache) WaitMasterBlock(ctx context.Context, seqno uint32, timeout time.Duration) error

type Cache

type Cache interface {
	LookupBlockInCache(id *ton.BlockInfoShort) (*ton.BlockHeader, error)
	GetTransaction(ctx context.Context, block *Block, account *ton.AccountID, lt int64) (*ton.TransactionInfo, error)
	GetLibraries(ctx context.Context, hashes [][]byte) (*cell.Dictionary, bool, error)
	WaitMasterBlock(ctx context.Context, seqno uint32, timeout time.Duration) error
	GetZeroState() (*ton.ZeroStateIDExt, error)
	GetMasterBlock(ctx context.Context, id *ton.BlockIDExt) (*MasterBlock, bool, error)
	GetLastMasterBlock(ctx context.Context) (*MasterBlock, bool, error)
	GetAccountStateInBlock(ctx context.Context, block *Block, addr *address.Address) (*ton.AccountState, bool, error)
	CacheBlockIfNeeded(ctx context.Context, id *ton.BlockIDExt) (*Block, bool, error)
}

type CacheWaiter

type CacheWaiter struct {
	W      chan bool
	Result tl.Serializable
}

type Client

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

type ClientConnInfo

type ClientConnInfo struct {
	Client      *liteclient.ServerClient
	LastRequest int64
}

type ClientIPInfo

type ClientIPInfo struct {
	ActiveConnections map[uint16]*ClientConnInfo
}

type KeyBlock

type KeyBlock struct {
	Seqno uint32
	Proof *cell.Cell
	Prev  *KeyBlock
}

type KeyConfig

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

type MasterBlock

type MasterBlock struct {
	Block
	StateHash []byte
	GenTime   uint32
	Config    *cell.Dictionary
	// contains filtered or unexported fields
}

type ProxyBalancer

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

func NewProxyBalancer

func NewProxyBalancer(configs []config.ClientConfig, backendBalancer *BackendBalancer, cache Cache, onlyProxy bool, maxConnectionsPerIP int, maxKeepAlive time.Duration, gpCacheSize int) *ProxyBalancer

func (*ProxyBalancer) Listen

func (s *ProxyBalancer) Listen(addr string) error

type ShardBlock

type ShardBlock struct {
	Block
	// contains filtered or unexported fields
}

type ShardInfo

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

Jump to

Keyboard shortcuts

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