Documentation ¶
Index ¶
- Constants
- Variables
- type Any
- type AuditLog
- type Client
- type Cluster
- type Hosts
- type Monitor
- type Playground
- type Service
- type Storage
- func (s *Storage) CheckoutCluster(name string) error
- func (s *Storage) Close() error
- func (s *Storage) DeleteClient(id string) error
- func (s *Storage) DeleteClientConfig(id string) error
- func (s *Storage) DeleteCluster(name string) error
- func (s *Storage) DeleteMonitor(clusterId int) error
- func (s *Storage) DeletePlayground(name string) error
- func (s *Storage) GetAuditLog(id int64) ([]AuditLog, error)
- func (s *Storage) GetAuditLogs() ([]AuditLog, error)
- func (s *Storage) GetClient(id string) ([]Client, error)
- func (s *Storage) GetClientConfig(id string) ([]Any, error)
- func (s *Storage) GetClientContainerId(id string) (string, error)
- func (s *Storage) GetClients() ([]Client, error)
- func (s *Storage) GetClusters(name string) ([]Cluster, error)
- func (s *Storage) GetContainerId(serviceId string) (string, error)
- func (s *Storage) GetCurrentCluster() (Cluster, error)
- func (s *Storage) GetHostses() ([]Hosts, error)
- func (s *Storage) GetMonitor(clusterId int) (Monitor, error)
- func (s *Storage) GetPlaygroundById(id string) ([]Playground, error)
- func (s *Storage) GetPlaygrounds(name string) ([]Playground, error)
- func (s *Storage) GetServices(clusterId int) ([]Service, error)
- func (s *Storage) GetVersions() ([]Version, error)
- func (s *Storage) InsertAuditLog(time time.Time, workDir, command string, status int) (int64, error)
- func (s *Storage) InsertClient(id, kind, host, containerId, auxInfo string) error
- func (s *Storage) InsertClientConfig(id, data string) error
- func (s *Storage) InsertCluster(name, uuid, description, topology string) error
- func (s *Storage) InsertMonitor(m Monitor) error
- func (s *Storage) InsertPlayground(name, mountPoint string) error
- func (s *Storage) InsertService(clusterId int, serviceId, containerId string) error
- func (s *Storage) ReplaceMonitor(m Monitor) error
- func (s *Storage) SetAuditLogStatus(id int64, status, errorCode int) error
- func (s *Storage) SetClientAuxInfo(id, auxInfo string) error
- func (s *Storage) SetClusterPool(id int, topology, pool string) error
- func (s *Storage) SetClusterTopology(id int, topology string) error
- func (s *Storage) SetContainId(serviceId, containerId string) error
- func (s *Storage) SetHosts(data string) error
- func (s *Storage) SetPlaygroundStatus(name, status string) error
- func (s *Storage) SetVersion(version, lastConfirm string) error
- func (s *Storage) UpdateMonitor(m Monitor) error
- type Version
Constants ¶
View Source
const (
PREFIX_CLIENT_CONFIG = 0x01
)
any item prefix
View Source
const (
REGEX_DB_URL = "^(sqlite|rqlite)://(.+)$"
)
rqlite://127.0.0.1:4000 sqlite:///home/curve/.curveadm/data/curveadm.db
Variables ¶
View Source
var ( // table: version CreateVersionTable = `` /* 141-byte string literal not displayed */ // insert version InsertVersion = `INSERT INTO version(version, lastconfirm) VALUES(?, "")` // set version SetVersion = `UPDATE version SET version = ?, lastconfirm = ? WHERE id = ?` // select version SelectVersion = `SELECT * FROM version` )
View Source
var ( // table: hosts CreateHostsTable = `` /* 142-byte string literal not displayed */ // insert hosts InsertHosts = `INSERT INTO hosts(data, lastmodified_time) VALUES(?, datetime('now','localtime'))` // set hosts SetHosts = `UPDATE hosts SET data = ?, lastmodified_time = datetime('now','localtime') WHERE id = ?` // select hosts SelectHosts = `SELECT * FROM hosts` )
View Source
var ( // table: clusters CreateClustersTable = `` /* 262-byte string literal not displayed */ // insert cluster InsertCluster = `` /* 133-byte string literal not displayed */ // delete cluster DeleteCluster = `DELETE from clusters WHERE name = ?` // select cluster SelectCluster = `SELECT * FROM clusters WHERE name LIKE ?` // get current cluster GetCurrentCluster = `SELECT * FROM clusters WHERE current = 1` // checkout cluster CheckoutCluster = ` UPDATE clusters SET current = CASE name WHEN ? THEN 1 ELSE 0 END ` // set cluster topology SetClusterTopology = `UPDATE clusters SET topology = ? WHERE id = ?` // set cluster pool SetClusterPool = `UPDATE clusters SET topology = ?, pool = ? WHERE id = ?` )
View Source
var ( // table: containers // id: clusterId_role_host_(sequence/name) CreateContainersTable = `` /* 134-byte string literal not displayed */ // insert service InsertService = `INSERT INTO containers(id, cluster_id, container_id) VALUES(?, ?, ?)` // select service SelectService = `SELECT * FROM containers WHERE id = ?` // select services in cluster SelectServicesInCluster = `SELECT * FROM containers WHERE cluster_id = ?` // set service container id SetContainerId = `UPDATE containers SET container_id = ? WHERE id = ?` )
View Source
var ( // table: clients CreateClientsTable = `` /* 172-byte string literal not displayed */ // insert client InsertClient = `INSERT INTO clients(id, kind, host, container_id, aux_info) VALUES(?, ?, ?, ?, ?)` // set client aux info SetClientAuxInfo = `UPDATE clients SET aux_info = ? WHERE id = ?` // select clients SelectClients = `SELECT * FROM clients` // select client by id SelectClientById = `SELECT * FROM clients WHERE id = ?` // delete client DeleteClient = `DELETE from clients WHERE id = ?` )
View Source
var ( // table: playground CreatePlaygroundTable = `` /* 204-byte string literal not displayed */ // insert playground InsertPlayground = `` /* 133-byte string literal not displayed */ // set playground status SetPlaygroundStatus = `UPDATE playgrounds SET status = ? WHERE name = ?` // select playground SelectPlayground = `SELECT * FROM playgrounds WHERE name LIKE ?` // select playground by id SelectPlaygroundById = `SELECT * FROM playgrounds WHERE id = ?` // delete playground DeletePlayground = `DELETE from playgrounds WHERE name = ?` )
View Source
var ( // table: audit CreateAuditTable = `` /* 235-byte string literal not displayed */ // insert audit log InsertAuditLog = ` INSERT INTO audit(execute_time, work_directory, command, status) VALUES(?, ?, ?, ?) ` // set audit log status SetAuditLogStatus = `UPDATE audit SET status = ?, error_code = ? WHERE id = ?` // select audit log SelectAuditLog = `SELECT * FROM audit` // select audit log by id SelectAuditLogById = `SELECT * FROM audit WHERE id = ?` )
View Source
var ( // table: any CreateAnyTable = ` CREATE TABLE IF NOT EXISTS any ( id TEXT PRIMARY KEY, data TEXT NOT NULL ) ` // insert item InsertAnyItem = `INSERT INTO any(id, data) VALUES(?, ?)` // set item SetAnyItem = `UPDATE any SET data = ? WHERE id = ?` // select item by id SelectAnyItem = `SELECT * FROM any WHERE id = ?` // delete item DeleteAnyItem = `DELETE from any WHERE id = ?` )
View Source
var ( // check pool column CheckPoolColumn = ` SELECT COUNT(*) AS total FROM pragma_table_info('clusters') WHERE name='pool' ` // rename clusters table RenameClustersTable = `ALTER TABLE clusters RENAME TO clusters_old` // insert clusters from old table InsertClustersFromOldTable = `` /* 185-byte string literal not displayed */ // statement: drom old clusters table DropOldClustersTable = `DROP TABLE clusters_old` )
View Source
var ( // monitor CreateMonitorTable = ` CREATE TABLE IF NOT EXISTS monitors ( cluster_id INTEGER PRIMARY KEY, monitor TEXT NOT NULL ) ` // monitor InsertMonitor = `INSERT INTO monitors(cluster_id, monitor) VALUES(?, ?)` UpdateMonitor = `UPDATE monitors SET monitor = ? WHERE cluster_id = ?` SelectMonitor = `SELECT monitor FROM monitors WHERE cluster_id = ?` DeleteMonitor = `DELETE FROM monitors WHERE cluster_id = ?` ReplaceMonitor = `REPLACE INTO monitors (cluster_id, monitor) VALUES(?, ?)` )
View Source
var (
ErrInvalidDBUrl = fmt.Errorf("invalid database url")
)
Functions ¶
This section is empty.
Types ¶
type AuditLog ¶ added in v0.0.23
type AuditLog struct { Id int ExecuteTime time.Time WorkDirectory string Command string Status int ErrorCode int }
audit log
type Cluster ¶
type Cluster struct { Id int UUId string Name string Description string CreateTime time.Time Topology string Pool string Current bool }
cluster
type Playground ¶ added in v0.0.25
playground
type Storage ¶
type Storage struct {
// contains filtered or unexported fields
}
func NewStorage ¶
func (*Storage) CheckoutCluster ¶
func (*Storage) DeleteClient ¶ added in v0.1.0
func (*Storage) DeleteClientConfig ¶ added in v0.3.0
func (*Storage) DeleteCluster ¶
func (*Storage) DeleteMonitor ¶ added in v0.3.0
func (*Storage) DeletePlayground ¶ added in v0.0.25
func (*Storage) GetAuditLog ¶ added in v0.1.0
func (*Storage) GetAuditLogs ¶ added in v0.0.23
func (*Storage) GetClientConfig ¶ added in v0.3.0
func (*Storage) GetClientContainerId ¶ added in v0.1.0
func (*Storage) GetClients ¶ added in v0.1.0
func (*Storage) GetCurrentCluster ¶
func (*Storage) GetHostses ¶ added in v0.1.0
func (*Storage) GetMonitor ¶ added in v0.3.0
func (*Storage) GetPlaygroundById ¶ added in v0.2.0
func (s *Storage) GetPlaygroundById(id string) ([]Playground, error)
func (*Storage) GetPlaygrounds ¶ added in v0.0.25
func (s *Storage) GetPlaygrounds(name string) ([]Playground, error)
func (*Storage) GetVersions ¶ added in v0.2.0
func (*Storage) InsertAuditLog ¶ added in v0.0.23
func (s *Storage) InsertAuditLog(time time.Time, workDir, command string, status int) (int64, error)
audit
func (*Storage) InsertClient ¶ added in v0.1.0
client
func (*Storage) InsertClientConfig ¶ added in v0.3.0
func (*Storage) InsertCluster ¶
cluster
func (*Storage) InsertMonitor ¶ added in v0.3.0
func (*Storage) InsertPlayground ¶ added in v0.0.25
playground
func (*Storage) InsertService ¶
service
func (*Storage) ReplaceMonitor ¶ added in v0.3.0
func (*Storage) SetAuditLogStatus ¶ added in v0.1.0
func (*Storage) SetClientAuxInfo ¶ added in v0.3.0
func (*Storage) SetClusterPool ¶ added in v0.0.23
func (*Storage) SetClusterTopology ¶
func (*Storage) SetContainId ¶
func (*Storage) SetPlaygroundStatus ¶ added in v0.0.25
func (*Storage) SetVersion ¶ added in v0.2.0
version
func (*Storage) UpdateMonitor ¶ added in v0.3.0
Click to show internal directories.
Click to hide internal directories.