util

package
v2.0.5-testnet Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2024 License: Apache-2.0, MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const MaxDKGsInFlight = 20

Variables

This section is empty.

Functions

func Concat

func Concat[T any](arrs ...[]T) []T

Concat combines multiple arrays of the same type into a single array

func Cont

func Cont[T comparable](haystack []T, needle T) bool

Cont is contains, but the util package already contains another func just for `Participant`

func Contains

func Contains(haystack []*drand.Participant, needle *drand.Participant) bool

func ContainsAll

func ContainsAll(haystack, needles []*drand.Participant) bool

func EqualParticipant

func EqualParticipant(p1, p2 *drand.Participant) bool

func ErrorContains

func ErrorContains(err error, str string) bool

func Filter

func Filter[T any](arr []T, predicate func(T) bool) []T

func First

func First[T any](haystack []T, predicate func(T) bool) (*T, error)

func NonEmpty

func NonEmpty(p *drand.Participant) bool

func ParseGroupFileBytes

func ParseGroupFileBytes(groupFileBytes []byte) (*key.Group, error)

func PublicKeyAsParticipant

func PublicKeyAsParticipant(identity *key.Identity) (*drand.Participant, error)

func SortedByPublicKey

func SortedByPublicKey(arr []*drand.Participant) []*drand.Participant

func ToKeyNode

func ToKeyNode(index int, participant *drand.Participant, sch *crypto.Scheme) (key.Node, error)

func ToNode

func ToNode(index int, participant *drand.Participant, sch *crypto.Scheme) (dkg.Node, error)

func ToParticipant

func ToParticipant(node *proto.Node) *drand.Participant

func ToPeer

func ToPeer(participant *drand.Participant) net.Peer

func TryMapEach

func TryMapEach[T any](arr []*drand.Participant, fn func(index int, participant *drand.Participant) (T, error)) ([]T, error)

func Without

func Without(haystack []*drand.Participant, needle *drand.Participant) []*drand.Participant

Types

type FanOutChan

type FanOutChan[T any] struct {
	// contains filtered or unexported fields
}

FanOutChan has one producer channel and multiple consumers for each message ont he channel

func NewFanOutChan

func NewFanOutChan[T any]() *FanOutChan[T]

func (*FanOutChan[T]) Chan

func (f *FanOutChan[T]) Chan() chan T

func (*FanOutChan[T]) Listen

func (f *FanOutChan[T]) Listen() chan T

Jump to

Keyboard shortcuts

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