Documentation ¶
Index ¶
- func NewLogger(w io.Writer) *logger
- type Buffer
- type ConcurrentBuffer
- func (cb *ConcurrentBuffer) Bytes() []byte
- func (cb *ConcurrentBuffer) Close()
- func (cb *ConcurrentBuffer) DumpBytes() []byte
- func (cb *ConcurrentBuffer) IsOpen() bool
- func (cb *ConcurrentBuffer) Open()
- func (cb *ConcurrentBuffer) Signal()
- func (cb *ConcurrentBuffer) Signals() <-chan struct{}
- func (cb *ConcurrentBuffer) Wait()
- type Logger
- type Packet
- type Request
- type RequestMap
- type Runner
- type SocketType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ConcurrentBuffer ¶
func NewConcurrentBuffer ¶
func NewConcurrentBuffer(size uint) *ConcurrentBuffer
func (*ConcurrentBuffer) Bytes ¶
func (cb *ConcurrentBuffer) Bytes() []byte
func (*ConcurrentBuffer) Close ¶
func (cb *ConcurrentBuffer) Close()
func (*ConcurrentBuffer) DumpBytes ¶
func (cb *ConcurrentBuffer) DumpBytes() []byte
func (*ConcurrentBuffer) IsOpen ¶
func (cb *ConcurrentBuffer) IsOpen() bool
func (*ConcurrentBuffer) Open ¶
func (cb *ConcurrentBuffer) Open()
func (*ConcurrentBuffer) Signal ¶
func (cb *ConcurrentBuffer) Signal()
func (*ConcurrentBuffer) Signals ¶
func (cb *ConcurrentBuffer) Signals() <-chan struct{}
func (*ConcurrentBuffer) Wait ¶
func (cb *ConcurrentBuffer) Wait()
type Logger ¶
type Logger interface { Debug(...interface{}) Log(...interface{}) Info(...interface{}) Error(...interface{}) Warn(...interface{}) }
type Packet ¶
type RequestMap ¶
TODO(derrandz): This structure is called a `RequestMap`, but is using a slice and therefore does not take advantage of the o(1) slice indexing.
func NewRequestMap ¶
func NewRequestMap(cap uint) *RequestMap
func (*RequestMap) Delete ¶
func (rm *RequestMap) Delete(nonce uint32) bool
func (*RequestMap) Find ¶
func (rm *RequestMap) Find(nonce uint32) (uint32, chan Packet, bool)
Nonces are like IDs. Each generated Request is identified by an ID, so that if a peer makes a request (i.e. generates a work channel that is identified by ID) it can listen on responses coming from the network that have this nonce/ID. It can then redirect this this response to the proper workChannel, since the peer has kept this channel open (and blocking) to receive the response. This is how we achieve a SEND/ACK behavior in our p2p module.
func (*RequestMap) Get ¶
func (rm *RequestMap) Get() *Request
Retrieves a new one request instance with a fresh new nonce. This is a factory function/method. The nonce is monotonically increasing with every .Get
func (*RequestMap) Len ¶
func (rm *RequestMap) Len() int
func (*RequestMap) Requests ¶
func (rm *RequestMap) Requests() []*Request
type SocketType ¶
type SocketType string
const ( Outbound SocketType = "outbound" Inbound SocketType = "inbound" UndefinedSocketType SocketType = "unspecified" )