pair

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2021 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PairsToCids added in v0.1.1

func PairsToCids(pairs []CidChannelPair) []cid.Cid

Types

type CidChannelPair added in v0.2.0

type CidChannelPair struct {
	Cid     cid.Cid
	Channel channel.Channel
}

CidChannelPair is a pair of IPLD channel and cid.

func CidsToPairs added in v0.1.1

func CidsToPairs(cids []cid.Cid, chn channel.Channel) []CidChannelPair

func PublicCidPair

func PublicCidPair(c cid.Cid) CidChannelPair

PublicCidPair returns a pair consisting of the public IPLD channel and the specified cid.

func (CidChannelPair) Defined added in v0.2.0

func (p CidChannelPair) Defined() bool

Defined returns true if a CidChannelPair is defined Calling any other methods on an undefined CidChannelPair will result in undefined behavior.

func (CidChannelPair) Equals added in v0.2.0

func (p CidChannelPair) Equals(o CidChannelPair) bool

Equals checks that two CidChannelPairs are the same.

type Set

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

Set is a implementation of a set of ChannelCidChannelPairPair, that is, a structure to which holds a single copy of every CidChannelPairs that is added to it.

func NewSet

func NewSet() *Set

NewSet initializes and returns a new Set.

func NewSetFromPairs

func NewSetFromPairs(pairs []CidChannelPair) *Set

NewSetFromPairs initializes and returns a new Set from a slice of CidChannelPairs.

func (*Set) Add

func (s *Set) Add(c CidChannelPair)

Add puts a CidChannelPair in the Set.

func (*Set) Cids

func (s *Set) Cids() []cid.Cid

Cids returns all the unique Cids in the CidChannelPairs in the set.

func (*Set) ForEach

func (s *Set) ForEach(f func(c CidChannelPair) error) error

ForEach allows to run a custom function on each CidChannelPair in the set.

func (*Set) Has

func (s *Set) Has(c CidChannelPair) bool

Has returns if the Set contains a given CidChannelPair.

func (*Set) Keys

func (s *Set) Keys() []CidChannelPair

Keys returns the CidChannelPairs in the set.

func (*Set) Len

func (s *Set) Len() int

Len returns how many elements the Set has.

func (*Set) Remove

func (s *Set) Remove(c CidChannelPair)

Remove deletes a CidChannelPair from the Set.

func (*Set) Visit

func (s *Set) Visit(c CidChannelPair) bool

Visit adds a CidChannelPair to the set only if it is not in it already.

Jump to

Keyboard shortcuts

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