partition

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: May 27, 2019 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChunkInfo

type ChunkInfo struct {
	// Id the chunk id
	Id chunk.Id
	// Size contains chunk size in bytes
	Size int64
	// Records contains number of records in the chunk
	Records uint32
	// MinTs contains minimal timestamp value for the chunk records
	MinTs int64
	// MaxTs contains maximal timestamp value for the chunk records
	MaxTs int64
	// Comment any supplemental info
	Comment string
}

ChunkInfo struct desribes a chunk

type JIterator added in v0.1.0

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

JIterator struct provides records.Iterator implementation on top of a journal.Journal. The implementation allows to use an position selector solution (chkSelector) which uses time-index itself for smart positioning in the iterator.

func NewJIterator added in v0.1.0

func NewJIterator(tmRange model.TimeRange, jrnl journal.Journal, tmidx tmindex.TsIndexer, tmRebuilder TmIndexRebuilder) *JIterator

NewJIterator constructs new JIterator instance

func (*JIterator) Close added in v0.1.0

func (jit *JIterator) Close() error

func (*JIterator) CurrentPos added in v0.1.0

func (jit *JIterator) CurrentPos() records.IteratorPos

func (*JIterator) Get added in v0.1.0

func (jit *JIterator) Get(ctx context.Context) (records.Record, error)

func (*JIterator) Next added in v0.1.0

func (jit *JIterator) Next(ctx context.Context)

func (*JIterator) Pos added in v0.1.0

func (jit *JIterator) Pos() journal.Pos

func (*JIterator) Release added in v0.1.0

func (jit *JIterator) Release()

func (*JIterator) SetBackward added in v0.1.0

func (jit *JIterator) SetBackward(bkwrd bool)

func (*JIterator) SetPos added in v0.1.0

func (jit *JIterator) SetPos(pos journal.Pos)

func (*JIterator) String added in v0.1.0

func (jit *JIterator) String() string

type OnTruncateF

type OnTruncateF func(ti TruncateInfo)

type PartitionInfo

type PartitionInfo struct {
	// Tags contains the partition tags
	Tags tag.Set
	// Size contains the size of the partition
	Size uint64
	// Records contains number of records in the partition
	Records uint64

	//Journal id contains the journal identifier
	JournalId string

	// Chunks contains information about the journal chunks
	Chunks []*ChunkInfo
}

Describes a partition info

type PartitionsInfo

type PartitionsInfo struct {
	// Partitions contains list of partitions for the query (with limit and offset)
	Partitions []*PartitionInfo
	// Count contains total number of partitions found
	Count int
	// TotalSize contains summarized size of all partitions which match the criteria
	TotalSize uint64
	// TotalRecords contains summarized number of records in all matched partitions
	TotalRecords uint64
}

PartitionsInfo contains information about partitions for the query

type Service

type Service struct {
	Pool      *bytes.Pool        `inject:""`
	Journals  journal.Controller `inject:""`
	TIndex    tindex.Service     `inject:""`
	MainCtx   context.Context    `inject:"mainCtx"`
	TsIndexer tmindex.TsIndexer  `inject:""`
	// contains filtered or unexported fields
}

Service struct provides functionality and some functions to work with partitions(LogEvent journals)

func NewService

func NewService() *Service

NewService creates new service for controlling partitions

func (*Service) GetJournals

func (s *Service) GetJournals(ctx context.Context, tagsCond *lql.Source, maxLimit int) (map[tag.Line]journal.Journal, error)

GetJournals is part of cursor.JournalsProvider

func (*Service) GetParitionInfo

func (s *Service) GetParitionInfo(tags string) (PartitionInfo, error)

GetParitionInfo returns a partition info using its unique tags combination

func (*Service) GetTmIndexRebuilder added in v0.1.0

func (s *Service) GetTmIndexRebuilder() TmIndexRebuilder

TmIndexRebuilder returns the time index rebuilder

func (*Service) GetTsIndexer added in v0.1.0

func (s *Service) GetTsIndexer() tmindex.TsIndexer

GetIsIndexer returns TsIndexer object

func (*Service) GetWriteEvent

func (s *Service) GetWriteEvent(ctx context.Context) (WriteEvent, error)

GetWriteEvent reads next write event. It blocks caller until the contex is closed or new event comes

func (*Service) Init

func (s *Service) Init(ctx context.Context) error

Init is part of linker.Initializer

func (*Service) Partitions

func (s *Service) Partitions(ctx context.Context, expr *lql.Source, offset, limit int) (*PartitionsInfo, error)

Partitions function returns list of partitions with tags, that match to tagsCond with the specific offset and limit in the result

func (*Service) Release

func (s *Service) Release(jn string)

Release releases the partition. Journal must not be used after the call. This is part of cursor.JournalsProvider

func (*Service) Shutdown

func (s *Service) Shutdown()

Shutdown is part of linker.Shutdowner

func (*Service) Truncate

func (s *Service) Truncate(ctx context.Context, tp TruncateParams, otf OnTruncateF) error

Truncate walks over matched journals and truncate the chunks, if needed

func (*Service) Write

func (s *Service) Write(ctx context.Context, tags string, lit model.Iterator, noEvent bool) error

Write performs Write operation to a partition defined by tags. the flag noEvent shows whether the WriteEvent should be emitted (noEvent = false) on the write operation or not

type TmIndexRebuilder added in v0.1.0

type TmIndexRebuilder interface {
	// RebuildIndex sends request for rebuilding time index. It works asynchronusly
	// and should not block the go-routine
	// if force is true the index will be rebuilt even if it is alive
	RebuildIndex(src string, cid chunk.Id, force bool)
}

TmIndexRebuilder allows to send requests for rebuilding corrupted time index data

type TruncateInfo

type TruncateInfo struct {
	// LatestTs contains timestamp for latest record in the partition
	LatestTs      int64
	Tags          tag.Set
	Src           string
	BeforeSize    uint64
	AfterSize     uint64
	BeforeRecs    uint64
	AfterRecs     uint64
	ChunksDeleted int
	Deleted       bool
}

TruncateInfo describes a truncated partition information

type TruncateParams

type TruncateParams struct {
	DryRun bool
	// TagsExpr contains the tags condition to select journals to be truncated
	TagsExpr *lql.Source
	// MaxSrcSize defines the upper level of a partition size, which will be truncated, if reached
	MaxSrcSize uint64
	// MinSrcSize defines the lower level of a partition size, which will not be cut if the partition will be less
	// than this parameter after truncation
	MinSrcSize uint64
	// OldestTs defines the oldest record timestamp. Chunks with records less than the parameter are candidates
	// for truncation
	OldestTs int64
	// Max Global size
	MaxDBSize uint64
}

TruncateParams allows to provide parameters for Truncate() functions

func (TruncateParams) String

func (tp TruncateParams) String() string

type WriteEvent

type WriteEvent struct {
	Tags tag.Set
	//Src the partition Id
	Src      string
	StartPos journal.Pos
	EndPos   journal.Pos
}

WriteEvent structure contains inforamation about write event into a partition

Jump to

Keyboard shortcuts

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