本文整理汇总了Golang中github.com/influxdb/influxdb/toml.Duration函数的典型用法代码示例。如果您正苦于以下问题:Golang Duration函数的具体用法?Golang Duration怎么用?Golang Duration使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Duration函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: NewConfig
// NewConfig returns an instance of Config with defaults.
func NewConfig() Config {
return Config{
WriteTimeout: toml.Duration(DefaultWriteTimeout),
ShardWriterTimeout: toml.Duration(DefaultShardWriterTimeout),
ShardMapperTimeout: toml.Duration(DefaultShardMapperTimeout),
}
}
示例2: NewConfig
// NewConfig returns a new Config with defaults.
func NewConfig() Config {
return Config{
Enabled: true,
CheckInterval: toml.Duration(DefaultCheckInterval),
AdvancePeriod: toml.Duration(DefaultAdvancePeriod),
}
}
示例3: NewConfig
func NewConfig() Config {
defaultEngine := DefaultEngine
if engine := os.Getenv("INFLUXDB_DATA_ENGINE"); engine != "" {
log.Println("TSDB engine selected via environment variable:", engine)
defaultEngine = engine
}
return Config{
Engine: defaultEngine,
MaxWALSize: DefaultMaxWALSize,
WALFlushInterval: toml.Duration(DefaultWALFlushInterval),
WALPartitionFlushDelay: toml.Duration(DefaultWALPartitionFlushDelay),
WALLoggingEnabled: true,
WALReadySeriesSize: DefaultReadySeriesSize,
WALCompactionThreshold: DefaultCompactionThreshold,
WALMaxSeriesSize: DefaultMaxSeriesSize,
WALFlushColdInterval: toml.Duration(DefaultFlushColdInterval),
WALPartitionSizeThreshold: DefaultPartitionSizeThreshold,
WALFlushMemorySizeThreshold: DefaultFlushMemorySizeThreshold,
WALMaxMemorySizeThreshold: DefaultMaxMemorySizeThreshold,
IndexCompactionAge: DefaultIndexCompactionAge,
IndexMinCompactionFileCount: DefaultIndexMinCompactionFileCount,
IndexCompactionFullAge: DefaultIndexCompactionFullAge,
IndexMinCompactionInterval: DefaultIndexMinCompactionInterval,
QueryLogEnabled: true,
}
}
示例4: NewConfig
func NewConfig() Config {
return Config{
Engine: DefaultEngine,
Enabled: true, // data node enabled by default
MaxWALSize: DefaultMaxWALSize,
WALFlushInterval: toml.Duration(DefaultWALFlushInterval),
WALPartitionFlushDelay: toml.Duration(DefaultWALPartitionFlushDelay),
WALLoggingEnabled: true,
WALReadySeriesSize: DefaultReadySeriesSize,
WALCompactionThreshold: DefaultCompactionThreshold,
WALMaxSeriesSize: DefaultMaxSeriesSize,
WALFlushColdInterval: toml.Duration(DefaultFlushColdInterval),
WALPartitionSizeThreshold: DefaultPartitionSizeThreshold,
QueryLogEnabled: true,
CacheMaxMemorySize: DefaultCacheMaxMemorySize,
CacheSnapshotMemorySize: DefaultCacheSnapshotMemorySize,
CacheSnapshotWriteColdDuration: toml.Duration(DefaultCacheSnapshotWriteColdDuration),
CompactFullWriteColdDuration: toml.Duration(DefaultCompactFullWriteColdDuration),
DataLoggingEnabled: true,
}
}
示例5: NewConfig
func NewConfig() Config {
return Config{
RetentionAutoCreate: DefaultRetentionAutoCreate,
RetentionCheckEnabled: DefaultRetentionCheckEnabled,
RetentionCheckPeriod: toml.Duration(DefaultRetentionCheckPeriod),
RetentionCreatePeriod: toml.Duration(DefaultRetentionCreatePeriod),
}
}
示例6: NewConfig
// NewConfig returns a new instance of Config with defaults.
func NewConfig() Config {
return Config{
Enabled: true,
RecomputePreviousN: DefaultRecomputePreviousN,
RecomputeNoOlderThan: toml.Duration(DefaultRecomputeNoOlderThan),
ComputeRunsPerInterval: DefaultComputeRunsPerInterval,
ComputeNoMoreThan: toml.Duration(DefaultComputeNoMoreThan),
}
}
示例7: NewConfig
func NewConfig() Config {
return Config{
MaxWALSize: DefaultMaxWALSize,
WALFlushInterval: toml.Duration(DefaultWALFlushInterval),
RetentionAutoCreate: DefaultRetentionAutoCreate,
RetentionCheckEnabled: DefaultRetentionCheckEnabled,
RetentionCheckPeriod: toml.Duration(DefaultRetentionCheckPeriod),
RetentionCreatePeriod: toml.Duration(DefaultRetentionCreatePeriod),
}
}
示例8: NewConfig
// NewConfig returns an instance of Config with defaults.
func NewConfig() Config {
return Config{
StoreEnabled: true,
StoreDatabase: DefaultStoreDatabase,
StoreRetentionPolicy: DefaultStoreRetentionPolicy,
StoreRetentionDuration: toml.Duration(DefaultStoreRetentionPolicyDuration),
StoreReplicationFactor: DefaultStoreReplicationFactor,
StoreInterval: toml.Duration(DefaultStoreInterval),
}
}
示例9: NewConfig
func NewConfig() *Config {
return &Config{
Hostname: DefaultHostname,
BindAddress: DefaultBindAddress,
RetentionAutoCreate: true,
ElectionTimeout: toml.Duration(DefaultElectionTimeout),
HeartbeatTimeout: toml.Duration(DefaultHeartbeatTimeout),
LeaderLeaseTimeout: toml.Duration(DefaultLeaderLeaseTimeout),
CommitTimeout: toml.Duration(DefaultCommitTimeout),
}
}
示例10: NewConfig
// NewConfig returns the default test configuration.
func NewConfig(path string) *meta.Config {
return &meta.Config{
Dir: path,
Hostname: "localhost",
BindAddress: "127.0.0.1:0",
HeartbeatTimeout: toml.Duration(500 * time.Millisecond),
ElectionTimeout: toml.Duration(500 * time.Millisecond),
LeaderLeaseTimeout: toml.Duration(500 * time.Millisecond),
CommitTimeout: toml.Duration(5 * time.Millisecond),
}
}
示例11: NewConfig
// NewConfig returns a new Config with defaults.
func NewConfig() Config {
return Config{
BindAddress: DefaultBindAddress,
Database: DefaultDatabase,
Protocol: DefaultProtocol,
BatchSize: DefaultBatchSize,
BatchTimeout: toml.Duration(DefaultBatchTimeout),
TCPTimeout: toml.Duration(DefaultTCPConnTimeout),
ConsistencyLevel: DefaultConsistencyLevel,
Separator: DefaultSeparator,
}
}
示例12: NewConfig
// NewConfig builds a new configuration with default values.
func NewConfig() *Config {
return &Config{
Enabled: true, // enabled by default
BindAddress: DefaultRaftBindAddress,
HTTPBindAddress: DefaultHTTPBindAddress,
RetentionAutoCreate: true,
ElectionTimeout: toml.Duration(DefaultElectionTimeout),
HeartbeatTimeout: toml.Duration(DefaultHeartbeatTimeout),
LeaderLeaseTimeout: toml.Duration(DefaultLeaderLeaseTimeout),
CommitTimeout: toml.Duration(DefaultCommitTimeout),
RaftPromotionEnabled: DefaultRaftPromotionEnabled,
LeaseDuration: toml.Duration(DefaultLeaseDuration),
LoggingEnabled: DefaultLoggingEnabled,
}
}
示例13: TestServer_UDFAgents
func TestServer_UDFAgents(t *testing.T) {
dir, err := os.Getwd()
udfDir := filepath.Clean(filepath.Join(dir, "../../../udf"))
if err != nil {
t.Fatal(err)
}
agents := []struct {
buildFunc func() error
config udf.FunctionConfig
}{
// Go
{
buildFunc: func() error { return nil },
config: udf.FunctionConfig{
Prog: "go",
Args: []string{"run", filepath.Join(udfDir, "agent/examples/moving_avg.go")},
Timeout: toml.Duration(time.Minute),
},
},
// Python
{
buildFunc: func() error { return nil },
config: udf.FunctionConfig{
Prog: "python2",
Args: []string{"-u", filepath.Join(udfDir, "agent/examples/moving_avg.py")},
Timeout: toml.Duration(time.Minute),
Env: map[string]string{
"PYTHONPATH": strings.Join(
[]string{filepath.Join(udfDir, "agent/py"), os.Getenv("PYTHONPATH")},
string(filepath.ListSeparator),
),
},
},
},
}
for _, agent := range agents {
err := agent.buildFunc()
if err != nil {
t.Fatal(err)
}
c := NewConfig()
c.UDF.Functions = map[string]udf.FunctionConfig{
"movingAvg": agent.config,
}
testAgent(t, c)
}
}
示例14: NewConfig
func NewConfig() Config {
return Config{
Enabled: true,
URL: DefaultURL,
StatsInterval: toml.Duration(DefaultStatsInterval),
}
}
示例15: TestShardWriter_Write_PoolMax
// Ensure the shard writer returns an error when we can't get a connection.
func TestShardWriter_Write_PoolMax(t *testing.T) {
ts := newTestWriteService(writeShardSlow)
s := cluster.NewService(cluster.Config{
ShardWriterTimeout: toml.Duration(100 * time.Millisecond),
})
s.Listener = ts.muxln
s.TSDBStore = ts
if err := s.Open(); err != nil {
t.Fatal(err)
}
defer s.Close()
defer ts.Close()
w := cluster.NewShardWriter(100*time.Millisecond, 1)
w.MetaClient = &metaClient{host: ts.ln.Addr().String()}
now := time.Now()
shardID := uint64(1)
ownerID := uint64(2)
var points []models.Point
points = append(points, models.MustNewPoint(
"cpu", models.Tags{"host": "server01"}, map[string]interface{}{"value": int64(100)}, now,
))
go w.WriteShard(shardID, ownerID, points)
time.Sleep(time.Millisecond)
if err := w.WriteShard(shardID, ownerID, points); err == nil || err.Error() != "timed out waiting for free connection" {
t.Fatalf("unexpected error: %v", err)
}
}