Documentation
¶
Index ¶
- Constants
- Variables
- func CoarseTimeNow() time.Time
- func SetWorkerPool(p *Pool)
- type Addr
- type NonBlockingConn
- func (c *NonBlockingConn) Close() error
- func (c *NonBlockingConn) File() (*os.File, error)
- func (c *NonBlockingConn) LocalAddr() net.Addr
- func (c *NonBlockingConn) Read(b []byte) (n int, err error)
- func (c *NonBlockingConn) RemoteAddr() net.Addr
- func (c *NonBlockingConn) SetDeadline(t time.Time) error
- func (c *NonBlockingConn) SetReadDeadline(t time.Time) error
- func (c *NonBlockingConn) SetWriteDeadline(t time.Time) error
- func (c *NonBlockingConn) Write(b []byte) (n int, err error)
- type Pool
- type Server
- type Socket
- func (s *Socket) Close() error
- func (s *Socket) Flush()
- func (s *Socket) IsActive() bool
- func (s *Socket) Listen() error
- func (s *Socket) OnClose(onClose func()) *Socket
- func (s *Socket) OnReadable(onReadable func()) *Socket
- func (s *Socket) Read(b []byte) (n int, err error)
- func (s *Socket) Write(b []byte) (n int, err error)
Constants ¶
View Source
const DefaultBuffSize = 16 * 1024
View Source
const DefaultPoolSize = 256 * 1024
Variables ¶
View Source
var ErrScheduleTimeout = fmt.Errorf("schedule error: timed out")
ErrScheduleTimeout returned by Pool to indicate that there no free goroutines during some period of time.
Functions ¶
func CoarseTimeNow ¶
CoarseTimeNow returns the current time truncated to the nearest second.
This is a faster alternative to time.Now().
func SetWorkerPool ¶
func SetWorkerPool(p *Pool)
Types ¶
type NonBlockingConn ¶
type NonBlockingConn struct {
// contains filtered or unexported fields
}
func (*NonBlockingConn) Close ¶
func (c *NonBlockingConn) Close() error
func (*NonBlockingConn) LocalAddr ¶
func (c *NonBlockingConn) LocalAddr() net.Addr
func (*NonBlockingConn) RemoteAddr ¶
func (c *NonBlockingConn) RemoteAddr() net.Addr
func (*NonBlockingConn) SetDeadline ¶
func (c *NonBlockingConn) SetDeadline(t time.Time) error
func (*NonBlockingConn) SetReadDeadline ¶
func (c *NonBlockingConn) SetReadDeadline(t time.Time) error
func (*NonBlockingConn) SetWriteDeadline ¶
func (c *NonBlockingConn) SetWriteDeadline(t time.Time) error
type Pool ¶
type Pool struct {
// contains filtered or unexported fields
}
Pool contains logic of goroutine reuse.
func NewPool ¶
NewPool creates new goroutine pool with given size. It also creates a work queue of given size. Finally, it spawns given amount of goroutines immediately.
Source Files
¶
Directories
¶
Path | Synopsis |
---|---|
example
|
|
Package tcplisten provides customizable TCP net.Listener with various performance-related options: - SO_REUSEPORT.
|
Package tcplisten provides customizable TCP net.Listener with various performance-related options: - SO_REUSEPORT. |
Click to show internal directories.
Click to hide internal directories.