lib

package
v0.0.0-...-089390d Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2017 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package lib contains: cleaner.go - consul.go - destroy.go - runner.go - snapshot.go - sync.go - take.go - tracker.go

Cleaner removes all keys with the flag #NotWritten and #deleted at the datacenter indicated

Package lib contains: cleaner.go - consul.go - destroy.go - runner.go - snapshot.go - sync.go - take.go - tracker.go

Consul get the status of a Consul member and provides the functions to put or delete a KV pair

Package lib contains: cleaner.go - consul.go - destroy.go - runner.go - snapshot.go - sync.go - take.go - tracker.go

Functions to destroy a snapshot

Package lib contains: cleaner.go - consul.go - destroy.go - runner.go - snapshot.go - sync.go - take.go - tracker.go

Runner provides all ZFS functions to manage the datasets and backups

Package lib contains: cleaner.go - consul.go - destroy.go - runner.go - snapshot.go - sync.go - take.go - tracker.go

Snapshot provides the functions to get the properties of snapshots

Package lib contains: cleaner.go - consul.go - destroy.go - runner.go - snapshot.go - sync.go - take.go - tracker.go

Sync writes a check KV to synchronize zeplic and resynchronize all pairs

Package lib contains: cleaner.go - consul.go - destroy.go - runner.go - snapshot.go - sync.go - take.go - tracker.go

Functions to create a snapshot

Package lib contains: cleaner.go - consul.go - destroy.go - runner.go - snapshot.go - sync.go - take.go - tracker.go

Tracker searchs in local datasets

Index

Constants

View Source
const (
	WasRenamed  = iota + 1 // The snapshot sent was renamed on destination
	WasWritten             // The snapshot sent was written on destination
	NothingToDo            // The snapshot sent already existed on destination
	Zerror                 // Any error string
	NotEmpty               // Need an incremental stream
	Incremental            // Ready to send an incremental stream
	MostActual             // The last snapshot on destination is the most actual
)

Status for response

Variables

This section is empty.

Functions

func Alive

func Alive() bool

Alive returns if the Consul server is available

func Backup

func Backup(ds *zfs.Dataset)

Backup creates a backup snapshot

func Cleaner

func Cleaner(RealDataset string) int

Cleaner deletes all KV pairs with #NotWritten and #deleted flag in dataset

func Client

func Client() (*api.Client, *api.KV)

Client returns a new client of Consul

func Clone

func Clone(clone string, snap *zfs.Dataset)

Clone creates a clone of last snapshot

func CreateTime

func CreateTime(SnapshotName string) (int, time.Month, int, int, int, int)

CreateTime returns the date of snapshot's creation

func Dataset

func Dataset(dataset string) (*zfs.Dataset, error)

Dataset creates a dataset or get an existing one

func DatasetName

func DatasetName(SnapshotName string) string

DatasetName returns the dataset name of snapshot

func DeleteBackup

func DeleteBackup(ds *zfs.Dataset, backup int)

DeleteBackup deletes the backup snapshot

func DeleteClone

func DeleteClone(cl *zfs.Dataset)

DeleteClone deletes an existing clone

func DeleteKV

func DeleteKV(key string, value string, datacenter string) int

DeleteKV removes a KV pair

func Delivery

func Delivery(MapUUID []string, SnapshotName string) ([]byte, bool, bool, *zfs.Dataset, *zfs.Dataset)

Delivery compares the local dataset with the list of UUIDs received

func DestroyOrder

func DestroyOrder(SnapshotUUID []string, SkipIfRenamed bool, SkipIfCloned bool)

DestroyOrder destroys a snapshot based on the order received from director

func Host

func Host() string

Host returns the hostname of the node

func InfoKV

func InfoKV(pair string) (string, string, string)

InfoKV extracts the hostname, uuid, name and flags of snapshot KV pair

func LastSnapshot

func LastSnapshot(ds *zfs.Dataset, prefix string) string

LastSnapshot returns the name of last snapshot in 'dataset'

func ListKV

func ListKV(keyfix string, datacenter string) api.KVPairs

ListKV gets KV pair of Consul

func Policy

func Policy(ds *zfs.Dataset, retention int, consul bool, datacenter string)

Policy applies the retention policy

func Prefix

func Prefix(SnapshotName string) string

Prefix returns the prefix of snapshot name

func PutKV

func PutKV(key string, value string, datacenter string) int

PutKV puts a new KV pair in Consul

func RealList

func RealList(ds *zfs.Dataset, prefix string) (int, []int)

RealList returns the correct amount of snapshots and the index of backup snapshot

func RealRunner

func RealRunner(ds *zfs.Dataset, snap *zfs.Dataset, delClone bool, clone string, director bool, retention int, consul bool, datacenter string, getBackup bool, getClone bool)

RealRunner executes extra ZFS functions if a new snapshot has been created/received

func Resync

func Resync(timezone []string) bool

Resync checks if it is time to execute Update() function

func Retention

func Retention(retention []string) (int, int, int, int)

Retention extracts the struct of retention

func Rollback

func Rollback(snap *zfs.Dataset)

Rollback of last snapshot

func Runner

func Runner(index int, director bool, SnapshotName string, NotWritten bool) int

Runner is a loop that executes 'ZFS' functions for every dataset enabled

func SearchName

func SearchName(uuid string) string

SearchName searchs the name of snapshot from its uuid

func SearchUUID

func SearchUUID(snap *zfs.Dataset) string

SearchUUID searchs the uuid of snapshot from its name

func SnapBackup

func SnapBackup(ds *zfs.Dataset) string

SnapBackup defines the name of a backup snapshot: BACKUP_from_yyyy-Month-dd

func SnapCloned

func SnapCloned(snap *zfs.Dataset) (bool, string)

SnapCloned searchs the name of the dataset where a snapshot was cloned

func SnapName

func SnapName(prefix string) string

SnapName defines the name of the snapshot: PREFIX_yyyy-Month-dd_HH:MM:SS

func SnapRenamed

func SnapRenamed(SnapshotReceived string, SnapshotToCheck string) bool

SnapRenamed returns true if a snapshot was renamed

func Snapshot

func Snapshot(prefix string, ds *zfs.Dataset, consul bool, datacenter string) *zfs.Dataset

Snapshot creates a new snapshot

func Source

func Source(uuid string) string

Source returns if a snapshot has the status local or received

func Sync

func Sync(hostname string, datacenter string, dataset string, index int)

Sync put a new check KV

func TakeOrder

func TakeOrder(DestDataset string, SnapshotName string, NotWritten bool)

TakeOrder creates a new snapshot based on the order received from director

func TakeSnapshot

func TakeSnapshot(SnapshotName string, SkipIfNotWritten bool, ds *zfs.Dataset, consul bool, datacenter string) *zfs.Dataset

TakeSnapshot creates a new snapshot

func UUID

func UUID(snap *zfs.Dataset) error

UUID asigns a new uuid

func Up

func Up(KVList []string, SnapshotsList []string, SourceList []string, DeleteList []int, CreateList []int)

Up *** test for Update() function ***

func Update

func Update(datacenter string, dataset string)

Update updates the KV pairs data in Consul

func Written

func Written(ds *zfs.Dataset, SnapshotName string) bool

Written search changes in dataset

Types

This section is empty.

Jump to

Keyboard shortcuts

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