Documentation
¶
Overview ¶
Copyright (C) BABEC. All rights reserved. Copyright (C) THL A29 Limited, a Tencent company. All rights reserved.
SPDX-License-Identifier: Apache-2.0
Copyright (C) BABEC. All rights reserved. Copyright (C) THL A29 Limited, a Tencent company. All rights reserved.
SPDX-License-Identifier: Apache-2.0
Copyright (C) THL A29 Limited, a Tencent company. All rights reserved.
SPDX-License-Identifier: Apache-2.0
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( OsPageSize = os.Getpagesize() End = errors.New("END") OsPageMask = OsPageSize - 1 )
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
func (*MmapAllocator) Flush ¶ added in v1.2.1
func (mal *MmapAllocator) Flush() error
func (*MmapAllocator) Resize ¶
func (mal *MmapAllocator) Resize(foffset int64, mmSize int) error
Resize 重映射映射区
Click to show internal directories.
Click to hide internal directories.