network

package
v0.9.4 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2021 License: Apache-2.0 Imports: 38 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SecureSuiteUnknown = iota
	SecureSuiteNone
	SecureSuiteTls
	SecureSuiteEcdhe
)
View Source
const (
	SecureAeadSuiteUnknown = iota
	SecureAeadSuiteChaCha20Poly1305
	SecureAeadSuiteAes128Gcm
	SecureAeadSuiteAes256Gcm
)
View Source
const (
	SecureErrorNone        = ""
	SecureErrorInvalid     = "invalid"
	SecureErrorEstablished = "established"
)
View Source
const (
	AlreadyListenedError = errors.CodeNetwork + iota
	AlreadyClosedError
	AlreadyDialingError
	AlreadyRegisteredReactorError
	AlreadyRegisteredProtocolError
	NotRegisteredReactorError
	NotRegisteredProtocolError
	NotRegisteredRoleError
	NotAuthorizedError
	NotAvailableError
	NotStartedError
	QueueOverflowError
	DuplicatedPacketError
	DuplicatedPeerError
)
View Source
const (
	DefaultTransportNet         = "tcp4"
	DefaultDialTimeout          = 5 * time.Second
	DefaultReceiveQueueSize     = 1000
	DefaultPacketBufferSize     = 4096 //bufio.defaultBufSize=4096
	DefaultPacketPayloadMax     = 1024 * 1024
	DefaultPacketPoolNumBucket  = 20
	DefaultPacketPoolBucketLen  = 500
	DefaultDiscoveryPeriod      = 2 * time.Second
	DefaultSeedPeriod           = 3 * time.Second
	DefaultMinSeed              = 1
	DefaultAlternateSendPeriod  = 1 * time.Second
	DefaultSendTimeout          = 5 * time.Second
	DefaultSendQueueMaxPriority = 7
	DefaultSendQueueSize        = 1000
	DefaultEventQueueSize       = 100
	DefaultFailureQueueSize     = 100
	DefaultPeerSendQueueSize    = 1000
	DefaultPeerPoolExpireSecond = 5
	DefaultUncleLimit           = 1
	DefaultChildrenLimit        = 10
	DefaultNephewLimit          = 10
	DefaultPacketRewriteLimit   = 10
	DefaultPacketRewriteDelay   = 100 * time.Millisecond
	DefaultRttAccuracy          = 10 * time.Millisecond
	DefaultFailureNodeMin       = 2
	DefaultSelectiveFloodingAdd = 1
	DefaultSimplePeerIDSize     = 4
	UsingSelectiveFlooding      = true
	DefaultDuplicatedPeerTime   = 1 * time.Second
	DefaultMaxRetryClose        = 10
)
View Source
const (
	LoggerFieldKeySubModule = "sub"
)

Variables

