Documentation ¶
Overview ¶
Package datastore retrieves stores data for the ciao controller. This package caches most data in memory, and uses a sql database as persistent storage.
Index ¶
- type Config
- type Datastore
- func (ds *Datastore) AddCNCIIP(cnciMAC string, ip string) error
- func (ds *Datastore) AddInstance(instance *types.Instance) error
- func (ds *Datastore) AddLimit(tenantID string, resourceID int, limit int) error
- func (ds *Datastore) AddTenant(id string) (*types.Tenant, error)
- func (ds *Datastore) AddTenantCNCI(tenantID string, instanceID string, mac string) error
- func (ds *Datastore) AddTenantChan(c chan bool, tenantID string)
- func (ds *Datastore) AllocateTenantIP(tenantID string) (net.IP, error)
- func (ds *Datastore) ClearLog() error
- func (ds *Datastore) DeleteInstance(instanceID string) error
- func (ds *Datastore) DeleteNode(nodeID string) error
- func (ds *Datastore) Exit()
- func (ds *Datastore) GetAllInstances() ([]*types.Instance, error)
- func (ds *Datastore) GetAllInstancesByNode(nodeID string) ([]*types.Instance, error)
- func (ds *Datastore) GetAllInstancesFromTenant(tenantID string) ([]*types.Instance, error)
- func (ds *Datastore) GetAllTenants() ([]*types.Tenant, error)
- func (ds *Datastore) GetBatchFrameStatistics(label string) ([]types.BatchFrameStat, error)
- func (ds *Datastore) GetBatchFrameSummary() ([]types.BatchFrameSummary, error)
- func (ds *Datastore) GetCNCIWorkloadID() (string, error)
- func (ds *Datastore) GetEventLog() ([]*types.LogEntry, error)
- func (ds *Datastore) GetInstance(id string) (*types.Instance, error)
- func (ds *Datastore) GetInstanceLastStats(nodeID string) payloads.CiaoServersStats
- func (ds *Datastore) GetNodeLastStats() payloads.CiaoComputeNodes
- func (ds *Datastore) GetNodeSummary() ([]*types.NodeSummary, error)
- func (ds *Datastore) GetTenant(id string) (*types.Tenant, error)
- func (ds *Datastore) GetTenantCNCISummary(cnci string) ([]types.TenantCNCI, error)
- func (ds *Datastore) GetTenantUsage(tenantID string, start time.Time, end time.Time) ([]payloads.CiaoUsage, error)
- func (ds *Datastore) GetWorkload(id string) (*types.Workload, error)
- func (ds *Datastore) GetWorkloads() ([]*types.Workload, error)
- func (ds *Datastore) HandleStats(stat payloads.Stat) error
- func (ds *Datastore) HandleTraceReport(trace payloads.Trace) error
- func (ds *Datastore) Init(config Config) error
- func (ds *Datastore) ReleaseTenantIP(tenantID string, ip string) error
- func (ds *Datastore) RestartFailure(instanceID string, reason payloads.RestartFailureReason) error
- func (ds *Datastore) StartFailure(instanceID string, reason payloads.StartFailureReason) error
- func (ds *Datastore) StopFailure(instanceID string, reason payloads.StopFailureReason) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { PersistentURI string TransientURI string InitTablesPath string InitWorkloadsPath string }
Config contains configuration information for the datastore.
type Datastore ¶
type Datastore struct {
// contains filtered or unexported fields
}
Datastore provides context for the datastore package.
func (*Datastore) AddCNCIIP ¶
AddCNCIIP will associate a new IP address with an existing CNCI via the mac address
func (*Datastore) AddInstance ¶
AddInstance will store a new instance in the datastore. The instance will be updated both in the cache and in the database
func (*Datastore) AddLimit ¶
AddLimit allows the caller to store a limt for a specific resource for a tenant.
func (*Datastore) AddTenant ¶
AddTenant stores information about a tenant into the datastore. it creates a MAC address for the tenant network and makes sure that this new tenant is cached.
func (*Datastore) AddTenantCNCI ¶
AddTenantCNCI will associate a new CNCI instance with a specific tenant. The instanceID of the new CNCI instance and the MAC address of the new instance are stored in the sql database and updated in the cache.
func (*Datastore) AddTenantChan ¶
AddTenantChan allows a caller to pass in a channel for CNCI Launch status. When a CNCI has been added to the datastore and a channel exists, success will be indicated on the channel. If a CNCI failure occurred and a channel exists, failure will be indicated on the channel.
func (*Datastore) AllocateTenantIP ¶
AllocateTenantIP will find a free IP address within a tenant network. For now we make each tenant have unique subnets even though it isn't actually needed because of a docker issue.
func (*Datastore) DeleteInstance ¶
DeleteInstance removes an instance from the datastore.
func (*Datastore) DeleteNode ¶
DeleteNode removes a node from the node cache.
func (*Datastore) GetAllInstances ¶
GetAllInstances retrieves all instances out of the datastore.
func (*Datastore) GetAllInstancesByNode ¶
GetAllInstancesByNode will retrieve all the instances running on a specific compute Node.
func (*Datastore) GetAllInstancesFromTenant ¶
GetAllInstancesFromTenant will retrieve all instances belonging to a specific tenant
func (*Datastore) GetAllTenants ¶
GetAllTenants returns all the tenants from the datastore.
func (*Datastore) GetBatchFrameStatistics ¶
func (ds *Datastore) GetBatchFrameStatistics(label string) ([]types.BatchFrameStat, error)
GetBatchFrameStatistics will show individual trace data per instance for a batch of trace data. The batch is identified by the label.
func (*Datastore) GetBatchFrameSummary ¶
func (ds *Datastore) GetBatchFrameSummary() ([]types.BatchFrameSummary, error)
GetBatchFrameSummary will retieve the count of traces we have for a specific label
func (*Datastore) GetCNCIWorkloadID ¶
GetCNCIWorkloadID returns the UUID of the workload template for the CNCI workload
func (*Datastore) GetEventLog ¶
GetEventLog retrieves all the log entries stored in the datastore.
func (*Datastore) GetInstance ¶
GetInstance retrieves an instance out of the datastore.
func (*Datastore) GetInstanceLastStats ¶
func (ds *Datastore) GetInstanceLastStats(nodeID string) payloads.CiaoServersStats
GetInstanceLastStats retrieves the last instances stats received for this node. It returns it in a format suitable for the compute API.
func (*Datastore) GetNodeLastStats ¶
func (ds *Datastore) GetNodeLastStats() payloads.CiaoComputeNodes
GetNodeLastStats retrieves the last nodes stats received for this node. It returns it in a format suitable for the compute API.
func (*Datastore) GetNodeSummary ¶
func (ds *Datastore) GetNodeSummary() ([]*types.NodeSummary, error)
GetNodeSummary provides a summary the state and count of instances running per node.
func (*Datastore) GetTenantCNCISummary ¶
func (ds *Datastore) GetTenantCNCISummary(cnci string) ([]types.TenantCNCI, error)
GetTenantCNCISummary retrieves information about a given CNCI id, or all CNCIs If the cnci string is the null string, then this function will retrieve all tenants. If cnci is not null, it will only provide information about a specific cnci.
func (*Datastore) GetTenantUsage ¶
func (ds *Datastore) GetTenantUsage(tenantID string, start time.Time, end time.Time) ([]payloads.CiaoUsage, error)
GetTenantUsage provides statistics on actual resource usage. Usage is provided between a specified time period.
func (*Datastore) GetWorkload ¶
GetWorkload returns details about a specific workload referenced by id
func (*Datastore) GetWorkloads ¶
GetWorkloads returns all known tenant workloads
func (*Datastore) HandleStats ¶
HandleStats makes sure that the data from the stat payload is stored.
func (*Datastore) HandleTraceReport ¶
HandleTraceReport stores the provided trace data in the datastore.
func (*Datastore) Init ¶
Init initializes the private data for the Datastore object. The sql tables are populated with initial data from csv files if this is the first time the database has been created. The datastore caches are also filled.
func (*Datastore) ReleaseTenantIP ¶
ReleaseTenantIP will return an IP address previously allocated to the pool. Once a tenant IP address is released, it can be reassigned to another instance.
func (*Datastore) RestartFailure ¶
func (ds *Datastore) RestartFailure(instanceID string, reason payloads.RestartFailureReason) error
RestartFailure logs a RestartFailure in the datastore
func (*Datastore) StartFailure ¶
func (ds *Datastore) StartFailure(instanceID string, reason payloads.StartFailureReason) error
StartFailure will clean up after a failure to start an instance. If an instance was a CNCI, this function will remove the CNCI instance for this tenant. If the instance was a normal tenant instance, the IP address will be released and the instance will be deleted from the datastore.
func (*Datastore) StopFailure ¶
func (ds *Datastore) StopFailure(instanceID string, reason payloads.StopFailureReason) error
StopFailure logs a StopFailure in the datastore