shipper

package
v0.41.0 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2026 License: Apache-2.0 Imports: 21 Imported by: 5

Documentation

Overview

Package shipper detects directories on the local file system and uploads them to a block storage.

Index

Constants

View Source
const (
	// DefaultMetaFilename is the default JSON filename for meta information.
	DefaultMetaFilename = "thanos.shipper.json"

	// MetaVersion1 represents 1 version of meta.
	MetaVersion1 = 1
)

Variables

View Source
var (
	ErrorSyncBlockCorrupted = errors.New("corrupted blocks found")
)

Functions

func WriteMetaFile

func WriteMetaFile(logger log.Logger, path string, meta *Meta) error

WriteMetaFile writes the given meta into <dir>/thanos.shipper.json.

Types

type Meta

type Meta struct {
	Version  int         `json:"version"`
	Uploaded []ulid.ULID `json:"uploaded"`
}

Meta defines the format thanos.shipper.json file that the shipper places in the data directory.

func ReadMetaFile

func ReadMetaFile(path string) (*Meta, error)

ReadMetaFile reads the given meta from <dir>/thanos.shipper.json.

type Option added in v0.39.0

type Option func(*shipperOptions)

func WithAllowOutOfOrderUploads added in v0.39.0

func WithAllowOutOfOrderUploads(allow bool) Option

WithAllowOutOfOrderUploads sets whether to allow out of order uploads.

func WithHashFunc added in v0.39.0

func WithHashFunc(hashFunc metadata.HashFunc) Option

WithHashFunc sets the hash function.

func WithLabels added in v0.39.0

func WithLabels(lbls func() labels.Labels) Option

WithLabels sets the labels function.

func WithLogger added in v0.39.0

func WithLogger(logger log.Logger) Option

WithLogger sets the logger.

func WithMetaFileName added in v0.39.0

func WithMetaFileName(name string) Option

WithMetaFileName sets the meta file name.

func WithRegisterer added in v0.39.0

func WithRegisterer(r prometheus.Registerer) Option

WithRegisterer sets the Prometheus registerer.

func WithSkipCorruptedBlocks added in v0.39.0

func WithSkipCorruptedBlocks(skip bool) Option

WithSkipCorruptedBlocks sets whether to skip corrupted blocks.

func WithSource added in v0.39.0

func WithSource(source metadata.SourceType) Option

WithSource sets the metadata source type.

func WithUploadCompacted added in v0.39.0

func WithUploadCompacted(upload bool) Option

WithUploadCompacted sets whether to upload compacted blocks.

func WithUploadConcurrency added in v0.41.0

func WithUploadConcurrency(concurrency int) Option

WithUploadConcurrency sets the number of goroutines to use when uploading block files.

type Shipper

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

Shipper watches a directory for matching files and directories and uploads them to a remote data store.

func New

func New(bucket objstore.Bucket, dir string, opts ...Option) *Shipper

New creates a new shipper that detects new TSDB blocks in dir and uploads them to remote if necessary. It attaches the Thanos metadata section in each meta JSON file. If uploadCompacted is enabled, it also uploads compacted blocks which are already in filesystem.

func (*Shipper) SetLabels added in v0.32.0

func (s *Shipper) SetLabels(lbls labels.Labels)

func (*Shipper) Sync

func (s *Shipper) Sync(ctx context.Context) (uploaded int, err error)

Sync performs a single synchronization, which ensures all non-compacted local blocks have been uploaded to the object bucket once.

If uploaded.

It is not concurrency-safe, however it is compactor-safe (running concurrently with compactor is ok).

func (*Shipper) UploadedBlocks added in v0.35.0

func (s *Shipper) UploadedBlocks() map[ulid.ULID]struct{}

Jump to

Keyboard shortcuts

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