seriesfile

package
v2.0.0-beta.16 Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2020 License: MIT Imports: 32 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SeriesIndexVersion = 1
	SeriesIndexMagic   = "SIDX"
)
View Source
const (
	// SeriesIDSize is the size in bytes of a series key ID.
	SeriesIDSize        = 8
	SeriesOffsetSize    = 8
	SeriesIndexElemSize = SeriesOffsetSize + SeriesIDSize

	SeriesIndexLoadFactor = 90 // rhh load factor

	SeriesIndexHeaderSize = 0 +
		4 + 1 +
		8 + 8 +
		8 + 8 +
		8 + 8 +
		8 + 8 +
		0
)
View Source
const (
	SeriesSegmentVersion = 1
	SeriesSegmentMagic   = "SSEG"

	SeriesSegmentHeaderSize = 4 + 1 // magic + version
)
View Source
const (
	SeriesEntryFlagSize   = 1
	SeriesEntryHeaderSize = 1 + 8 // flag + id

	SeriesEntryInsertFlag    = 0x01
	SeriesEntryTombstoneFlag = 0x02
)

Series entry constants.

View Source
const (
	// DefaultLargeSeriesWriteThreshold is the number of series per write
	// that requires the series index be pregrown before insert.
	DefaultLargeSeriesWriteThreshold = 10000
)
View Source
const DefaultSeriesPartitionCompactThreshold = 1 << 17 // 128K

DefaultSeriesPartitionCompactThreshold is the number of series IDs to hold in the in-memory series map before compacting and rebuilding the on-disk representation.

View Source
const (
	// SeriesFilePartitionN is the number of partitions a series file is split into.
	SeriesFilePartitionN = 8
)

Variables

View Source
var (
	ErrSeriesFileClosed         = errors.New("tsdb: series file closed")
	ErrInvalidSeriesPartitionID = errors.New("tsdb: invalid series partition id")
)
View Source
var (
	ErrSeriesPartitionClosed              = errors.New("tsdb: series partition closed")
	ErrSeriesPartitionCompactionCancelled = errors.New("tsdb: series partition compaction cancelled")
)
View Source
var (
	ErrInvalidSeriesSegment        = errors.New("invalid series segment")
	ErrInvalidSeriesSegmentVersion = errors.New("invalid series segment version")
	ErrSeriesSegmentNotWritable    = errors.New("series segment not writable")
)
View Source
var ErrInvalidSeriesIndex = errors.New("invalid series index")

Functions

func AppendSeriesEntry

func AppendSeriesEntry(dst []byte, flag uint8, id tsdb.SeriesIDTyped, key []byte) []byte

func AppendSeriesKey

func AppendSeriesKey(dst []byte, name []byte, tags models.Tags) []byte

AppendSeriesKey serializes name and tags to a byte slice. The total length is prepended as a uvarint.

func CompareSeriesKeys

func CompareSeriesKeys(a, b []byte) int

func GenerateSeriesKeys

func GenerateSeriesKeys(names [][]byte, tagsSlice []models.Tags) [][]byte

GenerateSeriesKeys generates series keys for a list of names & tags using a single large memory block.

func IsValidSeriesEntryFlag

func IsValidSeriesEntryFlag(flag byte) bool

IsValidSeriesEntryFlag returns true if flag is valid.

func IsValidSeriesSegmentFilename

func IsValidSeriesSegmentFilename(filename string) bool

IsValidSeriesSegmentFilename returns true if filename is a 4-character lowercase hexadecimal number.

func JoinSeriesOffset

func JoinSeriesOffset(segmentID uint16, pos uint32) int64

JoinSeriesOffset returns an offset that combines the 2-byte segmentID and 4-byte pos.

func ParseSeriesKey

func ParseSeriesKey(data []byte) (name []byte, tags models.Tags)

ParseSeriesKey extracts the name & tags from a series key.

func ParseSeriesKeyInto

