snapshotter - ActiveState ActiveGo 1.8

Package snapshotter

import ""

Overview ▾

Package snapshotter provides the meta snapshot service.


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

type Client

Client provides an API for the snapshotter service.

type Client struct {
    // contains filtered or unexported fields

func NewClient

func NewClient(host string) *Client

NewClient returns a new *Client.

func (*Client) MetastoreBackup

func (c *Client) MetastoreBackup() (*meta.Data, error)

MetastoreBackup returns a snapshot of the meta store.

type Request

Request represents a request for a specific backup or for information about the shards on this server for a database or retention policy.

type Request struct {
    Type            RequestType
    Database        string
    RetentionPolicy string
    ShardID         uint64
    Since           time.Time

type RequestType

RequestType indicates the typeof snapshot request.

type RequestType uint8
const (
    // RequestShardBackup represents a request for a shard backup.
    RequestShardBackup RequestType = iota

    // RequestMetastoreBackup represents a request to back up the metastore.

    // RequestDatabaseInfo represents a request for database info.

    // RequestRetentionPolicyInfo represents a request for retention policy info.

type Response

Response contains the relative paths for all the shards on this server that are in the requested database or retention policy.

type Response struct {
    Paths []string

type Service

Service manages the listener for the snapshot endpoint.

type Service struct {
    Node *influxdb.Node

    MetaClient interface {
        Database(name string) *meta.DatabaseInfo

    TSDBStore *tsdb.Store

    Listener net.Listener
    Logger   zap.Logger
    // contains filtered or unexported fields

func NewService

func NewService() *Service

NewService returns a new instance of Service.

func (*Service) Close

func (s *Service) Close() error

Close implements the Service interface.

func (*Service) Err

func (s *Service) Err() <-chan error

Err returns a channel for fatal out-of-band errors.

func (*Service) Open

func (s *Service) Open() error

Open starts the service.

func (*Service) WithLogger

func (s *Service) WithLogger(log zap.Logger)

WithLogger sets the logger on the service.