pslice

package
v1.6.2 Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2022 License: BSD-3-Clause Imports: 3 Imported by: 2 modules, 2 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PSlice

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

PSlice maintains a list of addresses, indexing them by their different proximity orders.

func New

func New(maxBins int, base swarm.Address) *PSlice

New creates a new PSlice.

func (*PSlice) Add

func (s *PSlice) Add(addrs ...swarm.Address)

Add a peer at a certain PO.

func (*PSlice) BinPeers

func (s *PSlice) BinPeers(bin uint8) []swarm.Address

func (*PSlice) BinSize added in v1.2.0

func (s *PSlice) BinSize(bin uint8) int

func (*PSlice) EachBin

func (s *PSlice) EachBin(pf topology.EachPeerFunc) error

iterates over all peers from deepest bin to shallowest.

func (*PSlice) EachBinRev

func (s *PSlice) EachBinRev(pf topology.EachPeerFunc) error

EachBinRev iterates over all peers from shallowest bin to deepest.

func (*PSlice) Exists

func (s *PSlice) Exists(addr swarm.Address) bool

Exists checks if a peer exists.

func (*PSlice) Length

func (s *PSlice) Length() int

Length returns the number of peers in the Pslice.

func (*PSlice) Remove

func (s *PSlice) Remove(addr swarm.Address)

Remove a peer at a certain PO.

func (*PSlice) ShallowestEmpty

func (s *PSlice) ShallowestEmpty() (uint8, bool)

ShallowestEmpty returns the shallowest empty bin if one exists. If such bin does not exists, returns true as bool value.

Jump to

Keyboard shortcuts

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