client

package
v0.0.0-...-e03aae4 Latest Latest
Warning

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

Go to latest
Published: May 6, 2022 License: GPL-3.0 Imports: 26 Imported by: 0

Documentation

Overview

nolint:nakedret,dupl

nolint:nakedret

nolint:nakedret

nolint:nakedret

nolint:nakedret

nolint:nakedret,dupl

nolint:nakedret,dupl

Index

Constants

View Source
const (
	ProtocolVersionStr = "1.0.0"        // The same, as a string
	ProtocolName       = "bitbonclient" // Nickname of the protocol in geth

	DefaultJournalName    = ".bitbon.client.journal.LDB"
	DefaultJournalTimeout = 10 * time.Minute
	DefaultConfirmTimeout = 5 * time.Second
	DefaultPublishTimeout = 3 * time.Second

	DefaultAssetboxExchange    = "e.assetbox.forward"
	DefaultTransferExchange    = "e.transfer.forward"
	DefaultBlockExchange       = "e.block.forward"
	DefaultTransactionExchange = "e.transaction.forward"
	DefaultMiningExchange      = "e.mining.forward"
	DefaultFeeExchange         = "e.fee.forward"

	LastErrorCleanInterval = 20 * time.Second
)

Bitbon constants

Variables

This section is empty.

Functions

func IsAllowed

func IsAllowed() bool

Types

type API

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

API provides the bitbon bitbon RPC service

func NewAPI

func NewAPI(client *Client) *API

NewAPI create a new RPC bitbon agent service.

func (*API) GetClientModes

func (api *API) GetClientModes() map[string]BitbonClientMode

func (*API) GetCurrentMode

func (api *API) GetCurrentMode() BitbonClientMode

func (*API) GetHandlerKeys

func (api *API) GetHandlerKeys() []string

func (*API) GetJournal

func (api *API) GetJournal() ([]*amqp.Publishing, error)

func (*API) GetPoolError

func (api *API) GetPoolError(key string) (map[int]map[string]interface{}, error)

func (*API) GetPoolErrors

func (api *API) GetPoolErrors() (map[string]map[int]map[string]interface{}, error)

func (*API) GetPoolSize

func (api *API) GetPoolSize(key string) (int, error)

func (*API) GetPoolSizes

func (api *API) GetPoolSizes() (map[string]int, error)

func (*API) SetPoolSize

func (api *API) SetPoolSize(key string, n int) error

func (*API) Version

func (api *API) Version(_ context.Context) string

Version returns version.

type BitbonClientMode

type BitbonClientMode int
const (
	BitbonClientUndefinedMode BitbonClientMode = iota
	BitbonClientAllMode
	BitbonClientMutableMode
	BitbonClientReadableMode
)

type Client

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

func New

func New(ctx *node.ServiceContext, cfg *Config) (*Client, error)

func (*Client) APIs

func (c *Client) APIs() []rpc.API

func (*Client) GetJournal

func (c *Client) GetJournal() *bitbonAmqp.PublishJournal

func (*Client) Protocols

func (c *Client) Protocols() []p2p.Protocol

Protocols is a meaningless implementation of node.Service.

func (*Client) Start

func (c *Client) Start(_ *p2p.Server) error

func (*Client) Stop

func (c *Client) Stop() error

func (*Client) Stopped

func (c *Client) Stopped() bool

type Config

type Config struct {
	Enabled                 bool
	Mode                    BitbonClientMode
	WaitSync                bool // if WaitSync is true client won`t start until sync is not finished
	AmqpConnStrs            []string
	AmqpAssetboxExchange    string
	AmqpTransferExchange    string
	AmqpConfirmTimeout      time.Duration
	AmqpPublishTimeout      time.Duration
	JournalTimeout          time.Duration
	JournalName             string
	AmqpBlockExchange       string
	AmqpTransactionExchange string
	AmqpMiningExchange      string
	AmqpFeeExchange         string
}

Config represents the configuration state of a bitbon agent service.

type Pool

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

Pool is a struct that manages a collection of workers, each with their own goroutine.

func NewPool

func NewPool(constructor Worker) *Pool

New creates a new Pool of workers. You must provide a constructor function that creates new Worker types and when you change the size of the pool the constructor will be called to create each new Worker.

func (*Pool) Close

func (p *Pool) Close()

Close will terminate all workers and close the job channel of this Pool.

func (*Pool) GetSize

func (p *Pool) GetSize() int

GetSize returns the current size of the pool.

func (*Pool) Process

func (p *Pool) Process(n int)

Process runs the pool

func (*Pool) SetSize

func (p *Pool) SetSize(n int)

SetSize changes the total number of workers in the Pool. This can be called by any goroutine at any time unless the Pool has been stopped, in which case a panic will occur.

type Worker

type Worker func(num int, close <-chan struct{})

Worker is a blocking operation, that takes a close chan. Worker should exit when close is closed

Jump to

Keyboard shortcuts

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