Documentation
¶
Index ¶
- Variables
- type Buffer
- type IBuffer
- type IMemoryNode
- type IMemoryPool
- type MemoryAllocFunc
- type MemoryFreeFunc
- type MemoryNodeConstructor
- type RawMemoryNode
- func (mn *RawMemoryNode) FreeMemory()
- func (mn *RawMemoryNode) GetMemoryCapacity() uint64
- func (mn *RawMemoryNode) GetMemorySize() uint64
- func (mn *RawMemoryNode) Marshal() (buf []byte, err error)
- func (mn *RawMemoryNode) ReadFrom(r io.Reader) (n int64, err error)
- func (mn *RawMemoryNode) Reset()
- func (mn *RawMemoryNode) Unmarshal(buf []byte) error
- func (mn *RawMemoryNode) WriteTo(w io.Writer) (n int64, err error)
- type SimpleMemoryPool
- func (pool *SimpleMemoryPool) Alloc(vf common.IVFile, useCompress bool, constructor MemoryNodeConstructor) (node IMemoryNode)
- func (pool *SimpleMemoryPool) Free(size uint64)
- func (pool *SimpleMemoryPool) GetCapacity() uint64
- func (pool *SimpleMemoryPool) GetUsage() uint64
- func (pool *SimpleMemoryPool) SetCapacity(capacity uint64) error
Constants ¶
This section is empty.
Variables ¶
View Source
var WithFreeWithPool = func(pool IMemoryPool) MemoryFreeFunc { return func(node IMemoryNode) { pool.Free(node.GetMemoryCapacity()) node.Reset() } }
Functions ¶
This section is empty.
Types ¶
type Buffer ¶
type Buffer struct {
Node IMemoryNode
}
func (*Buffer) GetCapacity ¶
func (*Buffer) GetDataNode ¶
func (buf *Buffer) GetDataNode() IMemoryNode
type IBuffer ¶
type IBuffer interface {
io.Closer
GetCapacity() uint64
GetDataNode() IMemoryNode
}
func NewBuffer ¶
func NewBuffer(node IMemoryNode) IBuffer
type IMemoryNode ¶
type IMemoryNode interface {
io.ReaderFrom
io.WriterTo
Marshal() ([]byte, error)
Unmarshal([]byte) error
FreeMemory()
Reset()
GetMemorySize() uint64
GetMemoryCapacity() uint64
}
func NewRawMemoryNode ¶
func NewRawMemoryNode(vf common.IVFile, useCompress bool, freeFunc MemoryFreeFunc) IMemoryNode
func RawMemoryNodeConstructor ¶
func RawMemoryNodeConstructor(vf common.IVFile, useCompress bool, freeFunc MemoryFreeFunc) IMemoryNode
type IMemoryPool ¶
type IMemoryPool interface {
Free(size uint64)
Alloc(vf common.IVFile, useCompress bool, constructor MemoryNodeConstructor) IMemoryNode
GetCapacity() uint64
SetCapacity(uint64) error
GetUsage() uint64
}
func NewSimpleMemoryPool ¶
func NewSimpleMemoryPool(capacity uint64) IMemoryPool
type MemoryAllocFunc ¶
type MemoryFreeFunc ¶
type MemoryFreeFunc func(IMemoryNode)
type MemoryNodeConstructor ¶
type MemoryNodeConstructor func(common.IVFile, bool, MemoryFreeFunc) IMemoryNode
type RawMemoryNode ¶
type RawMemoryNode struct {
Data []byte
FreeFunc MemoryFreeFunc
UseCompress bool
File common.IVFile
}
func (*RawMemoryNode) FreeMemory ¶
func (mn *RawMemoryNode) FreeMemory()
func (*RawMemoryNode) GetMemoryCapacity ¶
func (mn *RawMemoryNode) GetMemoryCapacity() uint64
func (*RawMemoryNode) GetMemorySize ¶
func (mn *RawMemoryNode) GetMemorySize() uint64
func (*RawMemoryNode) Marshal ¶
func (mn *RawMemoryNode) Marshal() (buf []byte, err error)
func (*RawMemoryNode) ReadFrom ¶
func (mn *RawMemoryNode) ReadFrom(r io.Reader) (n int64, err error)
func (*RawMemoryNode) Reset ¶
func (mn *RawMemoryNode) Reset()
func (*RawMemoryNode) Unmarshal ¶
func (mn *RawMemoryNode) Unmarshal(buf []byte) error
type SimpleMemoryPool ¶
func (*SimpleMemoryPool) Alloc ¶
func (pool *SimpleMemoryPool) Alloc(vf common.IVFile, useCompress bool, constructor MemoryNodeConstructor) (node IMemoryNode)
Only for temp test
func (*SimpleMemoryPool) Free ¶
func (pool *SimpleMemoryPool) Free(size uint64)
func (*SimpleMemoryPool) GetCapacity ¶
func (pool *SimpleMemoryPool) GetCapacity() uint64
func (*SimpleMemoryPool) GetUsage ¶
func (pool *SimpleMemoryPool) GetUsage() uint64
func (*SimpleMemoryPool) SetCapacity ¶
func (pool *SimpleMemoryPool) SetCapacity(capacity uint64) error
Click to show internal directories.
Click to hide internal directories.