Documentation
¶
Index ¶
Constants ¶
View Source
const ( ArchiveTar ArchiveFormat = "tar" ArchiveTarGzip = "tgz" ArchiveTarZstd = "tzst" )
View Source
const (
// Custom HTTP response header used to report the unique download ID.
HttpHeaderDownloadID = "X-Prombackup-Download-Id"
)
Variables ¶
View Source
var ArchiveFormatAll = []ArchiveFormat{ ArchiveTar, ArchiveTarGzip, ArchiveTarZstd, }
Functions ¶
This section is empty.
Types ¶
type ArchiveFormat ¶
type ArchiveFormat string
func (ArchiveFormat) ContentType ¶
func (f ArchiveFormat) ContentType() string
func (ArchiveFormat) FileExtension ¶
func (f ArchiveFormat) FileExtension() string
func (ArchiveFormat) Name ¶
func (f ArchiveFormat) Name() string
func (ArchiveFormat) String ¶
func (f ArchiveFormat) String() string
type DownloadOptions ¶
type DownloadOptions struct {
// Snapshot name.
SnapshotName string
// Requested archive format.
Format ArchiveFormat
// Function returning a writer for storing the body returned by the server.
BodyWriter func(DownloadResult) (io.Writer, error)
}
DownloadOptions are the options available when requesting the download of a snapshot archive.
type DownloadResult ¶
type DownloadResult struct {
// Unique download ID, used to request the status.
ID string `json:"id"`
// Body content type (e.g. "application/x-tar").
ContentType string
// Parameters for body content type (e.g. "charset").
ContentTypeParams map[string]string
// The preferred filename as reported by the server.
Filename string
}
DownloadResult contains information about a requested snapshot download.
type DownloadStatus ¶
type DownloadStatus struct {
// Unique download ID.
ID string `json:"id"`
// Requested snapshot name.
SnapshotName string `json:"snapshot_name"`
// Finished is non-nil if the server consider the download finished.
Finished *DownloadStatusFinished `json:"finished"`
}
DownloadStatus contains information about an ongoing or recent download.
type DownloadStatusFinished ¶
type DownloadStatusFinished struct {
// Success is true if the server encountered no error while generating the
// snapshot archive.
Success bool `json:"success"`
// ErrorText contains a descriptive error message after the server
// encountered an error.
ErrorText *string `json:"error_text"`
// Sha256Hex is the result of the SHA256 algorithm over the downloaded
// archive.
Sha256Hex string `json:"sha256_hex"`
}
DownloadStatusFinished contains information about a finished download.
type DownloadStatusOptions ¶
type DownloadStatusOptions struct {
// Unique download ID.
ID string `json:"id"`
}
DownloadStatusOptions are the options available when requesting status information about an ongoing or recent download.
type Interface ¶
type Interface interface {
Snapshot(context.Context, SnapshotOptions) (*SnapshotResult, error)
Download(context.Context, DownloadOptions) (*DownloadResult, error)
DownloadStatus(context.Context, DownloadStatusOptions) (*DownloadStatus, error)
Prune(context.Context, PruneOptions) (*PruneResult, error)
}
type PruneOptions ¶
type PruneOptions struct {
// Keep all snapshots within this time interval.
KeepWithin time.Duration `json:"keep_within"`
}
PruneOptions are the options available when requesting pruning of snapshots.
type SnapshotOptions ¶
type SnapshotOptions struct {
// Whether to skip data present in the head block.
SkipHead bool `json:"skip_head"`
}
SnapshotOptions are the options available for requesting a new snapshot.
type SnapshotResult ¶
type SnapshotResult struct {
// Snapshot name.
Name string `json:"name"`
}
SnapshotResult reports the name of a newly created TSDB snapshot.
Click to show internal directories.
Click to hide internal directories.