sample

package
v0.0.0-...-d15eff2 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var IndexNilError = &tracer.Error{
	Kind: "IndexNilError",
	Desc: "At least one of the provided indices was found to be nil, which should never happen. Calculating pagination cursors expects the zero value of any index to be an initialized *big.Int set to 0.",
	Docs: "https://github.com/uvio-network/contracts/blob/v0.5.0/contracts/Claims.sol#L1826-L1882",
}
View Source
var IndexOutOfRangeError = &tracer.Error{
	Kind: "IndexOutOfRangeError",
	Desc: "The provided cursor was found to be out of range, which should never happen. Calculating pagination cursors expects the provided paging pointer to be within either side of a market's index range.",
	Docs: "https://github.com/uvio-network/contracts/blob/v0.5.0/contracts/Claims.sol#L1826-L1882",
}
View Source
var IndexZeroError = &tracer.Error{
	Kind: "IndexZeroError",
	Desc: "Both of the provided total amounts at index 0 and 7 were found to be zero, which should never happen. Calculating pagination cursors expects at least one side of the market to contain at least one market participant to process.",
	Docs: "https://github.com/uvio-network/contracts/blob/v0.5.0/contracts/Claims.sol#L1826-L1882",
}

Functions

func BigInt

func BigInt(a []uint64, b []uint64) []*big.Int

func Paging

func Paging(ind [8]*big.Int, cur *big.Int) (*big.Int, *big.Int, bool, error)

Paging calculates the next index pair of a split integer sequence based on the provided paging pointer. The returned indices are the left and right handside cursors that can be used continuously until the boolean "end" indicates completion of the iteration by flipping true. "cur" must be 0 in order to start an iteration cycle. Consecutive calls to Paging must increment "rig" of the previous call and provide the incremented result as "cur" for the next call. That means "rig" becomes "lef" by executing some out of band process.

Types

type Config

type Config struct {
	Rea io.Reader
}

type Interface

type Interface interface {
	// Random returns a randomized sample of the points on the lines defined by
	// the input lengths. Randomization happens according to the underlying source
	// of entropy. The amount of returned points must be equal on either side and
	// may be capped at some maximum.
	//
	//     inp[0] the maximum length of line A
	//     inp[1] the maximum length of line B
	//     out[2] the random points on line A
	//     out[3] the random points on line B
	//
	Random(uint64, uint64) ([]uint64, []uint64)
}

type Sample

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

func New

func New(c Config) *Sample

func (*Sample) Random

func (s *Sample) Random(a uint64, b uint64) ([]uint64, []uint64)

Jump to

Keyboard shortcuts

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