metadata

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2020 License: Apache-2.0 Imports: 13 Imported by: 41

Documentation

Index

Constants

View Source
const (
	// DeletionMarkFilename is the known json filename to store details about when block is marked for deletion.
	DeletionMarkFilename = "deletion-mark.json"

	// DeletionMarkVersion1 is the version of deletion-mark file supported by Thanos.
	DeletionMarkVersion1 = 1
)
View Source
const (
	// MetaFilename is the known JSON filename for meta information.
	MetaFilename = "meta.json"
)
View Source
const (
	// MetaVersion is a enumeration of meta versions supported by Thanos.
	MetaVersion1 = iota + 1
)

Variables

View Source
var ErrorDeletionMarkNotFound = errors.New("deletion-mark.json not found")

ErrorDeletionMarkNotFound is the error when deletion-mark.json file is not found.

View Source
var ErrorUnmarshalDeletionMark = errors.New("unmarshal deletion-mark.json")

ErrorUnmarshalDeletionMark is the error when unmarshalling deletion-mark.json file. This error can occur because deletion-mark.json has been partially uploaded to block storage or the deletion-mark.json file is not a valid json file.

Functions

func Write

func Write(logger log.Logger, dir string, meta *Meta) error

Write writes the given meta into <dir>/meta.json.

Types

type DeletionMark added in v0.12.0

type DeletionMark struct {
	// ID of the tsdb block.
	ID ulid.ULID `json:"id"`

	// DeletionTime is a unix timestamp of when the block was marked to be deleted.
	DeletionTime int64 `json:"deletion_time"`

	// Version of the file.
	Version int `json:"version"`
}

DeletionMark stores block id and when block was marked for deletion.

func ReadDeletionMark added in v0.12.0

func ReadDeletionMark(ctx context.Context, bkt objstore.InstrumentedBucketReader, logger log.Logger, dir string) (*DeletionMark, error)

ReadDeletionMark reads the given deletion mark file from <dir>/deletion-mark.json in bucket.

type Meta

type Meta struct {
	tsdb.BlockMeta

	Thanos Thanos `json:"thanos"`
}

Meta describes the a block's meta. It wraps the known TSDB meta structure and extends it by Thanos-specific fields.

func InjectThanos

func InjectThanos(logger log.Logger, bdir string, meta Thanos, downsampledMeta *tsdb.BlockMeta) (*Meta, error)

InjectThanos sets Thanos meta to the block meta JSON and saves it to the disk. NOTE: It should be used after writing any block by any Thanos component, otherwise we will miss crucial metadata.

func Read

func Read(dir string) (*Meta, error)

Read reads the given meta from <dir>/meta.json.

type SourceType

type SourceType string
const (
	UnknownSource         SourceType = ""
	SidecarSource         SourceType = "sidecar"
	ReceiveSource         SourceType = "receive"
	CompactorSource       SourceType = "compactor"
	CompactorRepairSource SourceType = "compactor.repair"
	RulerSource           SourceType = "ruler"
	BucketRepairSource    SourceType = "bucket.repair"
	TestSource            SourceType = "test"
)

type Thanos

type Thanos struct {
	Labels     map[string]string `json:"labels"`
	Downsample ThanosDownsample  `json:"downsample"`

	// Source is a real upload source of the block.
	Source SourceType `json:"source"`
}

Thanos holds block meta information specific to Thanos.

type ThanosDownsample

type ThanosDownsample struct {
	Resolution int64 `json:"resolution"`
}

Jump to

Keyboard shortcuts

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