当前位置: 首页>>代码示例>>Golang>>正文


Golang toml.Duration函数代码示例

本文整理汇总了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),
	}
}
开发者ID:rhyolight,项目名称:influxdb,代码行数:8,代码来源:config.go

示例2: NewConfig

// NewConfig returns a new Config with defaults.
func NewConfig() Config {
	return Config{
		Enabled:       true,
		CheckInterval: toml.Duration(DefaultCheckInterval),
		AdvancePeriod: toml.Duration(DefaultAdvancePeriod),
	}
}
开发者ID:rhyolight,项目名称:influxdb,代码行数:8,代码来源:config.go

示例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,
	}
}
开发者ID:nickrobinson,项目名称:influxdb,代码行数:29,代码来源:config.go

示例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,
	}
}
开发者ID:bwolf,项目名称:influxdb,代码行数:25,代码来源:config.go

示例5: NewConfig

func NewConfig() Config {
	return Config{
		RetentionAutoCreate:   DefaultRetentionAutoCreate,
		RetentionCheckEnabled: DefaultRetentionCheckEnabled,
		RetentionCheckPeriod:  toml.Duration(DefaultRetentionCheckPeriod),
		RetentionCreatePeriod: toml.Duration(DefaultRetentionCreatePeriod),
	}
}
开发者ID:nolenroyalty,项目名称:bangarang,代码行数:8,代码来源:config.go

示例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),
	}
}
开发者ID:nolenroyalty,项目名称:bangarang,代码行数:10,代码来源:config.go

示例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),
	}
}
开发者ID:dahankzter,项目名称:influxdb,代码行数:10,代码来源:config.go

示例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),
	}
}
开发者ID:Tony133,项目名称:influxdb,代码行数:11,代码来源:config.go

示例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),
	}
}
开发者ID:KoeSystems,项目名称:influxdb,代码行数:11,代码来源:config.go

示例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),
	}
}
开发者ID:realgo,项目名称:telegraf,代码行数:12,代码来源:store_test.go

示例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,
	}
}
开发者ID:KoeSystems,项目名称:influxdb,代码行数:13,代码来源:config.go

示例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,
	}
}
开发者ID:methane,项目名称:influxdb,代码行数:16,代码来源:config.go

示例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)
	}
}
开发者ID:m4ce,项目名称:kapacitor,代码行数:48,代码来源:server_test.go

示例14: NewConfig

func NewConfig() Config {
	return Config{
		Enabled:       true,
		URL:           DefaultURL,
		StatsInterval: toml.Duration(DefaultStatsInterval),
	}
}
开发者ID:nickrobinson,项目名称:influxdb,代码行数:7,代码来源:config.go

示例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)
	}
}
开发者ID:bwolf,项目名称:influxdb,代码行数:31,代码来源:shard_writer_test.go


注:本文中的github.com/influxdb/influxdb/toml.Duration函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。