storage

package
v0.0.0-...-b4d98a6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 28, 2020 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CopyRecords

func CopyRecords(dst, src []Record)

func GenRecordsFiles

func GenRecordsFiles(startBlockIndex int)

Types

type FileBlockWriter

type FileBlockWriter struct {
	DataFilenameBase string // data 文件名,后缀会添加 meta 或 block index
	BlockSize        int    // 文件分块大小,单位 byte
	BlockNum         int    // 最大块数
	BlockIndex       int    // 当前 block
	// contains filtered or unexported fields
}

type Record

type Record struct {
	Key  int64  // 主键,排序字段
	Data []byte // 数据
}

func GenRecords

func GenRecords(n int, maxKey int64) []Record

GenRecords 生成 Key 唯一且随机的包含 n 个 Record 的数组,data 数据随机

func ReadRecordsFile

func ReadRecordsFile(dataFilenameBase string, blockIndex int64) []Record

func (*Record) Assign

func (r *Record) Assign(r1 Record)

type RecordGenerator

type RecordGenerator struct {
	MaxKey      int64 // Record.Key 最大值
	DataSizeMin int   // Record.Data 字段最小长度
	DataSizeMax int   // Record.Data 字段最大长度
}

func (*RecordGenerator) Generate

func (g *RecordGenerator) Generate() Record

func (*RecordGenerator) Init

func (g *RecordGenerator) Init()

type RecordKeyMaxHeap

type RecordKeyMaxHeap []Record

func (RecordKeyMaxHeap) Len

func (h RecordKeyMaxHeap) Len() int

func (RecordKeyMaxHeap) Less

func (h RecordKeyMaxHeap) Less(i, j int) bool

func (*RecordKeyMaxHeap) Pop

func (h *RecordKeyMaxHeap) Pop() interface{}

func (*RecordKeyMaxHeap) Push

func (h *RecordKeyMaxHeap) Push(x interface{})

func (RecordKeyMaxHeap) Swap

func (h RecordKeyMaxHeap) Swap(i, j int)

type SortByRecordKey

type SortByRecordKey []Record

func (SortByRecordKey) Len

func (h SortByRecordKey) Len() int

func (SortByRecordKey) Less

func (h SortByRecordKey) Less(i, j int) bool

func (SortByRecordKey) Swap

func (h SortByRecordKey) Swap(i, j int)

type Store

type Store struct {
	Records []Record
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL