| // Copyright 2015 The Vanadium Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style |
| // license that can be found in the LICENSE file. |
| |
| // This file was auto-generated by the vanadium vdl tool. |
| // Source: types.vdl |
| |
| // Syncbase data model for Sensor Log. |
| // |
| // Every type <T> stored in Syncbase is defined as a pair of types, K<T> and |
| // V<T>, representing data stored in the key and value, respectively, in a |
| // single table. K<T> types satisfy the PersistentDataKey interface, supporting |
| // conversion to and from the row key. |
| package sbmodel |
| |
| import ( |
| // VDL system imports |
| "v.io/v23/vdl" |
| |
| // VDL user imports |
| "time" |
| _ "v.io/v23/vdlroot/time" |
| ) |
| |
| // devicecfg : <DevId> |
| // Measuring device handle. Master only. |
| type VDeviceCfg struct { |
| // Human-readable, not necessarily unique description of the device. |
| Desc string |
| // Syncbase instance publishing the syncgroup created by the device. |
| SgPublishSb string |
| } |
| |
| func (VDeviceCfg) __VDLReflect(struct { |
| Name string `vdl:"v.io/x/sensorlog/internal/sbmodel.VDeviceCfg"` |
| }) { |
| } |
| |
| type KDeviceCfg struct { |
| DevId string |
| } |
| |
| func (KDeviceCfg) __VDLReflect(struct { |
| Name string `vdl:"v.io/x/sensorlog/internal/sbmodel.KDeviceCfg"` |
| }) { |
| } |
| |
| // streamdef : <DevId>/<StreamId> |
| // Configures a stream of data to be measured. |
| type VStreamDef struct { |
| // Human-readable, not necessarily unique description of the stream. |
| Desc string |
| // Sampling configuration. |
| Sampler SamplerDef |
| // Flag to start and stop sampling. |
| Enabled bool |
| } |
| |
| func (VStreamDef) __VDLReflect(struct { |
| Name string `vdl:"v.io/x/sensorlog/internal/sbmodel.VStreamDef"` |
| }) { |
| } |
| |
| type KStreamDef struct { |
| DevId string |
| StreamId string |
| } |
| |
| func (KStreamDef) __VDLReflect(struct { |
| Name string `vdl:"v.io/x/sensorlog/internal/sbmodel.KStreamDef"` |
| }) { |
| } |
| |
| // Sampling script and polling frequency. |
| type SamplerDef struct { |
| // Shell script executed after every Interval, starting from Start. |
| // It should output a single data point, if available. A non-zero exit |
| // status or failure to parse the value will produce an error instead. |
| Script string |
| Start time.Time |
| Interval time.Duration |
| } |
| |
| func (SamplerDef) __VDLReflect(struct { |
| Name string `vdl:"v.io/x/sensorlog/internal/sbmodel.SamplerDef"` |
| }) { |
| } |
| |
| // sdata : <DevId>/<StreamId>/<Timestamp> |
| // Measured data value or error. |
| type KDataPoint struct { |
| DevId string |
| StreamId string |
| Timestamp time.Time |
| } |
| |
| func (KDataPoint) __VDLReflect(struct { |
| Name string `vdl:"v.io/x/sensorlog/internal/sbmodel.KDataPoint"` |
| }) { |
| } |
| |
| type ( |
| // VDataPoint represents any single field of the VDataPoint union type. |
| VDataPoint interface { |
| // Index returns the field index. |
| Index() int |
| // Interface returns the field value as an interface. |
| Interface() interface{} |
| // Name returns the field name. |
| Name() string |
| // __VDLReflect describes the VDataPoint union type. |
| __VDLReflect(__VDataPointReflect) |
| } |
| // VDataPointValue represents field Value of the VDataPoint union type. |
| VDataPointValue struct{ Value float64 } |
| // VDataPointError represents field Error of the VDataPoint union type. |
| VDataPointError struct{ Value string } |
| // __VDataPointReflect describes the VDataPoint union type. |
| __VDataPointReflect struct { |
| Name string `vdl:"v.io/x/sensorlog/internal/sbmodel.VDataPoint"` |
| Type VDataPoint |
| Union struct { |
| Value VDataPointValue |
| Error VDataPointError |
| } |
| } |
| ) |
| |
| func (x VDataPointValue) Index() int { return 0 } |
| func (x VDataPointValue) Interface() interface{} { return x.Value } |
| func (x VDataPointValue) Name() string { return "Value" } |
| func (x VDataPointValue) __VDLReflect(__VDataPointReflect) {} |
| |
| func (x VDataPointError) Index() int { return 1 } |
| func (x VDataPointError) Interface() interface{} { return x.Value } |
| func (x VDataPointError) Name() string { return "Error" } |
| func (x VDataPointError) __VDLReflect(__VDataPointReflect) {} |
| |
| func init() { |
| vdl.Register((*VDeviceCfg)(nil)) |
| vdl.Register((*KDeviceCfg)(nil)) |
| vdl.Register((*VStreamDef)(nil)) |
| vdl.Register((*KStreamDef)(nil)) |
| vdl.Register((*SamplerDef)(nil)) |
| vdl.Register((*KDataPoint)(nil)) |
| vdl.Register((*VDataPoint)(nil)) |
| } |