View Source
var (
	ErrAlreadyListened           = errors.NewBase(AlreadyListenedError, "AlreadyListened")
	ErrAlreadyClosed             = errors.NewBase(AlreadyClosedError, "AlreadyClosed")
	ErrAlreadyDialing            = errors.NewBase(AlreadyDialingError, "AlreadyDialing")
	ErrAlreadyRegisteredReactor  = errors.NewBase(AlreadyRegisteredReactorError, "AlreadyRegisteredReactor")
	ErrAlreadyRegisteredProtocol = errors.NewBase(AlreadyRegisteredProtocolError, "AlreadyRegisteredProtocol")
	ErrNotRegisteredReactor      = errors.NewBase(NotRegisteredReactorError, "NotRegisteredReactor")
	ErrNotRegisteredProtocol     = errors.NewBase(NotRegisteredProtocolError, "NotRegisteredProtocol")
	ErrNotRegisteredRole         = errors.NewBase(NotRegisteredRoleError, "NotRegisteredRole")
	ErrNotAuthorized             = errors.NewBase(NotAuthorizedError, "NotAuthorized")
	ErrNotAvailable              = errors.NewBase(NotAvailableError, "NotAvailable")
	ErrNotStarted                = errors.NewBase(NotStartedError, "NotStarted")
	ErrQueueOverflow             = errors.NewBase(QueueOverflowError, "QueueOverflow")
	ErrDuplicatedPacket          = errors.NewBase(DuplicatedPacketError, "DuplicatedPacket")
	ErrDuplicatedPeer            = errors.NewBase(DuplicatedPeerError, "DuplicatedPeer")
	ErrIllegalArgument           = errors.ErrIllegalArgument
)
View Source
var (
	PROTO_AUTH_KEY_REQ     = module.ProtocolInfo(0x0100)
	PROTO_AUTH_KEY_RESP    = module.ProtocolInfo(0x0200)
	PROTO_AUTH_SIGN_REQ    = module.ProtocolInfo(0x0300)
	PROTO_AUTH_SIGN_RESP   = module.ProtocolInfo(0x0400)
	PROTO_CHAN_JOIN_REQ    = module.ProtocolInfo(0x0500)
	PROTO_CHAN_JOIN_RESP   = module.ProtocolInfo(0x0600)
	PROTO_P2P_QUERY        = module.ProtocolInfo(0x0700)
	PROTO_P2P_QUERY_RESULT = module.ProtocolInfo(0x0800)
	PROTO_P2P_CONN_REQ     = module.ProtocolInfo(0x0900)
	PROTO_P2P_CONN_RESP    = module.ProtocolInfo(0x0A00)
	PROTO_P2P_RTT_REQ      = module.ProtocolInfo(0x0B00)
	PROTO_P2P_RTT_RESP     = module.ProtocolInfo(0x0C00)
)
View Source
var (
	DefaultSecureEllipticCurve = elliptic.P256()
	DefaultSecureSuites        = []SecureSuite{
		SecureSuiteNone,
		SecureSuiteTls,
		SecureSuiteEcdhe,
	}
	DefaultSecureAeadSuites = []SecureAeadSuite{
		SecureAeadSuiteChaCha20Poly1305,
		SecureAeadSuiteAes128Gcm,
		SecureAeadSuiteAes256Gcm,
	}
	DefaultSecureKeyLogWriter io.Writer
)
View Source
var (
	PROTO_CONTOL = module.ProtocolInfo(0x0000)
)

Functions

func ChannelOfNetID

func ChannelOfNetID(id int) string

func Inspect

func Inspect(c module.Chain, informal bool) map[string]interface{}

func NewBroadcastError

func NewBroadcastError(err error, bt module.BroadcastType) module.NetworkError

func NewManager

func NewManager(c module.Chain, nt module.NetworkTransport, trustSeeds string, roles ...module.Role) module.NetworkManager

func NewMulticastError

func NewMulticastError(err error, role module.Role) module.NetworkError

func NewPeerID

func NewPeerID(b []byte) module.PeerID

func NewPeerIDFromAddress

func NewPeerIDFromAddress(a module.Address) module.PeerID

func NewPeerIDFromPublicKey

func NewPeerIDFromPublicKey(k *crypto.PublicKey) module.PeerID

func NewPeerIDFromString

func NewPeerIDFromString(s string) module.PeerID

func NewTransport

func NewTransport(address string, w module.Wallet, l log.Logger) module.NetworkTransport

func NewUnicastError

func NewUnicastError(err error, id module.PeerID) module.NetworkError

Types

type Authenticator

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

func (*Authenticator) GetSecureAeads

func (a *Authenticator) GetSecureAeads(channel string) []SecureAeadSuite

func (*Authenticator) GetSecureSuites

func (a *Authenticator) GetSecureSuites(channel string) []SecureSuite

func (*Authenticator) SetSecureAeads

func (a *Authenticator) SetSecureAeads(channel string, sas []SecureAeadSuite) error

func (*Authenticator) SetSecureSuites

func (a *Authenticator) SetSecureSuites(channel string, ss []SecureSuite) error

func (*Authenticator) Signature

func (a *Authenticator) Signature(content []byte) []byte

func (*Authenticator) VerifySignature

func (a *Authenticator) VerifySignature(publicKey []byte, signature []byte, content []byte) (module.PeerID, error)

type BytesSet

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

func NewBytesSet

func NewBytesSet(size int) *BytesSet

func NewBytesSetFromBytes

