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
Index ¶
- Variables
- type MmapFile
- func (mf *MmapFile) Close() error
- func (mf *MmapFile) Read(data []byte) (int, error)
- func (mf *MmapFile) ReadAt(data []byte, offset int64) (int, error)
- func (mf *MmapFile) Seek(offset int64, whence int) (ret int64, err error)
- func (mf *MmapFile) Size() int64
- func (mf *MmapFile) Sync() error
- func (mf *MmapFile) Truncate(size int64) error
- func (mf *MmapFile) Write(data []byte) (int, error)
- func (mf *MmapFile) WriteAt(data []byte, offset int64) (int, error)
- type NormalFile
- type WalFile
Constants ¶
This section is empty.
Variables ¶
Functions ¶
This section is empty.
Types ¶
type MmapFile ¶
type MmapFile struct {
// contains filtered or unexported fields
}
MmapFile 内存映射式文件操作,不支持并发操作
func OpenMmapFile ¶
func OpenMmapFile(path string, mmSize int, flag int, perm os.FileMode, mapFlag int, lock bool) (*MmapFile, error)
OpenMmapFile 打开一个mmapfile path:文件路径,mmSize:映射区大小,flag:文件指定的flag, perm:创建文件的权限, mapFlag:映射时指定的flag, lock:是否锁定映射区
func (*MmapFile) Read ¶
Read 顺序读取数据到data,同普通文件Read
func (*MmapFile) ReadAt ¶
ReadAt 从offset处读取数据到data,同普通文件ReadAt
func (*MmapFile) Seek ¶
Seek 设置读写偏移量 同普通文件Seek
func (*MmapFile) Size ¶
Size 获取文件的大小,因为使用的是mmap,故写入到映射区相当于写入到了os缓存区,此时调用的获取底层文件的size等同于操作普通文件一样
func (*MmapFile) Truncate ¶
Truncate 截断文件 同普通文件Truncate
func (*MmapFile) Write ¶
Write 追加写入数据 同普通文件Write
type NormalFile ¶
func NewFile ¶
func NewFile(path string) (*NormalFile, error)
type WalFile ¶
Click to show internal directories.
Click to hide internal directories.