func ParseSeriesKeyInto(data []byte, dstTags models.Tags) ([]byte, models.Tags)

ParseSeriesKeyInto extracts the name and tags for data, parsing the tags into dstTags, which is then returened.

The returned dstTags may have a different length and capacity.

func ParseSeriesSegmentFilename

func ParseSeriesSegmentFilename(filename string) (uint16, error)

ParseSeriesSegmentFilename returns the id represented by the hexadecimal filename.

func PrometheusCollectors

func PrometheusCollectors() []prometheus.Collector

PrometheusCollectors returns all the metrics associated with the tsdb package.

func ReadSeriesEntry

func ReadSeriesEntry(data []byte) (flag uint8, id tsdb.SeriesIDTyped, key []byte, sz int64)

func ReadSeriesKey

func ReadSeriesKey(data []byte) (key, remainder []byte)

ReadSeriesKey returns the series key from the beginning of the buffer.

func ReadSeriesKeyFromSegments

func ReadSeriesKeyFromSegments(a []*SeriesSegment, offset int64) []byte

ReadSeriesKeyFromSegments returns a series key from an offset within a set of segments.

func ReadSeriesKeyLen

func ReadSeriesKeyLen(data []byte) (sz int, remainder []byte)

func ReadSeriesKeyMeasurement

func ReadSeriesKeyMeasurement(data []byte) (name, remainder []byte)

func ReadSeriesKeyTag

func ReadSeriesKeyTag(data []byte) (key, value, remainder []byte)

func ReadSeriesKeyTagN

func ReadSeriesKeyTagN(data []byte) (n int, remainder []byte)

func SeriesKeySize

func SeriesKeySize(name []byte, tags models.Tags) int

SeriesKeySize returns the number of bytes required to encode a series key.

func SeriesKeysSize

func SeriesKeysSize(names [][]byte, tagsSlice []models.Tags) int

SeriesKeysSize returns the number of bytes required to encode a list of name/tags.

func SeriesSegmentSize

func SeriesSegmentSize(id uint16) uint32

SeriesSegmentSize returns the maximum size of the segment. The size goes up by powers of 2 starting from 4MB and reaching 256MB.

func SplitSeriesOffset

func SplitSeriesOffset(offset int64) (segmentID uint16, pos uint32)

SplitSeriesOffset splits a offset into its 2-byte segmentID and 4-byte pos parts.

Types

type Config

type Config struct {
	// LargeSeriesWriteThreshold is the threshold before a write requires
	// preallocation to improve throughput. Currently used in the series file.
	LargeSeriesWriteThreshold int `toml:"large-series-write-threshold"`
}

Config contains all of the configuration related to tsdb.

func NewConfig

func NewConfig() Config

NewConfig return a new instance of config with default settings.

type IDData

type IDData struct {
	Offset  int64
	Key     []byte
	Deleted bool
}

IDData keeps track of data about a series ID.

type SeriesFile

type SeriesFile struct {
	LargeWriteThreshold int

	Logger *zap.Logger
	// contains filtered or unexported fields
}

SeriesFile represents the section of the index that holds series data.

func NewSeriesFile

func NewSeriesFile(path string) *SeriesFile

NewSeriesFile returns a new instance of SeriesFile.

func (*SeriesFile) Acquire

func (f *SeriesFile) Acquire() (*lifecycle.Reference, error)

Acquire ensures that the series file won't be closed until after the reference has been released.

func (*SeriesFile) Close

func (f *SeriesFile) Close() error

Close unmaps the data file.

func (*SeriesFile) CreateSeriesListIfNotExists

func (f *SeriesFile) CreateSeriesListIfNotExists(collection *tsdb.SeriesCollection) error

CreateSeriesListIfNotExists creates a list of series in bulk if they don't exist. It overwrites the collection's Keys and SeriesIDs fields. The collection's SeriesIDs slice will have IDs for every name+tags, creating new series IDs as needed. If any SeriesID is zero, then a type conflict has occurred for that series.