func NewBytesSetFromBytes(b []byte, size int) (*BytesSet, []byte)

func (*BytesSet) Add

func (s *BytesSet) Add(b []byte) (r bool)

func (*BytesSet) Bytes

func (s *BytesSet) Bytes() []byte

func (*BytesSet) Contains

func (s *BytesSet) Contains(b []byte) bool

func (*BytesSet) Remove

func (s *BytesSet) Remove(b []byte) (r bool)

type ChannelNegotiator

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

Negotiation map<channel, map<protocolHandler.name, {protocol, []subProtocol}>>

type ChannelQueue

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

func (*ChannelQueue) Pop

func (q *ChannelQueue) Pop() context.Context

func (*ChannelQueue) Push

func (q *ChannelQueue) Push(c context.Context) bool

func (*ChannelQueue) Wait

func (q *ChannelQueue) Wait() <-chan context.Context

type Counter

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

TODO data-race mutex

func (*Counter) Close

func (c *Counter) Close() int

func (*Counter) String

func (c *Counter) String() string

type Dialer

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

func (*Dialer) Dial

func (d *Dialer) Dial(addr string) error

type Error

type Error struct {
	IsTemporary       bool
	Operation         string
	OperationArgument interface{}
	// contains filtered or unexported fields
}

func (*Error) Temporary

func (e *Error) Temporary() bool

func (*Error) Unwrap

func (e *Error) Unwrap() error

type JoinRequest

type JoinRequest struct {
	Channel string
	Addr    NetAddress
}

type JoinResponse

type JoinResponse struct {
	Channel string
	Addr    NetAddress
}

type Listener

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

func (*Listener) Address

func (l *Listener) Address() string

func (*Listener) Close

func (l *Listener) Close() error

func (*Listener) Listen

func (l *Listener) Listen() error

func (*Listener) SetAddress

func (l *Listener) SetAddress(address string) error

type NetAddress

type NetAddress string

func (NetAddress) Validate added in v0.9.1

func (na NetAddress) Validate() error

type NetAddressSet

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

func NewNetAddressSet

func NewNetAddressSet() *NetAddressSet

func (*NetAddressSet) Add

func (s *NetAddressSet) Add(a NetAddress) bool

func (*NetAddressSet) Array

func (s *NetAddressSet) Array() []NetAddress

func (*NetAddressSet) Clear

func (s *NetAddressSet) Clear()

func (*NetAddressSet) ClearAndAdd

func (s *NetAddressSet) ClearAndAdd(args ...NetAddress)

func (*NetAddressSet) Contains

func (s *NetAddressSet) Contains(a NetAddress) bool

func (*NetAddressSet) ContainsByPeer

func (s *NetAddressSet) ContainsByPeer(p *Peer) bool

func (*NetAddressSet) Map

func (s *NetAddressSet) Map() map[NetAddress]string

func (*NetAddressSet) Merge

func (s *NetAddressSet) Merge(args ...NetAddress)

func (*NetAddressSet) PutByPeer

func (s *NetAddressSet) PutByPeer(p *Peer) (old string, removed NetAddress)

func (*NetAddressSet) RemoveByPeer

func (s *NetAddressSet) RemoveByPeer(p *Peer) bool

type P2PConnectionRequest

type P2PConnectionRequest struct {
	ConnType PeerConnectionType
}

TODO timestamp or sequencenumber for validation (request,response pair)

type P2PConnectionResponse

type P2PConnectionResponse struct {
	ReqConnType PeerConnectionType
	ConnType    PeerConnectionType
}

type Packet

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

srcPeerId, castType, destInfo, TTL(0:unlimited)

func NewPacket

func NewPacket(pi module.ProtocolInfo, spi module.ProtocolInfo, payload []byte) *Packet

func (*Packet) Len

func (p *Packet) Len() int64

func (*Packet) ReadFrom

func (p *Packet) ReadFrom(r io.Reader) (n int64, err error)

func (*Packet) String

func (p *Packet) String() string

func (*Packet) WriteTo

func (p *Packet) WriteTo(w io.Writer) (n int64, err error)

type PacketPool

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

func NewPacketPool

func NewPacketPool(numOfBucket uint8, lenOfBucket uint16) *PacketPool

