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) Truncate(size int, reserved int) (*BufferEntity, error)
- func (reader *BufferArray) Write(b []byte) (int, error)
- type BufferEntity
- func (buffer *BufferEntity) Append(b []byte)
- func (buffer *BufferEntity) Data() []byte
- func (buffer *BufferEntity) Dump(b []byte) (int, bool)
- func (buffer *BufferEntity) Grow(n int)
- func (buffer *BufferEntity) Load(b []byte)
- func (buffer *BufferEntity) Read(b []byte) (int, error)
- func (buffer *BufferEntity) SegWriteTo(w io.Writer, segSize int) (int64, error)
- func (buffer *BufferEntity) Swap(b []byte) []byte
- func (buffer *BufferEntity) Write(b []byte) (int, error)
- func (buffer *BufferEntity) WriteTo(w io.Writer) (int64, error)
- type BufferIO
- type ExtendConn
- type KeepAliveSupport
- type PerformanceCounterReporter
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func DrainChannel ¶
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 ¶
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 ¶
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 ¶
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) Truncate ¶ added in v0.3.4
func (reader *BufferArray) Truncate(size int, reserved int) (*BufferEntity, error)
func (*BufferArray) Write ¶
func (reader *BufferArray) Write(b []byte) (int, error)
type BufferEntity ¶
func GetBufferEntity ¶
func GetBufferEntity() *BufferEntity
func GetBufferEntityWithAtLeastCapacity ¶
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) Grow ¶ added in v0.2.43
func (buffer *BufferEntity) Grow(n int)
func (*BufferEntity) Load ¶
func (buffer *BufferEntity) Load(b []byte)
Performs a copy of `b` and reset read status.
func (*BufferEntity) Read ¶ added in v0.2.43
func (buffer *BufferEntity) Read(b []byte) (int, error)
func (*BufferEntity) SegWriteTo ¶ added in v0.3.0
func (*BufferEntity) Swap ¶
func (buffer *BufferEntity) Swap(b []byte) []byte
func (*BufferEntity) Write ¶
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 ¶
func CreateAsyncChannel(Context context.Context, Raw io.ReadWriteCloser, MaxEntitySize, QueueLength, ReservedStartOffset int) BufferIO
Creates an async channel to buffer data into packets. This provides pipeline functionality for faster packet processing, however, it cannot be used for streaming read. HTTP server will set past deadline to perform a "read flush" operation for future connection reuse, this will close the Async channel direclty.
type ExtendConn ¶
type ExtendConn interface { net.Conn BufferIO KeepAliveSupport PerformanceCounterReporter }
type KeepAliveSupport ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.