datastore

package
v1.29.0 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2022 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var InvalidClass = errors.New("class is invalid")
View Source
var InvalidExtraProperties = errors.New("extra properties does not match expected format")
View Source
var InvalidNetworkName = errors.New("invalid network name")
View Source
var InvalidNetworkType = errors.New("invalid network type")
View Source
var InvalidXname = errors.New("xname is invalid")
View Source
var InvalidXnameType = errors.New("xname type is invalid")
View Source
var UnknownType = errors.New("type is unknown")
View Source
var UnsupportedType = errors.New("type can not be stored in SLS")

Functions

func ConfigureStorage

func ConfigureStorage(dstype string, connInfo string, args []string) error

ConfigureStorage configures the interface for interacting with the storage module. Args: * dstype (string) - the type of database to use. Always "etcd" * connInfo (string) - the databse-specific connection information * args ([]string) - a list of arguments to pass to teh database engine

func DeleteNetwork

func DeleteNetwork(networkName string) error

DeleteNetwork removes a network from the DB.

func DeleteXname

func DeleteXname(xname string) error

DeleteXname removes hardware witht he appropriate name from the datastore. It handles updating the parent and any peers.

func GetAllHardware

func GetAllHardware() ([]sls_common.GenericHardware, error)

func GetAllNetworks

func GetAllNetworks() ([]sls_common.Network, error)

GetAllNetworks returns all the network objects in the DB.

func GetAllXnameObjects

func GetAllXnameObjects() ([]sls_common.GenericHardware, error)

GetAllXnameObjects get a list of all stored GenericHardware objects

func GetAllXnames

func GetAllXnames() ([]string, error)

GetAllXnames gets a list of names of all stored xnames

func GetNetwork

func GetNetwork(name string) (sls_common.Network, error)

GetNetwork returns the network object matching the given name.

func GetXname

func GetXname(xname string) (*sls_common.GenericHardware, error)

GetXname retrieves an object by its xname. Objects are returned as GenericHardware objects. Callers should use reflect.GetType if they wish to have this object as a more specific type, then cast as: reflect.ValueOf(GenericHardwareObject).Interface().(Type) Parameters:

  • xname (string): The xname to look up

Returns:

  • *GenericHardware: The object corresponding to that xname or nil if the xname was not found.
  • *error: Any error that occurred during the lookup

func InsertNetwork

func InsertNetwork(network sls_common.Network) (validationErr error, dbErr error)

InsertNetwork adds a given network into the database assuming it passes validation.

func NormalizeFields added in v1.26.0

func NormalizeFields(obj *sls_common.GenericHardware) error

func ReplaceAllNetworks

func ReplaceAllNetworks(networks []sls_common.Network) error

func ReplaceGenericHardware

func ReplaceGenericHardware(hardware []sls_common.GenericHardware) error

ReplaceGenericHardware will in a single transaction remove all hardware from the database and subsequently insert all of the provided hardware in its place. This make this a safe function to use for any bulk load operations.

func SearchGenericHardware

func SearchGenericHardware(searchHardware sls_common.GenericHardware) (returnHardware []sls_common.GenericHardware, validationErr error, dbErr error)

func SearchNetworks

func SearchNetworks(network sls_common.Network) (networks []sls_common.Network, err error)

func SetNetwork

func SetNetwork(network sls_common.Network) (verificationErr error, dbErr error)

Insert or update a network

func SetXname

func SetXname(xname string, obj sls_common.GenericHardware) (err error, created bool)

SetXname updates a specified xname with new or updated properties

func UpdateNetwork

func UpdateNetwork(network sls_common.Network) error

UpdateNetwork updates all of the fields for a given network in the DB *except* for the name which is read-only. Therefore, this function does no validation on network name.

func ValidateFields added in v1.26.0

func ValidateFields(obj sls_common.GenericHardware) error

func VerifyNetwork added in v1.26.0

func VerifyNetwork(nw sls_common.Network) error

Helper function to verify network is of a correct type and name.

Types

This section is empty.

Jump to

Keyboard shortcuts

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