logtailreplay

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2023 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 IsSegTable

func IsSegTable(name string) bool

Types

type BlockDeltaEntry added in v1.0.0

type BlockDeltaEntry struct {
	BlockID types.Blockid

	CommitTs types.TS
	DeltaLoc catalog.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 {
	catalog.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 ObjectEntry added in v1.0.0

type ObjectEntry struct {
	ShortObjName objectio.ObjectNameShort

	ObjectInfo
}

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 {
	CreateTime   types.TS
	ShortObjName objectio.ObjectNameShort

	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 {
	Loc         objectio.Location
	EntryState  bool
	Sorted      bool
	HasDeltaLoc bool
	SegmentID   types.Uuid
	CommitTS    types.TS
	CreateTime  types.TS
	DeleteTime  types.TS
	BlkCnt      uint16
}

func (ObjectInfo) Location added in v1.0.0

func (o ObjectInfo) Location() objectio.Location

type ObjectsIter added in v1.0.0

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

type Partition

type Partition struct {
	TS timestamp.Timestamp // last updated timestamp
	// contains filtered or unexported fields
}

a partition corresponds to a dn

func NewPartition

func NewPartition() *Partition

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) 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()

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) Copy

func (p *PartitionState) Copy() *PartitionState

func (*PartitionState) GetBockDeltaLoc added in v1.0.0

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

func (*PartitionState) GetChangedObjsBetween added in v1.0.0

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

GetChangedObjsBetween get changed objects between [begin, end]

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, input *api.Batch)

func (*PartitionState) HandleMetadataInsert

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

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) NewDirtyBlocksIter

func (p *PartitionState) NewDirtyBlocksIter() *dirtyBlocksIter

func (*PartitionState) NewObjectsIter added in v1.0.0

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

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) PrimaryKeyMayBeModified

func (p *PartitionState) PrimaryKeyMayBeModified(
	from types.TS,
	to types.TS,
	key []byte,
) 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 {
	Seek  []byte
	Match func(key []byte) bool
}

func Exact

func Exact(key []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
}

Jump to

Keyboard shortcuts

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