Documentation ¶
Index ¶
- func SyncDir(dir string) error
- type CoreFile
- type LogFile
- func (lf *LogFile) AddSize(offset uint32)
- func (lf *LogFile) Bootstrap() error
- func (lf *LogFile) Close() error
- func (lf *LogFile) DecodeEntry(buf []byte, offset uint32) (*utils.Entry, error)
- func (lf *LogFile) DoneWriting(offset uint32) error
- func (lf *LogFile) EncodeEntry(e *utils.Entry, buf *bytes.Buffer, offset uint32) (int, error)
- func (lf *LogFile) FD() *os.File
- func (lf *LogFile) FileName() string
- func (lf *LogFile) Init() error
- func (lf *LogFile) Open(opt *Options) error
- func (lf *LogFile) Read(p *utils.ValuePtr) (buf []byte, err error)
- func (lf *LogFile) Seek(offset int64, whence int) (ret int64, err error)
- func (lf *LogFile) Size() int64
- func (lf *LogFile) Sync() error
- func (lf *LogFile) Truncate(offset int64) error
- func (lf *LogFile) Write(offset uint32, buf []byte) (err error)
- type Manifest
- type ManifestFile
- func (mf *ManifestFile) AddChanges(changesParam []*pb.ManifestChange) error
- func (mf *ManifestFile) AddTableMeta(levelNum int, t *TableMeta) (err error)
- func (mf *ManifestFile) Close() error
- func (mf *ManifestFile) GetManifest() *Manifest
- func (mf *ManifestFile) RevertToManifest(idMap map[uint64]struct{}) error
- type MmapFile
- func (m *MmapFile) AllocateSlice(sz, offset int) ([]byte, int, error)
- func (m *MmapFile) AppendBuffer(offset uint32, buf []byte) error
- func (m *MmapFile) Bytes(off, sz int) ([]byte, error)
- func (m *MmapFile) Close() error
- func (m *MmapFile) Delete() error
- func (m *MmapFile) NewReader(offset int) io.Reader
- func (m *MmapFile) ReName(name string) error
- func (m *MmapFile) Slice(offset int) []byte
- func (m *MmapFile) Sync() error
- func (m *MmapFile) Truncature(maxSz int64) error
- type Options
- type SSTable
- func (ss *SSTable) Bytes(off, sz int) ([]byte, error)
- func (ss *SSTable) Close() error
- func (ss *SSTable) Detele() error
- func (ss *SSTable) FID() uint64
- func (ss *SSTable) GetCreatedAt() *time.Time
- func (ss *SSTable) HasBloomFilter() bool
- func (ss *SSTable) Indexs() *pb.TableIndex
- func (ss *SSTable) Init() error
- func (ss *SSTable) MaxKey() []byte
- func (ss *SSTable) MinKey() []byte
- func (ss *SSTable) SetCreatedAt(t *time.Time)
- func (ss *SSTable) SetMaxKey(maxKey []byte)
- func (ss *SSTable) Size() int64
- func (ss *SSTable) Truncature(size int64) error
- type SafeRead
- type TableManifest
- type TableMeta
- type WalFile
- func (wf *WalFile) Close() error
- func (wf *WalFile) Fid() uint64
- func (wf *WalFile) Iterate(readOnly bool, offset uint32, fn utils.LogEntry) (uint32, error)
- func (wf *WalFile) Name() string
- func (wf *WalFile) Size() uint32
- func (wf *WalFile) Truncate(end int64) error
- func (wf *WalFile) Write(entry *utils.Entry) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type LogFile ¶
func (*LogFile) DecodeEntry ¶
func (*LogFile) DoneWriting ¶
func (*LogFile) EncodeEntry ¶
encodeEntry will encode entry to the buf layout of entry +--------+-----+-------+-------+ | header | key | value | crc32 | +--------+-----+-------+-------+
type Manifest ¶
type Manifest struct { Levels []levelManifest Tables map[uint64]TableManifest Creations int Deletions int }
Manifest corekv 元数据状态维护
type ManifestFile ¶
type ManifestFile struct {
// contains filtered or unexported fields
}
ManifestFile 维护sst文件元信息的文件 manifest 比较特殊,不能使用mmap,需要保证实时的写入
func OpenManifestFile ¶
func OpenManifestFile(opt *Options) (*ManifestFile, error)
OpenManifestFile 打开manifest文件
func (*ManifestFile) AddChanges ¶
func (mf *ManifestFile) AddChanges(changesParam []*pb.ManifestChange) error
AddChanges 对外暴露的写比那更丰富
func (*ManifestFile) AddTableMeta ¶
func (mf *ManifestFile) AddTableMeta(levelNum int, t *TableMeta) (err error)
AddTableMeta 存储level表到manifest的level中
func (*ManifestFile) GetManifest ¶
func (mf *ManifestFile) GetManifest() *Manifest
GetManifest manifest
func (*ManifestFile) RevertToManifest ¶
func (mf *ManifestFile) RevertToManifest(idMap map[uint64]struct{}) error
RevertToManifest checks that all necessary table files exist and removes all table files not referenced by the manifest. idMap is a set of table file id's that were read from the directory listing.
type MmapFile ¶
MmapFile represents an mmapd file and includes both the buffer to the data and the file descriptor.
func OpenMmapFile ¶
OpenMmapFile opens an existing file or creates a new file. If the file is created, it would truncate the file to maxSz. In both cases, it would mmap the file to maxSz and returned it. In case the file is created, z.NewFile is returned.
func OpenMmapFileUsing ¶
OpenMmapFileUsing os
func (*MmapFile) AllocateSlice ¶
AllocateSlice allocates a slice of the given size at the given offset.
func (*MmapFile) AppendBuffer ¶
AppendBuffer 向内存中追加一个buffer,如果空间不足则重新映射,扩大空间
func (*MmapFile) Bytes ¶
Bytes returns data starting from offset off of size sz. If there's not enough data, it would return nil slice and io.EOF.
type SSTable ¶
type SSTable struct {
// contains filtered or unexported fields
}
SSTable 文件的内存封装
func (*SSTable) Bytes ¶
Bytes returns data starting from offset off of size sz. If there's not enough data, it would return nil slice and io.EOF.
type TableManifest ¶
TableManifest 包含sst的基本信息