Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( OsPageSize = os.Getpagesize() End = errors.New("END") )
Functions ¶
This section is empty.
Types ¶
type BytesAllocator ¶
type BytesAllocator struct {
// contains filtered or unexported fields
}
func NewBytesAllocator ¶
func NewBytesAllocator(cap int) *BytesAllocator
func (*BytesAllocator) AllocAt ¶
func (bsa *BytesAllocator) AllocAt(offset int64, n int) ([]byte, error)
AllocAt 在分配器中获取[offset:offset+n)范围内的缓存区, 如果offset不在分配器范围则返回END错误,如果offset+n超过分配器上限,则返回的缓存区大小将会小于n
func (*BytesAllocator) Release ¶
func (bsa *BytesAllocator) Release()
func (*BytesAllocator) Resize ¶
func (bsa *BytesAllocator) Resize(size int) error
func (*BytesAllocator) Size ¶
func (bsa *BytesAllocator) Size() int
type MmapAllocator ¶
type MmapAllocator struct {
// contains filtered or unexported fields
}
func NewMmapAllocator ¶
func (*MmapAllocator) AllocAt ¶
func (mal *MmapAllocator) AllocAt(offset int64, n int) ([]byte, error)
AllocAt 在映射区中获取[offset:offset+n)范围内的缓存区, 如果offset不在映射区范围则返回END错误,如果offset+n超过映射区上线,则返回的缓存区大小将会小于n
Click to show internal directories.
Click to hide internal directories.