models

package
v0.0.0-...-b9966b1 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2017 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrQueryFailed = logs.Err("Query failed to execute.")
	ErrScan        = logs.Err("Failed to scan query rows.")
	ErrNotFound    = logs.Err("Query not found.")
	ErrConFail     = logs.Err("DB connection failed.")
)
View Source
const (
	Full = iota
	Diff
)
View Source
const (
	StatusGood = iota
	StatusWait
	StatusFail
)
View Source
const (
	SrvSSH = iota
	SrvFTP
	SrvHTTP
	SrvSSBD
)
View Source
const (
	// todo FileDir-->VolFileDir
	FileDir = iota
	SSH
	AWS
	RBD
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	DB *sql.DB
}

func NewClient

func NewClient() (*Client, error)

func (*Client) Close

func (c *Client) Close() error

Close closes the underlying database connection.

func (*Client) GetJobs

func (c *Client) GetJobs() ([]Job, error)

GetJobs returns all jobs.

func (*Client) GetLastFullRunID

func (c *Client) GetLastFullRunID(sid int64, dir string) (int64, error)

func (*Client) GetRuns

func (c *Client) GetRuns() ([]Run, error)

GetRuns returns all Runs.

func (*Client) GetServers

func (c *Client) GetServers() ([]Server, error)

GetServers returns all Servers.

func (*Client) GetVolumes

func (c *Client) GetVolumes() ([]Volume, error)

GetVolumes returns all volumes.

func (*Client) InsertJob

func (c *Client) InsertJob(j Job) (int64, error)

InsertJob inserts Job j.

func (*Client) InsertRun

func (c *Client) InsertRun(r Run) (int64, error)

InsertRun inserts Run r.

func (*Client) InsertServer

func (c *Client) InsertServer(s Server) (int64, error)

InsertServer inserts Server s.

func (*Client) InsertVolume

func (c *Client) InsertVolume(v Volume) (int64, error)

InsertVolume inserts a new volume v.

func (*Client) UpdateJob

func (c *Client) UpdateJob(j Job) error

UpdateJob updates a Job j identified by j.JobID.

func (*Client) UpdateRun

func (c *Client) UpdateRun(r Run) error

UpdateRun updates a Run r identified by r.RunID.

func (*Client) UpdateServer

func (c *Client) UpdateServer(s Server) error

UpdateServer updates a Server s identified by s.ServerID.

func (*Client) UpdateVolume

func (c *Client) UpdateVolume(v Volume) error

UpdateVolume updates a volume v identified by v.VolumeID.

type Handler

type Handler interface {
	// Volumes
	GetVolumes() ([]Volume, error)
	InsertVolume(v Volume) (int64, error)
	UpdateVolume(v Volume) error

	// Servers
	GetServers() ([]Server, error)
	InsertServer(s Server) (int64, error)
	UpdateServer(s Server) error

	// Jobs
	GetJobs() ([]Job, error)
	InsertJob(j Job) (int64, error)
	UpdateJob(j Job) error

	// RunHistory
	GetRuns() ([]Run, error)
	GetLastFullRunID(sid int64, dir string) (int64, error)
	InsertRun(r Run) (int64, error)
	UpdateRun(r Run) error

	Close() error
}

type Job

type Job struct {
	JobID     int64
	ServerID  int64
	VolumeID  int64
	Style     int
	Cron      string
	Directory string
	Squash    bool
	Encrypt   bool
	Key       string
}

type Run

type Run struct {
	RunID  int64
	JobID  int64
	Status int
}

type Server

type Server struct {
	ServerID int64
	Name     string
	Proto    int
	Address  []byte
	Port     int
}

type Volume

type Volume struct {
	VolumeID int64
	Name     string
	Backend  int
	AuthUser string
	AuthPW   string
	Capacity int64
	Free     int64
	Used     int64
}

Jump to

Keyboard shortcuts

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