func (*PacketPool) Clear

func (p *PacketPool) Clear()

func (*PacketPool) Contains

func (p *PacketPool) Contains(pkt *Packet) bool

func (*PacketPool) Put

func (p *PacketPool) Put(pkt *Packet) bool

type PacketReadWriter

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

func NewPacketReadWriter

func NewPacketReadWriter() *PacketReadWriter

func (*PacketReadWriter) ReadPacket

func (prw *PacketReadWriter) ReadPacket() (*Packet, error)

func (*PacketReadWriter) Reset

func (prw *PacketReadWriter) Reset(rd io.Reader, wr io.Writer)

func (*PacketReadWriter) WritePacket

func (prw *PacketReadWriter) WritePacket(pkt *Packet) error

type PacketReader

type PacketReader struct {
	*bufio.Reader
	// contains filtered or unexported fields
}

func NewPacketReader

func NewPacketReader(rd io.Reader) *PacketReader

NewReader returns a new Reader whose buffer has the default size.

func (*PacketReader) ReadPacket

func (pr *PacketReader) ReadPacket() (pkt *Packet, e error)

func (*PacketReader) Reset

func (pr *PacketReader) Reset(rd io.Reader)

type PacketWriter

type PacketWriter struct {
	*bufio.Writer
	// contains filtered or unexported fields
}

func NewPacketWriter

func NewPacketWriter(w io.Writer) *PacketWriter

func (*PacketWriter) Flush

func (pw *PacketWriter) Flush() error

func (*PacketWriter) Reset

func (pw *PacketWriter) Reset(wr io.Writer)

func (*PacketWriter) Write

func (pw *PacketWriter) Write(b []byte) (int, error)

func (*PacketWriter) WritePacket

func (pw *PacketWriter) WritePacket(pkt *Packet) error

type Peer

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

func (*Peer) Close

func (p *Peer) Close(reason string) error

func (*Peer) CloseByError

func (p *Peer) CloseByError(err error) error

func (*Peer) CloseInfo

func (p *Peer) CloseInfo() string

func (*Peer) ConnString

func (p *Peer) ConnString() string

func (*Peer) ID

func (p *Peer) ID() module.PeerID

func (*Peer) IsClosed added in v0.9.2

func (p *Peer) IsClosed() bool

func (*Peer) NetAddress

func (p *Peer) NetAddress() NetAddress

func (*Peer) ResetConn

func (p *Peer) ResetConn(conn net.Conn)

func (*Peer) String

func (p *Peer) String() string

type PeerConnectionType

type PeerConnectionType byte

type PeerDispatcher

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

type PeerHandler

type PeerHandler interface {
	// contains filtered or unexported methods
}

type PeerIDSet

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

func NewPeerIDSet

func NewPeerIDSet() *PeerIDSet

func NewPeerIDSetFromBytes

func NewPeerIDSetFromBytes(b []byte) (*PeerIDSet, []byte)

func (*PeerIDSet) Add

func (s *PeerIDSet) Add(id module.PeerID) (r bool)

func (*PeerIDSet) Array

func (s *PeerIDSet) Array() []module.PeerID

func (*PeerIDSet) Bytes

func (s *PeerIDSet) Bytes() []byte

func (*PeerIDSet) ClearAndAdd

func (s *PeerIDSet) ClearAndAdd(args ...module.PeerID)

func (*PeerIDSet) Contains

func (s *PeerIDSet) Contains(id module.PeerID) bool

func (*PeerIDSet) Merge

func (s *PeerIDSet) Merge(args ...module.PeerID)

func (*PeerIDSet) Remove

func (s *PeerIDSet) Remove(id module.PeerID) (r bool)

func (*PeerIDSet) Removes

func (s *PeerIDSet) Removes(args ...module.PeerID)

type PeerPredicate added in v0.9.2

type PeerPredicate func(*Peer) bool

type PeerRTT

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

func NewPeerRTT

func NewPeerRTT() *PeerRTT

func (*PeerRTT) Avg

func (r *PeerRTT) Avg(d time.Duration) float64

func (*PeerRTT) Last

func (r *PeerRTT) Last(d time.Duration) float64