func (*SeriesFile) DeleteSeriesIDs

func (f *SeriesFile) DeleteSeriesIDs(ids []tsdb.SeriesID) error

DeleteSeriesID flags a list of series as permanently deleted. If a series is reintroduced later then it must create a new id.

func (*SeriesFile) DisableCompactions

func (f *SeriesFile) DisableCompactions()

DisableCompactions prevents new compactions from running.

func (*SeriesFile) DisableMetrics

func (f *SeriesFile) DisableMetrics()

DisableMetrics ensures that activity is not collected via the prometheus metrics. DisableMetrics must be called before Open.

func (*SeriesFile) EnableCompactions

func (f *SeriesFile) EnableCompactions()

EnableCompactions allows compactions to run.

func (*SeriesFile) FileSize

func (f *SeriesFile) FileSize() (n int64, err error)

FileSize returns the size of all partitions, in bytes.

func (*SeriesFile) HasSeries

func (f *SeriesFile) HasSeries(name []byte, tags models.Tags, buf []byte) bool

HasSeries return true if the series exists.

func (*SeriesFile) IsDeleted

func (f *SeriesFile) IsDeleted(id tsdb.SeriesID) bool

IsDeleted returns true if the ID has been deleted before.

func (*SeriesFile) Open

func (f *SeriesFile) Open(ctx context.Context) error

Open memory maps the data file at the file's path.

func (*SeriesFile) Partitions

func (f *SeriesFile) Partitions() []*SeriesPartition

Partitions returns all partitions.

func (*SeriesFile) Path

func (f *SeriesFile) Path() string

Path returns the path to the file.

func (*SeriesFile) Series

func (f *SeriesFile) Series(id tsdb.SeriesID) ([]byte, models.Tags)

Series returns the parsed series name and tags for an offset.

func (*SeriesFile) SeriesCount

func (f *SeriesFile) SeriesCount() uint64

SeriesCount returns the number of series.

func (*SeriesFile) SeriesID

func (f *SeriesFile) SeriesID(name []byte, tags models.Tags, buf []byte) tsdb.SeriesID

SeriesID returns the series id for the series.

func (*SeriesFile) SeriesIDPartition

func (f *SeriesFile) SeriesIDPartition(id tsdb.SeriesID) *SeriesPartition

func (*SeriesFile) SeriesIDPartitionID

func (f *SeriesFile) SeriesIDPartitionID(id tsdb.SeriesID) int

func (*SeriesFile) SeriesIDTyped

func (f *SeriesFile) SeriesIDTyped(name []byte, tags models.Tags, buf []byte) tsdb.SeriesIDTyped

SeriesIDTyped returns the typed series id for the series.

func (*SeriesFile) SeriesIDTypedBySeriesKey

func (f *SeriesFile) SeriesIDTypedBySeriesKey(key []byte) tsdb.SeriesIDTyped

SeriesIDTypedBySeriesKey returns the typed series id for the series.

func (*SeriesFile) SeriesIDs

func (f *SeriesFile) SeriesIDs() []tsdb.SeriesID

SeriesIDs returns a slice of series IDs in all partitions, sorted. This may return a lot of data at once, so use sparingly.

func (*SeriesFile) SeriesKey

func (f *SeriesFile) SeriesKey(id tsdb.SeriesID) []byte

SeriesKey returns the series key for a given id.

func (*SeriesFile) SeriesKeyName

func (f *SeriesFile) SeriesKeyName(id tsdb.SeriesID) []byte

SeriesKeyName returns the measurement name for a series id.

func (*SeriesFile) SeriesKeyPartition

func (f *SeriesFile) SeriesKeyPartition(key []byte) *SeriesPartition

func (*SeriesFile) SeriesKeyPartitionID

func (f *SeriesFile) SeriesKeyPartitionID(key []byte) int

func (*SeriesFile) SeriesKeys

