forked from vanadium-archive/go.ref
/
opts.go
29 lines (25 loc) · 1.22 KB
/
opts.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
// 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.
package syncbaselib
import (
"flag"
)
type Opts struct {
Name string
RootDir string
Engine string
SkipPublishInNh bool
DevMode bool
CpuProfile string
}
// Note: Where possible, we have flag default values be zero values, so that
// struct-based configuration matches flag-based configuration.
func (o *Opts) InitFlags(f *flag.FlagSet) {
f.StringVar(&o.Name, "name", "", "Name to mount at.")
f.StringVar(&o.RootDir, "root-dir", "", "Root dir for data storage. If empty, we write to a fresh directory created using ioutil.TempDir.")
f.StringVar(&o.Engine, "engine", "", "Storage engine to use: memstore or leveldb. If empty, we use the default storage engine, currently leveldb.")
f.BoolVar(&o.SkipPublishInNh, "skip-publish-in-nh", false, "Whether to skip publishing in the neighborhood.")
f.BoolVar(&o.DevMode, "dev", false, "Whether to run in development mode; required for RPCs such as Service.DevModeUpdateVClock.")
f.StringVar(&o.CpuProfile, "cpuprofile", "", "If specified, write the cpu profile to the given filename.")
}