func (*PeerRTT) Start

func (r *PeerRTT) Start() time.Time

func (*PeerRTT) Stop

func (r *PeerRTT) Stop() time.Time

func (*PeerRTT) String

func (r *PeerRTT) String() string

type PeerRoleFlag

type PeerRoleFlag byte

PeerRoleFlag as BitFlag MSB[_,_,_,_,_,_,Root,Seed]LSB

func (*PeerRoleFlag) Has

func (pr *PeerRoleFlag) Has(o PeerRoleFlag) bool

func (*PeerRoleFlag) SetFlag

func (pr *PeerRoleFlag) SetFlag(o PeerRoleFlag)

func (*PeerRoleFlag) ToRoles

func (pr *PeerRoleFlag) ToRoles() []module.Role

func (*PeerRoleFlag) UnSetFlag

func (pr *PeerRoleFlag) UnSetFlag(o PeerRoleFlag)

type PeerSet

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

func NewPeerSet

func NewPeerSet() *PeerSet

func (*PeerSet) Add

func (s *PeerSet) Add(p *Peer) bool

func (*PeerSet) AddWithPredicate added in v0.9.2

func (s *PeerSet) AddWithPredicate(p *Peer, f PeerPredicate) bool

func (*PeerSet) Array

func (s *PeerSet) Array() []*Peer

func (*PeerSet) Clear

func (s *PeerSet) Clear()

func (*PeerSet) Contains

func (s *PeerSet) Contains(p *Peer) bool

func (*PeerSet) Find

func (s *PeerSet) Find(foundFunc func(p *Peer) bool) []*Peer

func (*PeerSet) GetBy

func (s *PeerSet) GetBy(role PeerRoleFlag, has bool, in bool) []*Peer

func (*PeerSet) GetByID

func (s *PeerSet) GetByID(id module.PeerID) *Peer

func (*PeerSet) GetByRole

func (s *PeerSet) GetByRole(r PeerRoleFlag, has bool) []*Peer

func (*PeerSet) HasNetAddresse

func (s *PeerSet) HasNetAddresse(a NetAddress) bool

func (*PeerSet) HasNetAddresseAndIncomming

func (s *PeerSet) HasNetAddresseAndIncomming(a NetAddress, in bool) bool

func (*PeerSet) Merge

func (s *PeerSet) Merge(args ...*Peer)

func (*PeerSet) NetAddresses

func (s *PeerSet) NetAddresses() []NetAddress

func (*PeerSet) Remove

func (s *PeerSet) Remove(p *Peer) bool

type PeerToPeer

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

func (*PeerToPeer) IsStarted

func (p2p *PeerToPeer) IsStarted() bool

func (*PeerToPeer) Send

func (p2p *PeerToPeer) Send(pkt *Packet) error

func (*PeerToPeer) Start

func (p2p *PeerToPeer) Start()

func (*PeerToPeer) Stop

func (p2p *PeerToPeer) Stop()

type PriorityQueue

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

func NewPriorityQueue

func NewPriorityQueue(size int, maxPriority int) *PriorityQueue

func (*PriorityQueue) Available

func (q *PriorityQueue) Available(idx int) int

func (*PriorityQueue) Close

func (q *PriorityQueue) Close()

func (*PriorityQueue) Last

func (q *PriorityQueue) Last() context.Context

DEPRECATED

func (*PriorityQueue) Pop

func (q *PriorityQueue) Pop() context.Context

func (*PriorityQueue) Push

func (q *PriorityQueue) Push(c context.Context, idx int) bool

func (*PriorityQueue) Wait

func (q *PriorityQueue) Wait() <-chan bool

type QueryMessage

type QueryMessage struct {
	Role PeerRoleFlag
}

TODO timestamp or sequencenumber for validation (query,result pair)

type QueryResultMessage

type QueryResultMessage struct {
	Role     PeerRoleFlag
	Seeds    []NetAddress
	Roots    []NetAddress
	Children []NetAddress
	Nephews  []NetAddress
	Message  string
}

type Queue

type Queue interface {
	Push(ctx context.Context) bool
	Pop() context.Context
	Wait() <-chan bool
	Available() int
	Close()
}

