logtailreplay

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: May 17, 2024 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EncodePrimaryKey

func EncodePrimaryKey(v any, packer *types.Packer) []byte

func EncodePrimaryKeyVector

func EncodePrimaryKeyVector(vec *vector.Vector, packer *types.Packer) (ret [][]byte)

func IsBlkTable

func IsBlkTable(name string) bool

func IsMetaTable

func IsMetaTable(name string) bool

func IsObjTable added in v1.1.0

func IsObjTable(name string) bool

Types

type BlockDeltaEntry added in v1.0.0

type BlockDeltaEntry struct {
	BlockID types.Blockid

	CommitTs types.TS
	DeltaLoc objectio.ObjectLocation
}

func (BlockDeltaEntry) DeltaLocation added in v1.0.0

func (b BlockDeltaEntry) DeltaLocation() objectio.Location

func (BlockDeltaEntry) Less added in v1.0.0

func (b BlockDeltaEntry) Less(than BlockDeltaEntry) bool

type BlockEntry

type BlockEntry struct {
	objectio.BlockInfo

	CreateTime types.TS
	DeleteTime types.TS
}

func (BlockEntry) Less

func (b BlockEntry) Less(than BlockEntry) bool

type BlocksIter

type BlocksIter interface {
	Next() bool
	Close() error
	Entry() types.Blockid
}

type Filter added in v1.2.0

type Filter interface {
	Filter([]ObjectInfo) []ObjectInfo
}

func NewOverlap added in v1.2.0

func NewOverlap(maxObjects int) Filter

func NewSmall added in v1.2.0

func NewSmall(threshold uint32) Filter

type ObjectEntry added in v1.0.0

type ObjectEntry struct {
	ObjectInfo
}

func (ObjectEntry) IsEmpty added in v1.2.0

func (o ObjectEntry) IsEmpty() bool

func (ObjectEntry) Less added in v1.0.0

func (o ObjectEntry) Less(than ObjectEntry) bool

func (ObjectEntry) Location added in v1.0.0

func (o ObjectEntry) Location() objectio.Location

func (*ObjectEntry) Visible added in v1.0.0

func (o *ObjectEntry) Visible(ts types.TS) bool

type ObjectIndexByCreateTSEntry added in v1.0.0

type ObjectIndexByCreateTSEntry struct {
	ObjectInfo
}

func (ObjectIndexByCreateTSEntry) Less added in v1.0.0

func (*ObjectIndexByCreateTSEntry) Visible added in v1.0.0

func (o *ObjectIndexByCreateTSEntry) Visible(ts types.TS) bool

type ObjectIndexByTSEntry added in v1.0.0

type ObjectIndexByTSEntry struct {
	Time         types.TS // insert or delete time
	ShortObjName objectio.ObjectNameShort

	IsDelete     bool
	IsAppendable bool
}

func (ObjectIndexByTSEntry) Less added in v1.0.0

type ObjectInfo added in v1.0.0

type ObjectInfo struct {
	objectio.ObjectStats

	EntryState  bool
	Sorted      bool
	HasDeltaLoc bool
	CommitTS    types.TS
	CreateTime  types.TS
	DeleteTime  types.TS
}

func (ObjectInfo) Location added in v1.0.0

func (o ObjectInfo) Location() objectio.Location

func (ObjectInfo) StatsValid added in v1.1.1

func (o ObjectInfo) StatsValid() bool

func (ObjectInfo) String added in v1.1.0

func (o ObjectInfo) String() string

type ObjectsIter added in v1.0.0

type ObjectsIter interface {
	Next() bool
	Close() error
	Entry() ObjectEntry
}

type Partition

type Partition struct {
	TableInfo   TableInfo
	TableInfoOK bool
	// contains filtered or unexported fields
}

a partition corresponds to a dn

func NewPartition

func NewPartition() *Partition

func (*Partition) CanServe added in v1.2.0

func (p *Partition) CanServe(ts types.TS) bool

func (*Partition) CheckPoint