func (f *SeriesFile) SeriesKeys(ids []tsdb.SeriesID) [][]byte

SeriesKeys returns a list of series keys from a list of ids.

func (*SeriesFile) SeriesKeysPartitionIDs

func (f *SeriesFile) SeriesKeysPartitionIDs(keys [][]byte) []int

func (*SeriesFile) SeriesPartitionPath

func (f *SeriesFile) SeriesPartitionPath(i int) string

SeriesPartitionPath returns the path to a given partition.

func (*SeriesFile) SetDefaultMetricLabels

func (f *SeriesFile) SetDefaultMetricLabels(labels prometheus.Labels)

SetDefaultMetricLabels sets the default labels for metrics on the Series File. It must be called before the SeriesFile is opened.

func (*SeriesFile) WithLogger

func (f *SeriesFile) WithLogger(log *zap.Logger)

WithLogger sets the logger on the SeriesFile and all underlying partitions. It must be called before Open.

func (*SeriesFile) WithPageFaultLimiter

func (f *SeriesFile) WithPageFaultLimiter(limiter *rate.Limiter)

WithPageFaultLimiter sets a limiter to restrict the number of page faults.

type SeriesIndex

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

SeriesIndex represents an index of key-to-id & id-to-offset mappings.

func NewSeriesIndex

func NewSeriesIndex(path string) *SeriesIndex

func (*SeriesIndex) Clone

func (idx *SeriesIndex) Clone() *SeriesIndex

Clone returns a copy of idx for use during compaction. In-memory maps are not cloned.

func (*SeriesIndex) Close

func (idx *SeriesIndex) Close() (err error)

Close unmaps the index file.

func (*SeriesIndex) Count

func (idx *SeriesIndex) Count() uint64

Count returns the number of series in the index.

func (*SeriesIndex) Delete

func (idx *SeriesIndex) Delete(id tsdb.SeriesID)

Delete marks the series id as deleted.

func (*SeriesIndex) FindIDByNameTags

func (idx *SeriesIndex) FindIDByNameTags(segments []*SeriesSegment, name []byte, tags models.Tags, buf []byte) tsdb.SeriesIDTyped

func (*SeriesIndex) FindIDBySeriesKey

func (idx *SeriesIndex) FindIDBySeriesKey(segments []*SeriesSegment, key []byte) tsdb.SeriesIDTyped

func (*SeriesIndex) FindIDListByNameTags

func (idx *SeriesIndex) FindIDListByNameTags(segments []*SeriesSegment, names [][]byte, tagsSlice []models.Tags, buf []byte) (ids []tsdb.SeriesIDTyped, ok bool)

func (*SeriesIndex) FindOffsetByID

func (idx *SeriesIndex) FindOffsetByID(id tsdb.SeriesID) int64

func (*SeriesIndex) GrowBy

func (idx *SeriesIndex) GrowBy(delta int)

GrowBy preallocates the in-memory hashmap to a larger size.

func (*SeriesIndex) InMemCount

func (idx *SeriesIndex) InMemCount() uint64

InMemCount returns the number of series in the in-memory index.

func (*SeriesIndex) InMemSize

func (idx *SeriesIndex) InMemSize() uint64

InMemSize returns the heap size of the index in bytes. The returned value is an estimation and does not include include all allocated memory.

func (*SeriesIndex) Insert

func (idx *SeriesIndex) Insert(key []byte, id tsdb.SeriesIDTyped, offset int64)

func (*SeriesIndex) IsDeleted

func (idx *SeriesIndex) IsDeleted(id tsdb.SeriesID) bool

IsDeleted returns true if series id has been deleted.

func (*SeriesIndex) OnDiskCount

func (idx *SeriesIndex) OnDiskCount() uint64

OnDiskCount returns the number of series in the on-disk index.

func (*SeriesIndex) OnDiskSize

func (idx *SeriesIndex) OnDiskSize() uint64

OnDiskSize returns the on-disk size of the index in bytes.