func NewQueue

func NewQueue(size int) Queue

type RoleSet

type RoleSet struct {
	*Set
}

func NewRoleSet

func NewRoleSet() *RoleSet

type RttMessage

type RttMessage struct {
	Last    time.Duration
	Average time.Duration
}

type SecureAead

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

func (*SecureAead) Read

func (sa *SecureAead) Read(b []byte) (n int, err error)

func (*SecureAead) Write

func (sa *SecureAead) Write(b []byte) (n int, err error)

type SecureAeadSuite

type SecureAeadSuite byte

func SecureAeadSuiteFromString

func SecureAeadSuiteFromString(s string) SecureAeadSuite

func (SecureAeadSuite) String

func (s SecureAeadSuite) String() string

type SecureConn

type SecureConn struct {
	//*tls.Conn
	net.Conn
	// contains filtered or unexported fields
}

func NewSecureConn

func NewSecureConn(conn net.Conn, sa SecureAeadSuite, k *secureKey) (*SecureConn, error)

func (*SecureConn) Read

func (c *SecureConn) Read(b []byte) (n int, err error)

func (*SecureConn) Write

func (c *SecureConn) Write(b []byte) (n int, err error)

type SecureError

type SecureError string

type SecureRequest

type SecureRequest struct {
	Channel          string
	SecureSuites     []SecureSuite
	SecureAeadSuites []SecureAeadSuite
	SecureParam      []byte
}

type SecureResponse

type SecureResponse struct {
	Channel         string
	SecureSuite     SecureSuite
	SecureAeadSuite SecureAeadSuite
	SecureParam     []byte
	SecureError     SecureError
}

type SecureSuite

type SecureSuite byte

func SecureSuiteFromString

func SecureSuiteFromString(s string) SecureSuite

func (SecureSuite) String

func (s SecureSuite) String() string

type Set

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

func NewSet

func NewSet() *Set

func (*Set) Add

func (s *Set) Add(v interface{}) bool

func (*Set) Array

func (s *Set) Array() interface{}

Not ordered array

func (*Set) Clear

func (s *Set) Clear()

func (*Set) Contains

func (s *Set) Contains(v interface{}) bool

func (*Set) IsEmpty

func (s *Set) IsEmpty() bool

func (*Set) Len

func (s *Set) Len() int

func (*Set) Map

func (s *Set) Map() map[interface{}]interface{}

func (*Set) Merge

func (s *Set) Merge(args ...interface{})

func (*Set) Remove

func (s *Set) Remove(v interface{}) bool

func (*Set) Set

func (s *Set) Set(v interface{}, d interface{}) interface{}

func (*Set) String

func (s *Set) String() string

type SignatureRequest

type SignatureRequest struct {
	PublicKey []byte
	Signature []byte
	Rtt       time.Duration
}

type SignatureResponse

type SignatureResponse struct {
	PublicKey []byte
	Signature []byte
	Rtt       time.Duration
	Error     string
}

type TimestampPool

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

func NewTimestampPool

func NewTimestampPool(numOfBucket uint8) *TimestampPool

func (*TimestampPool) Clear

func (p *TimestampPool) Clear()

func (*TimestampPool) Contains

func (p *TimestampPool) Contains(k interface{}) bool

func (*TimestampPool) Put

func (p *TimestampPool) Put(k interface{})

func (*TimestampPool) RemoveBefore

func (p *TimestampPool) RemoveBefore(secondDuration int)

type WeightQueue

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

func NewWeightQueue

func NewWeightQueue(size int, nq int) *WeightQueue

func (*WeightQueue) Available

func (q *WeightQueue) Available(idx int) int

func (*WeightQueue) Close

func (q *WeightQueue) Close()

func (*WeightQueue) Pop

func (q *WeightQueue) Pop() context.Context

func (*WeightQueue) Push

func (q *WeightQueue) Push(c context.Context, idx int) bool

func (*WeightQueue) SetWeight

func (q *WeightQueue) SetWeight(idx int, weight int) error

func (*WeightQueue) Wait

func (q *WeightQueue) Wait() <-chan bool

Jump to

Keyboard shortcuts

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