func (*Partition) CheckPoint(ctx context.Context, ts timestamp.Timestamp) error

func (*Partition) ConsumeCheckpoints added in v1.0.0

func (p *Partition) ConsumeCheckpoints(
	ctx context.Context,
	fn func(
		checkpoint string,
		state *PartitionState,
	) error,
) (
	err error,
)

func (*Partition) ConsumeSnapCkps added in v1.2.0

func (p *Partition) ConsumeSnapCkps(
	_ context.Context,
	ckps []*checkpoint.CheckpointEntry,
	fn func(
		ckp *checkpoint.CheckpointEntry,
		state *PartitionState,
	) error,
) (
	err error,
)

func (*Partition) GetDuration added in v1.2.0

func (p *Partition) GetDuration() (types.TS, types.TS)

func (*Partition) IsEmpty added in v1.2.0

func (p *Partition) IsEmpty() bool

func (*Partition) IsValid added in v1.2.0

func (p *Partition) IsValid() bool

func (*Partition) Lock

func (p *Partition) Lock(ctx context.Context) error

func (*Partition) MutateState

func (p *Partition) MutateState() (*PartitionState, func())

func (*Partition) Snapshot

func (p *Partition) Snapshot() *PartitionState

func (*Partition) Truncate added in v1.0.0

func (p *Partition) Truncate(ctx context.Context, ids [2]uint64, ts types.TS) error

func (*Partition) Unlock

func (p *Partition) Unlock()

func (*Partition) UpdateDuration added in v1.2.0

func (p *Partition) UpdateDuration(start types.TS, end types.TS)

[start, end]

func (*Partition) UpdateStart added in v1.2.0

func (p *Partition) UpdateStart(ts types.TS)

type PartitionState

type PartitionState struct {
	// contains filtered or unexported fields
}

func NewPartitionState

func NewPartitionState(noData bool) *PartitionState

func (*PartitionState) AppendCheckpoint

func (p *PartitionState) AppendCheckpoint(
	checkpoint string,
	partiton *Partition)

func (*PartitionState) ApproxObjectsNum added in v1.0.0

func (p *PartitionState) ApproxObjectsNum() int

not accurate! only used by stats

func (*PartitionState) BlockPersisted added in v1.0.0

func (p *PartitionState) BlockPersisted(blockID types.Blockid) bool

func (*PartitionState) CacheCkpDuration added in v1.2.0

func (p *PartitionState) CacheCkpDuration(
	start types.TS,
	end types.TS,
	partition *Partition)

func (*PartitionState) Copy

func (p *PartitionState) Copy() *PartitionState

func (*PartitionState) GetBockDeltaLoc added in v1.0.0

func (p *PartitionState) GetBockDeltaLoc(bid types.Blockid) (objectio.ObjectLocation, types.TS, bool)

func (*PartitionState) GetChangedObjsBetween added in v1.0.0

func (p *PartitionState) GetChangedObjsBetween(
	begin types.TS,
	end types.TS,
) (
	deleted map[objectio.ObjectNameShort]struct{},
	inserted map[objectio.ObjectNameShort]struct{},
)

GetChangedObjsBetween get changed objects between [begin, end], notice that if an object is created after begin and deleted before end, it will be ignored.

func (*PartitionState) GetObject added in v1.0.0

func (p *PartitionState) GetObject(name objectio.ObjectNameShort) (ObjectInfo, bool)

func (*PartitionState) HandleLogtailEntry

func (p *PartitionState) HandleLogtailEntry(
	ctx context.Context,
	fs fileservice.FileService,
	entry *api.Entry,
	primarySeqnum int,
	packer *types.Packer,
)

func (*PartitionState) HandleMetadataDelete

func (p *PartitionState) HandleMetadataDelete(
	ctx context.Context,
	tableID uint64,
	input *api.Batch)

func (*PartitionState) HandleMetadataInsert

func (p *PartitionState) HandleMetadataInsert(
	ctx context.Context,
	fs fileservice.FileService,
	input *api.Batch)

