Documentation ¶
Index ¶
- Constants
- Variables
- type Allocator
- type AllocatorStat
- type Buffer
- type DirectAllocateSizer
- type DirectAllocatorOptions
- type DirectAllocatorStat
- type Float32Buffer
- type Float64Buffer
- type Instrument
- type Int16Buffer
- type Int32Buffer
- type Int64Buffer
- type PooledAllocatorStat
- type Uint16Buffer
- type Uint32Buffer
- type Uint64Buffer
Constants ¶
View Source
const MinRead = 512
Variables ¶
Functions ¶
This section is empty.
Types ¶
type Allocator ¶
type Allocator interface { Allocate(capacity int) Buffer Release(instrument Instrument) error Stat() AllocatorStat }
func DirectAllocator ¶
func DirectAllocator(options ...DirectAllocatorOptions) Allocator
func PooledAllocator ¶
type AllocatorStat ¶
type Buffer ¶
type Buffer interface { // Instrument get the underlying instrument Instrument() Instrument // Clear clear marked indexes Clear() // Release release underlying instrument, this buffer can no longer be used Release() // Reset reset the buffer to its full capacity, means length = 0 Reset() // Clone clone an entire new buffer, with the same instrument implementation (different instance) Clone() Buffer // Cap returns current instrument allocated capacity Cap() int // Len current readable number of bytes Len() int // Grow grow capacity with at least this much more to write Grow(size int) // Ensure at least this much capacity Ensure(capacity int) // DiscardReadBytes discard already read bytes, this will reset marks and indexes DiscardReadBytes() // Bytes return all readable bytes Bytes() []byte // UnsafeBytes return all underlying bytes, this may contain discarded bytes UnsafeBytes() []byte // String return all readable as string String() string // ReaderIndex current reader index in memory ReaderIndex() int MarkReaderIndex() ResetReaderIndex() // WriterIndex current writer index in memory WriterIndex() int MarkWriterIndex() ResetWriterIndex() Read(p []byte) (int, error) Write(p []byte) (int, error) Get(index int, p []byte) (int, error) Set(index int, p []byte) (int, error) ReadFrom(r io.Reader) (int64, error) WriteTo(w io.Writer) (n int64, err error) ReadString(n int) (string, error) WriteString(s string) (int, error) ReadByte() (byte, error) WriteByte(b byte) error GetByte(index int) (byte, error) SetByte(index int, b byte) error Int16Buffer Uint16Buffer Int32Buffer Uint32Buffer Int64Buffer Uint64Buffer Float32Buffer Float64Buffer }
type DirectAllocateSizer ¶
type DirectAllocatorOptions ¶
type DirectAllocatorOptions func(*directAllocator)
func WithDirectMultiplier ¶
func WithDirectMultiplier(mul float64) DirectAllocatorOptions
func WithDirectSizer ¶
func WithDirectSizer(sizer DirectAllocateSizer) DirectAllocatorOptions
func WithDirectStepper ¶
func WithDirectStepper(step int) DirectAllocatorOptions
type DirectAllocatorStat ¶
type DirectAllocatorStat struct {
// contains filtered or unexported fields
}
func (DirectAllocatorStat) Count ¶
func (s DirectAllocatorStat) Count() int64
func (DirectAllocatorStat) Memory ¶
func (s DirectAllocatorStat) Memory() int64
type Float32Buffer ¶
type Float32Buffer interface { ReadFloat32() (float32, error) ReadFloat32LE() (float32, error) WriteFloat32(v float32) error WriteFloat32LE(v float32) error GetFloat32(index int) (float32, error) GetFloat32LE(index int) (float32, error) SetFloat32(index int, v float32) error SetFloat32LE(index int, v float32) error }
type Float64Buffer ¶
type Float64Buffer interface { ReadFloat64() (float64, error) ReadFloat64LE() (float64, error) WriteFloat64(v float64) error WriteFloat64LE(v float64) error GetFloat64(index int) (float64, error) GetFloat64LE(index int) (float64, error) SetFloat64(index int, v float64) error SetFloat64LE(index int, v float64) error }
type Instrument ¶
type Instrument interface {
// contains filtered or unexported methods
}
type Int16Buffer ¶
type Int32Buffer ¶
type Int64Buffer ¶
type PooledAllocatorStat ¶
type PooledAllocatorStat struct {
// contains filtered or unexported fields
}
func (PooledAllocatorStat) Count ¶
func (s PooledAllocatorStat) Count() int64
func (PooledAllocatorStat) Memory ¶
func (s PooledAllocatorStat) Memory() int64
func (PooledAllocatorStat) Pages ¶
func (s PooledAllocatorStat) Pages() int64
type Uint16Buffer ¶
type Uint16Buffer interface { ReadUint16() (uint16, error) ReadUint16LE() (uint16, error) WriteUint16(v uint16) error WriteUint16LE(v uint16) error GetUint16(index int) (uint16, error) GetUint16LE(index int) (uint16, error) SetUint16(index int, v uint16) error SetUint16LE(index int, v uint16) error }
type Uint32Buffer ¶
type Uint32Buffer interface { ReadUint32() (uint32, error) ReadUint32LE() (uint32, error) WriteUint32(v uint32) error WriteUint32LE(v uint32) error GetUint32(index int) (uint32, error) GetUint32LE(index int) (uint32, error) SetUint32(index int, v uint32) error SetUint32LE(index int, v uint32) error }
type Uint64Buffer ¶
type Uint64Buffer interface { ReadUint64() (uint64, error) ReadUint64LE() (uint64, error) WriteUint64(v uint64) error WriteUint64LE(v uint64) error GetUint64(index int) (uint64, error) GetUint64LE(index int) (uint64, error) SetUint64(index int, v uint64) error SetUint64LE(index int, v uint64) error }
Click to show internal directories.
Click to hide internal directories.