func (*SeriesIndex) Open

func (idx *SeriesIndex) Open() (err error)

Open memory-maps the index file.

func (*SeriesIndex) Recover

func (idx *SeriesIndex) Recover(segments []*SeriesSegment) error

Recover rebuilds the in-memory index for all new entries.

func (*SeriesIndex) SetPageFaultLimiter

func (idx *SeriesIndex) SetPageFaultLimiter(limiter *rate.Limiter)

SetPageFaultLimiter sets the limiter used for rate limiting page faults. Must be called after Open().

type SeriesIndexHeader

type SeriesIndexHeader struct {
	Version uint8

	MaxSeriesID tsdb.SeriesID
	MaxOffset   int64

	Count    uint64
	Capacity int64

	KeyIDMap struct {
		Offset int64
		Size   int64
	}

	IDOffsetMap struct {
		Offset int64
		Size   int64
	}
}

SeriesIndexHeader represents the header of a series index.

func NewSeriesIndexHeader

func NewSeriesIndexHeader() SeriesIndexHeader

NewSeriesIndexHeader returns a new instance of SeriesIndexHeader.

func ReadSeriesIndexHeader

func ReadSeriesIndexHeader(data []byte) (hdr SeriesIndexHeader, err error)

ReadSeriesIndexHeader returns the header from data.

func (*SeriesIndexHeader) WriteTo

func (hdr *SeriesIndexHeader) WriteTo(w io.Writer) (n int64, err error)

WriteTo writes the header to w.

type SeriesPartition

type SeriesPartition struct {
	CompactThreshold    int
	LargeWriteThreshold int

	Logger *zap.Logger
	// contains filtered or unexported fields
}

SeriesPartition represents a subset of series file data.

func NewSeriesPartition

func NewSeriesPartition(id int, path string) *SeriesPartition

NewSeriesPartition returns a new instance of SeriesPartition.

func (*SeriesPartition) AppendSeriesIDs

func (p *SeriesPartition) AppendSeriesIDs(a []tsdb.SeriesID) []tsdb.SeriesID

AppendSeriesIDs returns a list of all series ids.

func (*SeriesPartition) Close

func (p *SeriesPartition) Close() (err error)

Close unmaps the data files.

func (*SeriesPartition) Compacting

func (p *SeriesPartition) Compacting() bool

Compacting returns if the SeriesPartition is currently compacting.

func (*SeriesPartition) CreateSeriesListIfNotExists

func (p *SeriesPartition) CreateSeriesListIfNotExists(collection *tsdb.SeriesCollection, keyPartitionIDs []int) error

CreateSeriesListIfNotExists creates a list of series in bulk if they don't exist. The ids parameter is modified to contain series IDs for all keys belonging to this partition. If the type does not match the existing type for the key, a zero id is stored.

func (*SeriesPartition) DeleteSeriesIDs

func (p *SeriesPartition) DeleteSeriesIDs(ids []tsdb.SeriesID) error

DeleteSeriesID flags a list of series as permanently deleted. If a series is reintroduced later then it must create a new id.

func (*SeriesPartition) DisableCompactions

func (p *SeriesPartition) DisableCompactions()

func (*SeriesPartition) DiskSize

func (p *SeriesPartition) DiskSize() uint64

DiskSize returns the number of bytes taken up on disk by the partition.

func (*SeriesPartition) EnableCompactions

func (p *SeriesPartition) EnableCompactions()

func (*SeriesPartition) FileSize

func (p *SeriesPartition) FileSize() (n int64, err error)

FileSize returns the size of all partitions, in bytes.

func (*SeriesPartition) FindIDBySeriesKey

func (p *SeriesPartition) FindIDBySeriesKey(key []byte) tsdb.SeriesID

FindIDBySeriesKey return the series id for the series key.

func (*SeriesPartition) FindIDTypedBySeriesKey

