config

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: 9 Imported by: 0

Documentation

Overview

Package config contains: local.go - server.go - signal.go - syslog.go - version.go

Local reads and extracts the information JSON configuration file

Package config contains: local.go - server.go - signal.go - syslog.go - version.go

Server keeps the struct of server json file and extracts all data

Package config contains: local.go - server.go - signal.go - syslog.go - version.go

Signal gets the process ID of zeplic and sends to the process SIGTERM/SIGHUP

Package config contains: local.go - server.go - signal.go - syslog.go - version.go

Syslog establishes a new connection with the syslog daemon and writes in the log file, all messages return by the functions

Package config contains: local.go - server.go - signal.go - syslog.go - version.go

Version gets the commit version and date of last zeplic build

Index

Constants

This section is empty.

Variables

View Source
var (
	// LogService returns the writer of syslog
	LogService *syslog.Writer
	// SyslogFilePath returns the path of syslog config file
	SyslogFilePath string
	// Facility applies the priority
	Facility syslog.Priority
)
View Source
var (
	// BuildTime gets date of last build
	BuildTime string
	// Commit gets the last commit
	Commit string
	// Version show the version of zeplic
	Version string
)
View Source
var LocalFilePath string

LocalFilePath returns the path of JSON config file

View Source
var PidFilePath string

PidFilePath gets the path of pid file

View Source
var ServerFilePath string

ServerFilePath returns the path of JSON config file

Functions

func Leave

func Leave() int

Leave sends a SIGTERM signal to zeplic process ID

func LogBook

func LogBook() *syslog.Writer

LogBook checks the configuration of syslog and creates a new connection with the service

func Logger

func Logger(log string) syslog.Priority

Logger returns the facility of LOCAL variable

func Pid

func Pid() error

Pid writes the pid of zeplic pid file

func ShowVersion

func ShowVersion() string

ShowVersion shows the version of zeplic

Types

type Actions

type Actions struct {
	Hostname         string `json:"hostname"`
	Dataset          string `json:"dataset"`
	Backup           Cold
	Sync             Hot
	RollbackIfNeeded bool `json:"rollback_if_needed"`
	SkipIfRenamed    bool `json:"skip_if_renamed"`
	SkipIfNotWritten bool `json:"skip_if_not_written"`
	SkipIfCloned     bool `json:"skip_if_cloned"`
}

Actions contains the information of replicate every snapshot

type Cold

type Cold struct {
	Prefix      string   `json:"prefix"`
	Creation    string   `json:"creation"`
	SyncOn      string   `json:"sync_on"`
	SyncDataset string   `json:"sync_dataset"`
	SyncPolicy  string   `json:"sync_policy"`
	Retention   []string `json:"retention"`
}

Cold contains the information of backup snapshot

type Config

type Config struct {
	Resync     []string  `json:"consul_resync"`
	Datacenter string    `json:"datacenter"`
	Director   []Actions `json:"datasets"`
}

Config extracts the interface of JSON server file

func Server

func Server() Config

Server extracts all data from server json file

type Copy

type Copy struct {
	Enable bool   `json:"enable"`
	Name   string `json:"name"`
	Delete bool   `json:"delete"`
}

Copy contains Clone options

type Data

type Data struct {
	Enable    bool   `json:"enable"`
	Slave     bool   `json:"slave"`
	Name      string `json:"name"`
	Consul    Sync
	Prefix    string `json:"snap_prefix"`
	Retention int    `json:"snap_retention"`
	Backup    bool   `json:"backup"`
	Clone     Copy
}

Data contains the information of each dataset

type Hot

type Hot struct {
	Prefix      string   `json:"prefix"`
	Creation    string   `json:"creation"`
	SyncOn      string   `json:"sync_on"`
	SyncDataset string   `json:"sync_dataset"`
	SyncPolicy  string   `json:"sync_policy"`
	Retention   []string `json:"retention"`
}

Hot contains the information of synchronization snapshot

type Log

type Log struct {
	Enable bool   `json:"enable"`
	Mode   string `json:"mode"`
	Info   string `json:"info"`
}

Log extracts the interface of JSON file

type Pool

type Pool struct {
	Dataset []Data `json:"local_datasets"`
}

Pool extracts the interface of JSON file

func Local

func Local() Pool

Local reads the local json file and checks how many datasets are there and its data

type Sync

type Sync struct {
	Enable     bool   `json:"enable"`
	Datacenter string `json:"datacenter"`
}

Sync contains Consul options

Jump to

Keyboard shortcuts

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