blob: f98fdf0e46a0153fb921d89a2ad9fb3d7da9ee59 [file] [log] [blame]
// 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.
// measured is the Sensor Log measuring daemon. Runs on any device, sampling
// data points and writing them to Syncbase. Sampling configuration is read
// from Syncbase as written by the client.
package main
import (
"flag"
"os"
"v.io/v23"
"v.io/x/lib/vlog"
"v.io/x/ref/lib/signals"
_ "v.io/x/ref/runtime/factories/generic"
"v.io/x/sensorlog_lite/internal/config"
"v.io/x/sensorlog_lite/internal/util"
)
var (
flagSbService = flag.String("service", config.DefaultSbService, "Location of the Syncbase service to connect to. Can be absolute or relative to the namespace root.")
)
func main() {
os.Exit(runMain())
}
func runMain() int {
ctx, shutdown := v23.Init()
defer shutdown()
vlog.VI(2).Infof("Default blessings: %v", v23.GetPrincipal(ctx).BlessingStore().Default())
db, err := util.CreateOrOpenDB(ctx, *flagSbService)
if err != nil {
vlog.Errorf("Failed opening Syncbase db: %v", err)
return 1
}
vlog.VI(0).Infof("measured connected to %s", db.FullName())
<-signals.ShutdownOnSignals(ctx)
return 0
}