Documentation ¶
Index ¶
- Constants
- Variables
- func Bytes2str(b []byte) (s string)
- func CountByteBuffer() int
- func RandAlphabetic(n int) (s string)
- func RandAlphanumeric(n int) (s string)
- func RandFloat64() (v float64)
- func RandIntn(n int) (v int)
- func ReturnByteBuffer(b *ByteBuff)
- func Str2bytes(s string) []byte
- func TraceByteBuffLeak(ctx context.Context, duration time.Duration) error
- type ByteBuff
- func (p *ByteBuff) Bytes() []byte
- func (p *ByteBuff) Len() (n int)
- func (p *ByteBuff) Reset()
- func (p *ByteBuff) Write(bs []byte) (n int, err error)
- func (p *ByteBuff) WriteByte(b byte) error
- func (p *ByteBuff) WriteTo(w io.Writer) (n int64, err error)
- func (p *ByteBuff) WriteUint24(n int) (err error)
- type ErrorCode
- type Uint24
- type Version
Constants ¶
View Source
const ( // DefaultKeepaliveInteval is default keepalive interval duration. DefaultKeepaliveInteval = 20 * time.Second // DefaultKeepaliveMaxLifetime is default keepalive max lifetime. DefaultKeepaliveMaxLifetime = 90 * time.Second )
View Source
const MaxUint24 = 16777215
MaxUint24 is the max value of Uint24.
Variables ¶
View Source
var ( ErrFrameLengthExceed = errors.New("rsocket: frame length is greater than 24bits") ErrInvalidTransport = errors.New("rsocket: invalid Transport") ErrInvalidFrame = errors.New("rsocket: invalid frame") ErrInvalidContext = errors.New("rsocket: invalid context") ErrInvalidFrameLength = errors.New("rsocket: invalid frame length") ErrReleasedResource = errors.New("rsocket: resource has been released") ErrInvalidEmitter = errors.New("rsocket: invalid emitter") ErrHandlerNil = errors.New("rsocket: handler cannot be nil") ErrHandlerExist = errors.New("rsocket: handler exists already") ErrSendFull = errors.New("rsocket: frame send channel is full") )
Error defines.
Functions ¶
func CountByteBuffer ¶
func CountByteBuffer() int
CountByteBuffer returns amount of ByteBuff borrowed.
func RandAlphabetic ¶
RandAlphabetic returns a string with random alphabets.
func RandAlphanumeric ¶
RandAlphanumeric returns a string with random alphabets and numbers.
Types ¶
type ByteBuff ¶
type ByteBuff bytebufferpool.ByteBuffer
ByteBuff provides byte buffer, which can be used for minimizing.
func BorrowByteBuffer ¶
func BorrowByteBuffer() (bb *ByteBuff)
BorrowByteBuffer borrows a ByteBuff from pool.
func (*ByteBuff) WriteUint24 ¶
WriteUint24 encode and write Uint24 to current ByteBuff.
type ErrorCode ¶
type ErrorCode uint32
ErrorCode is code for RSocket error.
const ( // ErrorCodeInvalidSetup means the setup frame is invalid for the server. ErrorCodeInvalidSetup ErrorCode = 0x00000001 // ErrorCodeUnsupportedSetup means some (or all) of the parameters specified by the client are unsupported by the server. ErrorCodeUnsupportedSetup ErrorCode = 0x00000002 // ErrorCodeRejectedSetup means server rejected the setup, it can specify the reason in the payload. ErrorCodeRejectedSetup ErrorCode = 0x00000003 // ErrorCodeRejectedResume means server rejected the resume, it can specify the reason in the payload. ErrorCodeRejectedResume ErrorCode = 0x00000004 // ErrorCodeConnectionError means the connection is being terminated. ErrorCodeConnectionError ErrorCode = 0x00000101 // ErrorCodeConnectionClose means the connection is being terminated. ErrorCodeConnectionClose ErrorCode = 0x00000102 // ErrorCodeApplicationError means application layer logic generating a Reactive Streams onError event. ErrorCodeApplicationError ErrorCode = 0x00000201 // ErrorCodeRejected means Responder reject it. ErrorCodeRejected ErrorCode = 0x00000202 // ErrorCodeCanceled means the Responder canceled the request but may have started processing it (similar to REJECTED but doesn't guarantee lack of side-effects). ErrorCodeCanceled ErrorCode = 0x00000203 // ErrorCodeInvalid means the request is invalid. ErrorCodeInvalid ErrorCode = 0x00000204 )
type Uint24 ¶
type Uint24 [3]byte
Uint24 is 3 bytes unsigned integer.
func NewUint24Bytes ¶
NewUint24Bytes returns a new uint24 from bytes.
Click to show internal directories.
Click to hide internal directories.