Documentation ¶
Index ¶
- Constants
- func AuthenticateEntity(entityID, owner, password string) (err error)
- func CreateEntitySecret(ent *Entity, owner string) (secret string, err error)
- func GetEndpoints() (endpoints []*vnet.Endpoint)
- func Init(app *vapp.App) (err error)
- func InsertParamValue(owner string, value *ParamValue) (err error)
- func Reset(app *vapp.App) (err error)
- func SetParam(value ParamValue) (err error)
- func Setup(app *vapp.App) (err error)
- type Entity
- type ParamDesc
- type ParamEntry
- type ParamValue
- type VariableAccess
Constants ¶
const EntityColn = "entity"
EntityColn - entity collection name
Variables ¶
This section is empty.
Functions ¶
func AuthenticateEntity ¶
AuthenticateEntity - authenticates an entity with given ID and owner using the provided secret
func CreateEntitySecret ¶
CreateEntitySecret - creates a secret that can be used by an entity to communitcate with the server
func GetEndpoints ¶
GetEndpoints - gives REST endpoints for entity APIs
func InsertParamValue ¶
func InsertParamValue(owner string, value *ParamValue) (err error)
InsertParamValue - Insert param value given by entity into database
func SetParam ¶
func SetParam(value ParamValue) (err error)
SetParam - set value for a parameter exposed by an entity
Types ¶
type Entity ¶
type Entity struct { OID bson.ObjectId `json:"_id" bson:"_id,omitempty"` Name string `json:"name" bson:"name"` Type string `json:"type" bson:"type"` Location string `json:"location" bson:"location"` OwnerID string `json:"ownerID" bson:"ownerID"` OwnerName string `json:"ownerName" bson:"ownerName"` Variables []vcmn.Param `json:"variables" bson:"variables"` Readers []string `json:"readers" bson:"readers"` Writers []string `json:"writers" bson:"writers"` Tags []string `json:"tags" bson:"tags"` CreatedAt time.Time `json:"createdAt" bson:"createdAt"` ModifiedAt time.Time `json:"modifiedAt" bson:"modifiedAt"` CreatedBy string `json:"createdBy" bson:"createdBy"` ModifiedBy string `json:"modifiedBy" bson:"modifiedBy"` }
Entity - represents a entiry with variables
func (*Entity) SetCreationInfo ¶
SetCreationInfo - set the creation time and creator
type ParamDesc ¶
type ParamDesc struct { EntityID string `json:"entityID" bson:"entityID"` ParamID string `json:"param" bson:"param"` ParamName string `json:"paramName" bson:"paramName"` Unit string `json:"unit" bson:"unit"` }
ParamDesc - describes a parameter
type ParamEntry ¶
type ParamEntry struct { ParamDesc `bson:",inline"` Day time.Time `json:"day" bson:"day"` Total float64 `json:"total" bson:"total"` Values map[int]map[int]float32 `json:"values" bson:"values"` }
ParamEntry - data collection entry for a parameter for a day with granularity of 1 minute
func GetValuesForDateRange ¶
func GetValuesForDateRange( entityID, owner, paramID string, dayRange vcmn.DateRange) (values []*ParamEntry, err error)
GetValuesForDateRange - get values for all parameters of an entity that is inserted by the entity between given days
func GetValuesForSingleDay ¶
func GetValuesForSingleDay( entityID, owner, paramID string, day time.Time) (values []*ParamEntry, err error)
GetValuesForSingleDay - get values for all parameters of an entity that is inserted by the entity in a single day
type ParamValue ¶
ParamValue - parameter value along with parameter description
func ReadParamValue ¶
func ReadParamValue(entityID, paramName string) ( val ParamValue, err error)
ReadParamValue - read value for a parameter that is set by the user.