chunk

package
v5.3.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2021 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitChunk

func InitChunk(chunk *Range, t ChunkType, firstBucketID, lastBucketID int, collation, limits string)

func InitChunks

func InitChunks(chunks []*Range, t ChunkType, firstBucketID, lastBucketID int, index int, collation, limits string, chunkCnt int)

Notice: chunk may contain not only one bucket, which can be expressed as a range [3, 5],

And `lastBucketID` means the `5` and `firstBucketID` means the `3`.

Types

type Bound

type Bound struct {
	Column string `json:"column"`
	Lower  string `json:"lower"`
	Upper  string `json:"upper"`

	HasLower bool `json:"has-lower"`
	HasUpper bool `json:"has-upper"`
}

Bound represents a bound for a column

type ChunkID

type ChunkID struct {
	TableIndex int `json:"table-index"`
	// we especially treat random split has only one bucket
	// which is the whole table
	// range is [left, right]
	BucketIndexLeft  int `json:"bucket-index-left"`
	BucketIndexRight int `json:"bucket-index-right"`
	ChunkIndex       int `json:"chunk-index"`
	//  `ChunkCnt` is the number of chunks in this bucket
	//  We can compare `ChunkIndex` and `ChunkCnt` to know
	// whether this chunk is the last one
	ChunkCnt int `json:"chunk-count"`
}

ChunkID is to identify the sequence of chunks

func GetInitChunkID

func GetInitChunkID() *ChunkID

func (*ChunkID) Compare

func (c *ChunkID) Compare(o *ChunkID) int

func (*ChunkID) Copy

func (c *ChunkID) Copy() *ChunkID

func (*ChunkID) FromString

func (c *ChunkID) FromString(s string) error

func (*ChunkID) ToString

func (c *ChunkID) ToString() string

type ChunkType

type ChunkType int
const (
	Bucket ChunkType = iota + 1
	Random
	Limit
	Others
	Empty
)

type Range

type Range struct {
	Index   *ChunkID  `json:"index"`
	Type    ChunkType `json:"type"`
	Bounds  []*Bound  `json:"bounds"`
	IsFirst bool      `json:"is-first"`
	IsLast  bool      `json:"is-last"`

	Where string        `json:"where"`
	Args  []interface{} `json:"args"`
	// contains filtered or unexported fields
}

Range represents chunk range

func NewChunkRange

func NewChunkRange() *Range

NewChunkRange return a Range.

func NewChunkRangeOffset

func NewChunkRangeOffset(columnOffset map[string]int) *Range

NewChunkRangeOffset return a Range in sequence

func (*Range) Clone

func (c *Range) Clone() *Range

func (*Range) Copy

func (c *Range) Copy() *Range

func (*Range) CopyAndUpdate

func (c *Range) CopyAndUpdate(column, lower, upper string, updateLower, updateUpper bool) *Range

func (*Range) IsFirstChunkForBucket

func (r *Range) IsFirstChunkForBucket() bool

func (*Range) IsFirstChunkForTable

func (c *Range) IsFirstChunkForTable() bool

func (*Range) IsLastChunkForBucket

func (r *Range) IsLastChunkForBucket() bool

func (*Range) IsLastChunkForTable

func (c *Range) IsLastChunkForTable() bool

func (*Range) String

func (c *Range) String() string

String returns the string of Range, used for log.

func (*Range) ToMeta

func (c *Range) ToMeta() string

func (*Range) ToString

func (c *Range) ToString(collation string) (string, []interface{})

func (*Range) Update

func (c *Range) Update(column, lower, upper string, updateLower, updateUpper bool)

Jump to

Keyboard shortcuts

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