pool

package
v0.11.3 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Pool

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

Pool represent virtual connection to the Neo network to communicate with multiple Neo servers.

func NewPool

func NewPool(ctx context.Context, prm PrmPool) (*Pool, error)

NewPool creates connection pool using parameters.

func (*Pool) Call

func (p *Pool) Call(contract util.Uint160, operation string, params ...any) (*result.Invoke, error)

Call returns the results after calling the smart contract scripthash with the given operation and parameters. NOTE: this is test invoke and will not affect the blockchain.

func (*Pool) CallAndExpandIterator

func (p *Pool) CallAndExpandIterator(contract util.Uint160, method string, maxItems int, params ...any) (*result.Invoke, error)

CallAndExpandIterator creates a script containing a call of the specified method of a contract with given parameters (similar to how Call operates). But then this script contains additional code that expects that the result of the first call is an iterator.

func (*Pool) FetchHeight

func (p *Pool) FetchHeight() []monitor.HeightData

func (*Pool) FetchState

func (p *Pool) FetchState(height uint32) []monitor.StateData

func (*Pool) GetBlockCount

func (p *Pool) GetBlockCount() (uint32, error)

GetBlockCount returns the number of blocks in the main chain.

func (*Pool) GetCommittee

func (p *Pool) GetCommittee() (keys.PublicKeys, error)

GetCommittee returns the current public keys of NEO nodes in committee.

func (*Pool) GetContractStateByID

func (p *Pool) GetContractStateByID(id int32) (*state.Contract, error)

GetContractStateByID queries contract information, according to the contract ID.

func (*Pool) GetDesignatedByRole

func (p *Pool) GetDesignatedByRole(role noderoles.Role, height uint32) (keys.PublicKeys, error)

GetDesignatedByRole invokes `getDesignatedByRole` method on a native RoleManagement contract.

func (*Pool) ResolveContract

func (p *Pool) ResolveContract(contractName string) (util.Uint160, error)

ResolveContract helps to take contract address by contract name. Name list can be taken from contract wrappers, for instance rpcnns.NameNetmap.

func (*Pool) TerminateSession

func (p *Pool) TerminateSession(_ uuid.UUID) error

TerminateSession closes the given session, returning an error if anything goes wrong. It's not strictly required to close the session (it'll expire on the server anyway), but it helps to release server resources earlier.

func (*Pool) TraverseIterator

func (p *Pool) TraverseIterator(_ uuid.UUID, _ *result.Iterator, _ int) ([]stackitem.Item, error)

TraverseIterator allows to retrieve the next batch of items from the given iterator in the given session (previously returned from Call).

type PrmPool

type PrmPool struct {
	Endpoints       []string
	DialTimeout     time.Duration
	RecheckInterval time.Duration
}

PrmPool groups parameter to create Pool.

Jump to

Keyboard shortcuts

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