vflux

package
v0.0.21 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2022 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MaxRequestLength    = 16 // max number of individual requests in a batch
	CapacityQueryName   = "cq"
	CapacityQueryMaxLen = 16
)
View Source
const (
	IntNonNegative = iota
	IntNegative
	IntPlusInf
	IntMinusInf
)

Variables

View Source
var ErrNoReply = errors.New("no reply for given request")

Functions

This section is empty.

Types

type CapacityQueryReply

type CapacityQueryReply []uint64

CapacityQueryReq is the encoding format of the response to the capacity query

type CapacityQueryReq

type CapacityQueryReq struct {
	Bias      uint64 // seconds
	AddTokens []IntOrInf
}

CapacityQueryReq is the encoding format of the capacity query

type IntOrInf

type IntOrInf struct {
	Type  uint8
	Value big.Int
}

IntOrInf is the encoding format for arbitrary length signed integers that can also hold the values of +Inf or -Inf

func (*IntOrInf) BigInt

func (i *IntOrInf) BigInt() *big.Int

BigInt returns the value as a big.Int or panics if the value is infinity

func (*IntOrInf) Inf

func (i *IntOrInf) Inf() int

Inf returns 1 if the value is +Inf, -1 if it is -Inf, 0 otherwise

func (*IntOrInf) Int64

func (i *IntOrInf) Int64() int64

Int64 limits the value between MinInt64 and MaxInt64 (even if it is +-Inf) and returns an int64 type

func (*IntOrInf) SetBigInt

func (i *IntOrInf) SetBigInt(v *big.Int)

SetBigInt sets the value to the given big.Int

func (*IntOrInf) SetInf

func (i *IntOrInf) SetInf(sign int)

SetInf sets the value to +Inf or -Inf

func (*IntOrInf) SetInt64

func (i *IntOrInf) SetInt64(v int64)

SetInt64 sets the value to the given int64. Note that MaxInt64 translates to +Inf while MinInt64 translates to -Inf.

type Replies

type Replies [][]byte

Replies are the replies to a batch of requests

func (Replies) Get

func (r Replies) Get(i int, val interface{}) error

Get decodes the reply to the i-th request in the batch

type Request

type Request struct {
	Service, Name string
	Params        []byte
}

Request describes a single vflux request inside a batch. Service and request type are identified by strings, parameters are RLP encoded.

type Requests

type Requests []Request

Requests are a batch of vflux requests

func (*Requests) Add

func (r *Requests) Add(service, name string, val interface{}) (int, error)

Add encodes and adds a new request to the batch

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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