func (p *SeriesPartition) FindIDTypedBySeriesKey(key []byte) tsdb.SeriesIDTyped

FindIDTypedBySeriesKey return the typed series id for the series key.

func (*SeriesPartition) ID

func (p *SeriesPartition) ID() int

ID returns the partition id.

func (*SeriesPartition) Index

func (p *SeriesPartition) Index() *SeriesIndex

Index returns the partition's index.

func (*SeriesPartition) IndexPath

func (p *SeriesPartition) IndexPath() string

IndexPath returns the path to the series index.

func (*SeriesPartition) IsDeleted

func (p *SeriesPartition) IsDeleted(id tsdb.SeriesID) bool

IsDeleted returns true if the ID has been deleted before.

func (*SeriesPartition) Open

func (p *SeriesPartition) Open() error

Open memory maps the data file at the partition's path.

func (*SeriesPartition) Path

func (p *SeriesPartition) Path() string

Path returns the path to the partition.

func (*SeriesPartition) Segments

func (p *SeriesPartition) Segments() []*SeriesSegment

Segments returns the segments in the partition.

func (*SeriesPartition) Series

func (p *SeriesPartition) Series(id tsdb.SeriesID) ([]byte, models.Tags)

Series returns the parsed series name and tags for an offset.

func (*SeriesPartition) SeriesCount

func (p *SeriesPartition) SeriesCount() uint64

SeriesCount returns the number of series.

func (*SeriesPartition) SeriesKey

func (p *SeriesPartition) SeriesKey(id tsdb.SeriesID) []byte

SeriesKey returns the series key for a given id.

type SeriesPartitionCompactor

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

SeriesPartitionCompactor represents an object reindexes a series partition and optionally compacts segments.

func NewSeriesPartitionCompactor

func NewSeriesPartitionCompactor() *SeriesPartitionCompactor

NewSeriesPartitionCompactor returns a new instance of SeriesPartitionCompactor.

func (*SeriesPartitionCompactor) Compact

Compact rebuilds the series partition index.

type SeriesSegment

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

SeriesSegment represents a log of series entries.

func CloneSeriesSegments

func CloneSeriesSegments(a []*SeriesSegment) []*SeriesSegment

CloneSeriesSegments returns a copy of a slice of segments.

func CreateSeriesSegment

func CreateSeriesSegment(id uint16, path string) (*SeriesSegment, error)

CreateSeriesSegment generates an empty segment at path.

func FindSegment

func FindSegment(a []*SeriesSegment, id uint16) *SeriesSegment

FindSegment returns a segment by id.

func NewSeriesSegment

func NewSeriesSegment(id uint16, path string) *SeriesSegment

NewSeriesSegment returns a new instance of SeriesSegment.

func (*SeriesSegment) AppendSeriesIDs

func (s *SeriesSegment) AppendSeriesIDs(a []tsdb.SeriesID) []tsdb.SeriesID

AppendSeriesIDs appends all the segments ids to a slice. Returns the new slice.

func (*SeriesSegment) CanWrite

func (s *SeriesSegment) CanWrite(data []byte) bool

CanWrite returns true if segment has space to write entry data.

func (*SeriesSegment) Clone

func (s *SeriesSegment) Clone() *SeriesSegment

Clone returns a copy of the segment. Excludes the write handler, if set.

func (*SeriesSegment) Close

func (s *SeriesSegment) Close() (err error)

Close unmaps the segment.

func (*SeriesSegment) CloseForWrite

func (s *SeriesSegment) CloseForWrite() (err error)

func (*SeriesSegment) CompactToPath

func (s *SeriesSegment) CompactToPath(path string, index *SeriesIndex) error

CompactToPath rewrites the segment to a new file and removes tombstoned entries.

func (*SeriesSegment) Data

func (s *SeriesSegment) Data() []byte

Data returns the raw data.

func (*SeriesSegment) Flush

func (s *SeriesSegment) Flush() error

Flush flushes the buffer to disk.