func (*PartitionState) HandleObjectDelete added in v1.1.0

func (p *PartitionState) HandleObjectDelete(
	tableID uint64,
	bat *api.Batch)

func (*PartitionState) HandleObjectInsert added in v1.1.0

func (p *PartitionState) HandleObjectInsert(ctx context.Context, bat *api.Batch, fs fileservice.FileService)

func (*PartitionState) HandleRowsDelete

func (p *PartitionState) HandleRowsDelete(
	ctx context.Context,
	input *api.Batch,
	packer *types.Packer,
)

func (*PartitionState) HandleRowsInsert

func (p *PartitionState) HandleRowsInsert(
	ctx context.Context,
	input *api.Batch,
	primarySeqnum int,
	packer *types.Packer,
) (
	primaryKeys [][]byte,
)

func (*PartitionState) LastFlushTimestamp added in v1.2.0

func (p *PartitionState) LastFlushTimestamp() types.TS

func (*PartitionState) NewDirtyBlocksIter

func (p *PartitionState) NewDirtyBlocksIter() BlocksIter

func (*PartitionState) NewObjectsIter added in v1.0.0

func (p *PartitionState) NewObjectsIter(ts types.TS) (ObjectsIter, error)

func (*PartitionState) NewPrimaryKeyDelIter added in v1.1.0

func (p *PartitionState) NewPrimaryKeyDelIter(
	ts types.TS,
	spec PrimaryKeyMatchSpec,
	bid types.Blockid,
) *primaryKeyDelIter

func (*PartitionState) NewPrimaryKeyIter

func (p *PartitionState) NewPrimaryKeyIter(
	ts types.TS,
	spec PrimaryKeyMatchSpec,
) *primaryKeyIter

func (*PartitionState) NewRowsIter

func (p *PartitionState) NewRowsIter(ts types.TS, blockID *types.Blockid, iterDeleted bool) *rowsIter

func (*PartitionState) PKExistInMemBetween added in v1.2.0

func (p *PartitionState) PKExistInMemBetween(
	from types.TS,
	to types.TS,
	keys [][]byte,
) (bool, bool)

func (*PartitionState) RowExists

func (p *PartitionState) RowExists(rowID types.Rowid, ts types.TS) bool

type PrimaryIndexEntry

type PrimaryIndexEntry struct {
	Bytes      []byte
	RowEntryID int64

	// fields for validating
	BlockID types.Blockid
	RowID   types.Rowid
	Time    types.TS
}

func (*PrimaryIndexEntry) Less

func (p *PrimaryIndexEntry) Less(than *PrimaryIndexEntry) bool

type PrimaryKeyMatchSpec

type PrimaryKeyMatchSpec struct {
	// Move moves to the target
	Move func(p *primaryKeyIter) bool
	Name string
}

func Exact

func Exact(key []byte) PrimaryKeyMatchSpec

func ExactIn added in v1.2.0

func ExactIn(encodes [][]byte) PrimaryKeyMatchSpec

func MinMax

func MinMax(min []byte, max []byte) PrimaryKeyMatchSpec

func Prefix

func Prefix(prefix []byte) PrimaryKeyMatchSpec

type RowEntry

type RowEntry struct {
	BlockID types.Blockid // we need to iter by block id, so put it first to allow faster iteration
	RowID   types.Rowid
	Time    types.TS

	ID                int64 // a unique version id, for primary index building and validating
	Deleted           bool
	Batch             *batch.Batch
	Offset            int64
	PrimaryIndexBytes []byte
}

RowEntry represents a version of a row

func (RowEntry) Less

func (r RowEntry) Less(than RowEntry) bool

type RowID

type RowID types.Rowid

func (RowID) Less

func (r RowID) Less(than RowID) bool

type RowsIter

type RowsIter interface {
	Next() bool
	Close() error
	Entry() RowEntry
}

type TableInfo added in v1.2.0

type TableInfo struct {
	ID            uint64
	Name          string
	PrimarySeqnum int
}

Jump to

Keyboard shortcuts

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