Documentation
¶
Index ¶
- type ChunkInfo
- type OnTruncateF
- type PartitionInfo
- type PartitionsInfo
- type Service
- func (s *Service) GetJournals(ctx context.Context, tagsCond *lql.Source, maxLimit int) (map[tag.Line]journal.Journal, error)
- func (s *Service) GetParitionInfo(tags string) (PartitionInfo, error)
- func (s *Service) GetWriteEvent(ctx context.Context) (WriteEvent, error)
- func (s *Service) Init(ctx context.Context) error
- func (s *Service) Partitions(ctx context.Context, expr *lql.Source, offset, limit int) (*PartitionsInfo, error)
- func (s *Service) Release(jn string)
- func (s *Service) Shutdown()
- func (s *Service) Truncate(ctx context.Context, tp TruncateParams, otf OnTruncateF) error
- func (s *Service) Write(ctx context.Context, tags string, lit model.Iterator, noEvent bool) error
- type TruncateInfo
- type TruncateParams
- type WriteEvent
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 uint64
// MaxTs contains maximal timestamp value for the chunk records
MaxTs uint64
}
ChunkInfo struct desribes a chunk
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:""`
CIdxDir string `inject:"cindexDir"`
MainCtx context.Context `inject:"mainCtx"`
// 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) 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) 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 ¶
Release releases the partition. Journal must not be used after the call. This is part of cursor.JournalsProvider
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
type TruncateInfo ¶
type TruncateInfo struct {
// LatestTs contains timestamp for latest record in the partition
LatestTs uint64
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 uint64
// Max Global size
MaxDBSize uint64
}
TruncateParams allows to provide parameters for Truncate() functions
func (TruncateParams) String ¶
func (tp TruncateParams) String() string