Documentation ¶
Index ¶
- Constants
- Variables
- type BufferedReader
- type ChannelID
- type ChannelManager
- type Conn
- type ConnOptions
- type FastReply
- type GoAway
- type Message
- type MessageData
- type MessageDraft
- type MessageStream
- type Parser
- type ParserChannelOptions
- type ParserChannelResult
- type ParserOptions
- type ParserResult
- type Producer
- type ProducerWithRequest
- type Request
- type Response
- type Server
- type ServerOptions
- type Uint12
- type Uint24
- type Uint48
- type Writer
- type WriterOptions
Constants ¶
View Source
const ( MaxUint4 = 15 MaxUint8 = 255 MaxUint12 = 4095 MaxUint16 = 65_535 MaxUint24 = 16_777_215 MaxUint32 = 4_294_967_295 MaxUint48 = 281_474_976_710_655 )
View Source
const (
DefaultReadBufferSize = 4_096
)
View Source
const (
MaxChannels = maxChannelId + 1
)
Variables ¶
View Source
var ErrNotReady = errors.New("stream reader source has not enough bytes")
View Source
var ErrServerClosed = errors.New("server closed")
Functions ¶
This section is empty.
Types ¶
type BufferedReader ¶
type ChannelManager ¶
type ChannelManager interface { Current() ChannelID // not thread-safe Is(id ChannelID) bool // not thread-safe SetCurrent(channel ChannelID) // not thread-safe GetFree() ChannelID // not thread-safe Reserve() ChannelID Release(channel ChannelID) }
func NewChannelManager ¶
func NewChannelManager(channelsCount uint16) ChannelManager
type Conn ¶
type Conn interface { LocalAddr() net.Addr RemoteAddr() net.Addr Request(p ProducerWithRequest) Request Pass(p Producer) error Close() error ReadDone() <-chan struct{} ConnectionClosed() <-chan struct{} Done() <-chan struct{} Messages() <-chan Message Responses() <-chan Response FastReplies() <-chan FastReply }
func DialContext ¶
func NewConn ¶
func NewConn(parentCtx context.Context, rw io.ReadWriteCloser, options *ConnOptions) (Conn, error)
type ConnOptions ¶
type Message ¶
type Message interface { Id() uuid.UUID Action() string DataSize() uint64 TotalFilesSize() uint64 FilesCount() uint32 ExpectsResponse() bool Stream() MessageStream Data() MessageData }
type MessageData ¶
type MessageDraft ¶
func NewMessageDraft ¶
func NewMessageDraft(action string) *MessageDraft
func (*MessageDraft) NoStream ¶
func (m *MessageDraft) NoStream() *MessageDraft
func (*MessageDraft) PassTo ¶
func (m *MessageDraft) PassTo(c Conn) error
func (*MessageDraft) RawData ¶
func (m *MessageDraft) RawData(data []byte) *MessageDraft
func (*MessageDraft) RequestTo ¶
func (m *MessageDraft) RequestTo(c Conn) Request
func (*MessageDraft) Stream ¶
func (m *MessageDraft) Stream() *MessageDraft
type Parser ¶
type Parser interface {
Read() (ParserResult, error)
}
type ParserChannelOptions ¶
type ParserChannelOptions struct { }
type ParserChannelResult ¶
type ParserChannelResult interface { message | Response }
type ParserOptions ¶
type ParserResult ¶
type ProducerWithRequest ¶
type ProducerWithRequest interface {
// contains filtered or unexported methods
}
type Request ¶
type Request interface { Id() uuid.UUID Stream() io.WriteCloser Send() error Initiated() <-chan struct{} Done() <-chan struct{} }
type Server ¶
type Server interface { Listen(network string, address string) error ListenContext(context context.Context, network string, address string) error Close() error Accept() (Conn, error) Next() <-chan Conn Done() <-chan struct{} }
func NewServer ¶
func NewServer(options *ServerOptions) Server
type ServerOptions ¶
type ServerOptions struct { HandleError func(e error) // default: ignore errors TODO? Timeout time.Duration // default: none TODO? Channels uint16 // default: max WriteChannels uint16 // default: max ReadBufferSize uint32 // per connection, default: 4096 BufferedMessages uint16 // per connection, default: 0 }
type Writer ¶
type Writer interface { ObtainChannel() ChannelID ReleaseChannel(channel ChannelID) WriteRaw(data []byte) error WriteStandalone(p packet) error Write(p packet) error WriteAndObtainChannel(p packet) (ChannelID, error) WriteRawAtChannel(channel ChannelID, data []byte) error WriteAtChannel(channel ChannelID, p packet) error WriteAndReleaseChannel(channel ChannelID, p packet) error WriteExternalWithSignatureAtChannel(channel ChannelID, signature uint8, data []byte) error }
type WriterOptions ¶
type WriterOptions struct {
Channels uint16
}
Source Files ¶
Click to show internal directories.
Click to hide internal directories.