func (*SeriesSegment) ForEachEntry

func (s *SeriesSegment) ForEachEntry(fn func(flag uint8, id tsdb.SeriesIDTyped, offset int64, key []byte) error) error

ForEachEntry executes fn for every entry in the segment.

func (*SeriesSegment) ID

func (s *SeriesSegment) ID() uint16

ID returns the id the segment was initialized with.

func (*SeriesSegment) InitForWrite

func (s *SeriesSegment) InitForWrite() (err error)

InitForWrite initializes a write handle for the segment. This is only used for the last segment in the series file.

func (*SeriesSegment) MaxSeriesID

func (s *SeriesSegment) MaxSeriesID() tsdb.SeriesID

MaxSeriesID returns the highest series id in the segment.

func (*SeriesSegment) Open

func (s *SeriesSegment) Open() error

Open memory maps the data file at the file's path.

func (*SeriesSegment) Path

func (s *SeriesSegment) Path() string

func (*SeriesSegment) SetPageFaultLimiter

func (s *SeriesSegment) SetPageFaultLimiter(limiter *rate.Limiter)

SetPageFaultLimiter sets the limiter used for rate limiting page faults. Must be called after Open().

func (*SeriesSegment) Size

func (s *SeriesSegment) Size() int64

Size returns the size of the data in the segment. This is only populated once InitForWrite() is called.

func (*SeriesSegment) Slice

func (s *SeriesSegment) Slice(pos uint32) []byte

Slice returns a byte slice starting at pos.

func (*SeriesSegment) WriteLogEntry

func (s *SeriesSegment) WriteLogEntry(data []byte) (offset int64, err error)

WriteLogEntry writes entry data into the segment. Returns the offset of the beginning of the entry.

type SeriesSegmentHeader

type SeriesSegmentHeader struct {
	Version uint8
}

SeriesSegmentHeader represents the header of a series segment.

func NewSeriesSegmentHeader

func NewSeriesSegmentHeader() SeriesSegmentHeader

NewSeriesSegmentHeader returns a new instance of SeriesSegmentHeader.

func ReadSeriesSegmentHeader

func ReadSeriesSegmentHeader(data []byte) (hdr SeriesSegmentHeader, err error)

ReadSeriesSegmentHeader returns the header from data.

func (*SeriesSegmentHeader) WriteTo

func (hdr *SeriesSegmentHeader) WriteTo(w io.Writer) (n int64, err error)

WriteTo writes the header to w.

type Verify

type Verify struct {
	Concurrent int
	Logger     *zap.Logger
	// contains filtered or unexported fields
}

Verify contains configuration for running verification of series files.

func NewVerify

func NewVerify() Verify

NewVerify constructs a Verify with good defaults.

func (Verify) VerifyIndex

func (v Verify) VerifyIndex(indexPath string, segments []*SeriesSegment,
	ids map[uint64]IDData) (valid bool, err error)

VerifyIndex performs verification on an index in a series file. The error is only returned if there was some fatal problem with operating, not if there was a problem with the partition. The ids map must be built from verifying the passed in segments.

func (Verify) VerifyPartition

func (v Verify) VerifyPartition(partitionPath string) (valid bool, err error)

VerifyPartition performs verifications on a partition of a series file. The error is only returned if there was some fatal problem with operating, not if there was a problem with the partition.

func (Verify) VerifySegment

func (v Verify) VerifySegment(segmentPath string, ids map[uint64]IDData) (valid bool, err error)

VerifySegment performs verifications on a segment of a series file. The error is only returned if there was some fatal problem with operating, not if there was a problem with the partition. The ids map is populated with information about the ids stored in the segment.

func (Verify) VerifySeriesFile

func (v Verify) VerifySeriesFile(filePath string) (valid bool, err error)

VerifySeriesFile performs verifications on a series file. The error is only returned if there was some fatal problem with operating, not if there was a problem with the series file.

Jump to

Keyboard shortcuts

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