Documentation
¶
Index ¶
- Constants
- func AppendPrettyHexDump(dump *strings.Builder, b []byte)
- func CloneBytes(b []byte) []byte
- func CountBorrowed() int64
- func IsExceedMaximumUint24Error(err error) bool
- func IsNegativeUint24Error(err error) bool
- func PrettyHexDump(b []byte) string
- func RandAlphabetic(n int) (s string)
- func RandAlphanumeric(n int) (s string)
- func RandFloat64() (v float64)
- func RandIntn(n int) (v int)
- func ReturnByteBuff(b *ByteBuff)
- func SafeCloseDoneChan(c chan<- struct{}) (ok bool)
- func TryRelease(input interface{})
- type ByteBuff
- func (b *ByteBuff) Bytes() []byte
- func (b *ByteBuff) Len() (n int)
- func (b *ByteBuff) Reset()
- func (b *ByteBuff) Write(bs []byte) (int, error)
- func (b *ByteBuff) WriteByte(c byte) error
- func (b *ByteBuff) WriteString(s string) (err error)
- func (b *ByteBuff) WriteTo(w io.Writer) (int64, error)
- func (b *ByteBuff) WriteUint24(n int) (err error)
- type Cond
- type Releasable
- type Uint24
Constants ¶
const ( // DefaultKeepaliveInterval is default keepalive interval duration. DefaultKeepaliveInterval = 20 * time.Second // DefaultKeepaliveMaxLifetime is default keepalive max lifetime. DefaultKeepaliveMaxLifetime = 90 * time.Second )
const MaxUint24 = 16777215
MaxUint24 is the max value of Uint24.
Variables ¶
This section is empty.
Functions ¶
func AppendPrettyHexDump ¶ added in v0.6.0
AppendPrettyHexDump appends bytes to string builder.
func CloneBytes ¶ added in v0.7.0
func CountBorrowed ¶ added in v0.7.0
func CountBorrowed() int64
CountBorrowed returns borrowed ByteBuff amount.
func IsExceedMaximumUint24Error ¶ added in v0.6.0
IsExceedMaximumUint24Error returns true if exceed maximum Uint24. (16777215)
func IsNegativeUint24Error ¶ added in v0.6.0
IsNegativeUint24Error returns true if number is negative.
func PrettyHexDump ¶ added in v0.6.0
PrettyHexDump converts bytes to pretty hex dump string.
func RandAlphabetic ¶
RandAlphabetic returns a string with random alphabets.
func RandAlphanumeric ¶
RandAlphanumeric returns a string with random alphabets and numbers.
func ReturnByteBuff ¶ added in v0.7.0
func ReturnByteBuff(b *ByteBuff)
ReturnByteBuff returns a ByteBuff to pool.
func SafeCloseDoneChan ¶ added in v0.7.0
func SafeCloseDoneChan(c chan<- struct{}) (ok bool)
func TryRelease ¶ added in v0.7.0
func TryRelease(input interface{})
Types ¶
type ByteBuff ¶
type ByteBuff bytebufferpool.ByteBuffer
ByteBuff provides byte buffer, which can be used for minimizing.
func BorrowByteBuff ¶ added in v0.7.0
func BorrowByteBuff() *ByteBuff
BorrowByteBuff borrows a ByteBuff from pool.
func (*ByteBuff) WriteString ¶ added in v0.6.0
WriteString writes a string to current ByteBuff.
func (*ByteBuff) WriteUint24 ¶
WriteUint24 encode and write Uint24 to current ByteBuff.
type Cond ¶ added in v0.6.0
Cond is a customized Cond which support context. See https://gist.github.com/zviadm/c234426882bfc8acba88f3503edaaa36#file-cond2-go
func (*Cond) NotifyChan ¶ added in v0.6.0
func (c *Cond) NotifyChan() <-chan struct{}
NotifyChan returns readonly notify chan.
type Releasable ¶ added in v0.7.0
type Releasable interface {
Release()
}
type Uint24 ¶
type Uint24 [3]byte
Uint24 is 3 bytes unsigned integer.
func MustNewUint24 ¶ added in v0.6.0
MustNewUint24 returns a new uint24.
func NewUint24Bytes ¶
NewUint24Bytes returns a new uint24 from bytes.