예제 #1
0
파일: server.go 프로젝트: xh3b4sd/anna
// DefaultConfig provides a default configuration to create a new server object
// by best effort.
func DefaultConfig() Config {
	newInstrumentation, err := memory.NewInstrumentation(memory.DefaultInstrumentationConfig())
	if err != nil {
		panic(err)
	}

	newLogControl, err := logcontrol.NewControl(logcontrol.DefaultControlConfig())
	if err != nil {
		panic(err)
	}

	newTextInterface, err := text.NewServer(text.DefaultServerConfig())
	if err != nil {
		panic(err)
	}

	newConfig := Config{
		// Dependencies.

		Instrumentation: newInstrumentation,
		Log:             log.New(log.DefaultConfig()),
		LogControl:      newLogControl,
		TextInterface:   newTextInterface,

		// Settings.

		GRPCAddr: "127.0.0.1:9119",
		HTTPAddr: "127.0.0.1:9120",
	}

	return newConfig
}
예제 #2
0
파일: storage.go 프로젝트: xh3b4sd/anna
// DefaultStorageConfig provides a default configuration to create a new redis
// storage object by best effort.
func DefaultStorageConfig() StorageConfig {
	newInstrumentation, err := memory.NewInstrumentation(memory.DefaultInstrumentationConfig())
	if err != nil {
		panic(err)
	}

	newStorageConfig := StorageConfig{
		// Dependencies.
		Instrumentation: newInstrumentation,
		Log:             log.New(log.DefaultConfig()),
		Pool:            NewPool(DefaultPoolConfig()),

		// Settings.
		BackoffFactory: func() spec.Backoff {
			return &backoff.StopBackOff{}
		},
		Prefix: "prefix",
	}

	return newStorageConfig
}