Documentation ¶
Index ¶
- Variables
- func DrainChannel(arrayChan chan *BufferArray)
- func GetExtensionProperty(conn net.Conn) map[string]uint64
- func GrowBufferWithZeroPadding(b []byte, size int) []byte
- func IsConnClosed(conn net.Conn) bool
- func PushToChannelMayEviction(ctx context.Context, channel chan *BufferArray, data *BufferArray, ...) error
- func PutBufferArray(ba *BufferArray)
- func PutBufferEntity(b *BufferEntity)
- func Relay(RuntimeContext context.Context, peerA io.ReadWriteCloser, ...) error
- func SupportsKeepAlive(conn net.Conn) bool
- type BufferArray
- func (reader *BufferArray) Data() [][]byte
- func (reader *BufferArray) Discard(n int) (int, error)
- func (reader *BufferArray) MergeFrom(a *BufferArray)
- func (reader *BufferArray) Peek(capacity int) ([]byte, error)
- func (reader *BufferArray) Pop() *BufferEntity
- func (reader *BufferArray) Push(buffer *BufferEntity)
- func (reader *BufferArray) Read(b []byte) (int, error)
- func (reader *BufferArray) ReadByte() (byte, error)
- func (ba *BufferArray) Reset()
- func (reader *BufferArray) Stat() (totalBuckets int, totalBytes uint64)
- func (reader *BufferArray) Swap(b *BufferArray)
- func (reader *BufferArray) Write(b []byte) (int, error)
- type BufferEntity
- type BufferIO
- type ExtendConn
- type KeepAliveSupport
- type PerformanceCounterReporter
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func DrainChannel ¶ added in v0.2.25
func DrainChannel(arrayChan chan *BufferArray)
func PushToChannelMayEviction ¶
func PushToChannelMayEviction( ctx context.Context, channel chan *BufferArray, data *BufferArray, whenEvict func(ba *BufferArray), allowBestEffortEvict bool, ) error
func PutBufferArray ¶
func PutBufferArray(ba *BufferArray)
func PutBufferEntity ¶
func PutBufferEntity(b *BufferEntity)
func Relay ¶ added in v0.2.30
func Relay(RuntimeContext context.Context, peerA io.ReadWriteCloser, peerB io.ReadWriteCloser) error
Types ¶
type BufferArray ¶
type BufferArray struct {
// contains filtered or unexported fields
}
func GetBufferArray ¶
func GetBufferArray() *BufferArray
func ReceiveBatch ¶ added in v0.2.20
func ReceiveBatch(ctx context.Context, channel chan *BufferArray, idealEntityNum int) *BufferArray
Returns nil if ctx is done or channel is closed.
func (*BufferArray) Data ¶
func (reader *BufferArray) Data() [][]byte
Data is a reference to the buffer array.
func (*BufferArray) Discard ¶
func (reader *BufferArray) Discard(n int) (int, error)
func (*BufferArray) MergeFrom ¶
func (reader *BufferArray) MergeFrom(a *BufferArray)
Takes the ownership of `a`.
func (*BufferArray) Peek ¶ added in v0.2.22
func (reader *BufferArray) Peek(capacity int) ([]byte, error)
Returns next `capacity` bytes if current segment has enough bytes.
func (*BufferArray) Pop ¶
func (reader *BufferArray) Pop() *BufferEntity
func (*BufferArray) Push ¶
func (reader *BufferArray) Push(buffer *BufferEntity)
func (*BufferArray) Read ¶
func (reader *BufferArray) Read(b []byte) (int, error)
func (*BufferArray) ReadByte ¶
func (reader *BufferArray) ReadByte() (byte, error)
func (*BufferArray) Reset ¶
func (ba *BufferArray) Reset()
func (*BufferArray) Stat ¶
func (reader *BufferArray) Stat() (totalBuckets int, totalBytes uint64)
func (*BufferArray) Swap ¶
func (reader *BufferArray) Swap(b *BufferArray)
func (*BufferArray) Write ¶
func (reader *BufferArray) Write(b []byte) (int, error)
type BufferEntity ¶
func GetBufferEntity ¶
func GetBufferEntity() *BufferEntity
func GetBufferEntityWithAtLeastCapacity ¶ added in v0.2.20
func GetBufferEntityWithAtLeastCapacity(capacity int) *BufferEntity
func ReserveStartOffset ¶
func ReserveStartOffset(packet *BufferEntity, startOffset int) *BufferEntity
func (*BufferEntity) Append ¶
func (buffer *BufferEntity) Append(b []byte)
func (*BufferEntity) Data ¶
func (buffer *BufferEntity) Data() []byte
func (*BufferEntity) Dump ¶
func (buffer *BufferEntity) Dump(b []byte) (int, bool)
Writes data into `b`, returns if the buffer becomes empty.
func (*BufferEntity) Load ¶
func (buffer *BufferEntity) Load(b []byte)
Performs a copy of `b` and reset read status.
func (*BufferEntity) Swap ¶
func (buffer *BufferEntity) Swap(b []byte) []byte
func (*BufferEntity) Write ¶ added in v0.2.26
func (buffer *BufferEntity) Write(b []byte) (int, error)
type BufferIO ¶
type BufferIO interface { io.Closer // ConsumeBuffer consumes a buffer array. // This does not take the ownership of the array. ConsumeBuffer(bs *BufferArray) error ProduceBuffer(bs *BufferArray, reservedOffset int) error SupportBufferIO() bool }
func CreateAsyncChannel ¶
type ExtendConn ¶
type ExtendConn interface { net.Conn BufferIO KeepAliveSupport PerformanceCounterReporter }
type KeepAliveSupport ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.