package snapshotter
import "github.com/influxdata/influxdb/services/snapshotter"
Package snapshotter provides the meta snapshot service.
Index ¶
- Constants
- type Client
- func NewClient(host string) *Client
- func (c *Client) MetastoreBackup() (*meta.Data, error)
- func (c *Client) UpdateMeta(req *Request, upStream io.Reader) (map[uint64]uint64, error)
- func (c *Client) UploadShard(shardID, newShardID uint64, destinationDatabase, restoreRetention string, tr *tar.Reader) error
- type MetaClient
- type OSSMetaClient
- type Request
- type RequestType
- type Response
- type Service
Constants ¶
const ( // MuxHeader is the header byte used for the TCP muxer. MuxHeader = 3 // BackupMagicHeader is the first 8 bytes used to identify and validate // a metastore backup file BackupMagicHeader = 0x59590101 )
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client provides an API for the snapshotter service.
func NewClient ¶
NewClient returns a new *Client.
func (*Client) MetastoreBackup ¶
MetastoreBackup returns a snapshot of the meta store.
func (*Client) UpdateMeta ¶
UpdateMeta takes a request object, writes a Base64 encoding to the tcp connection, and then sends the request to the snapshotter service. returns a mapping of the uploaded metadata shardID's to actual shardID's on the destination system.
func (*Client) UploadShard ¶
func (c *Client) UploadShard(shardID, newShardID uint64, destinationDatabase, restoreRetention string, tr *tar.Reader) error
UploadShard writes a snapshot of the data to disk at the location specified by destinationDatabase and restoreRetention
type MetaClient ¶
type MetaClient interface { encoding.BinaryMarshaler Database(name string) *meta.DatabaseInfo }
type OSSMetaClient ¶
type Request ¶
type Request struct { Type RequestType BackupDatabase string RestoreDatabase string BackupRetentionPolicy string RestoreRetentionPolicy string ShardID uint64 Since time.Time ExportStart time.Time ExportEnd time.Time UploadSize int64 }
Request represents a request for a specific backup or for information about the shards on this server for a database or retention policy.
type RequestType ¶
type RequestType uint8
RequestType indicates the typeof snapshot request.
const ( // RequestShardBackup represents a request for a shard backup. RequestShardBackup RequestType = iota // RequestMetastoreBackup represents a request to back up the metastore. RequestMetastoreBackup // RequestSeriesFileBackup represents a request to back up the database series file. RequestSeriesFileBackup // RequestDatabaseInfo represents a request for database info. RequestDatabaseInfo // RequestRetentionPolicyInfo represents a request for retention policy info. RequestRetentionPolicyInfo // RequestShardExport represents a request to export Shard data. Similar to a backup, but shards // may be filtered based on the start/end times on each block. RequestShardExport // RequestMetaStoreUpdate represents a request to upload a metafile that will be used to do a live update // to the existing metastore. RequestMetaStoreUpdate // RequestShardUpdate will initiate the upload of a shard data tar file // and have the engine import the data. RequestShardUpdate )
type Response ¶
type Response struct { Paths []string }
Response contains the relative paths for all the shards on this server that are in the requested database or retention policy.
type Service ¶
type Service struct { Node *influxdb.Node MetaClient MetaClient TSDBStore interface { BackupShard(id uint64, since time.Time, w io.Writer) error ExportShard(id uint64, ExportStart time.Time, ExportEnd time.Time, w io.Writer) error Shard(id uint64) *tsdb.Shard ShardRelativePath(id uint64) (string, error) SetShardEnabled(shardID uint64, enabled bool) error RestoreShard(id uint64, r io.Reader) error CreateShard(database, retentionPolicy string, shardID uint64, enabled bool) error } Listener net.Listener Logger *zap.Logger // contains filtered or unexported fields }
Service manages the listener for the snapshot endpoint.
func NewService ¶
func NewService() *Service
NewService returns a new instance of Service.
func (*Service) Close ¶
Close implements the Service interface.
func (*Service) Open ¶
Open starts the service.
func (*Service) WithLogger ¶
WithLogger sets the logger on the service.
Source Files ¶
- Version
- v1.12.0 (latest)
- Published
- Apr 8, 2025
- Platform
- linux/amd64
- Imports
- 19 packages
- Last checked
- 2 days ago –
Tools for package owners.