common

package
v0.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 5, 2019 License: Apache-2.0 Imports: 6 Imported by: 18

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AresServerConfig

type AresServerConfig struct {
	// HTTP port for serving.
	Port int `yaml:"port"`

	// HTTP port for debugging.
	DebugPort int `yaml:"debug_port"`

	// Directory path that stores the data and schema on local disk.
	RootPath string `yaml:"root_path"`

	// Total memory size ares can use.
	TotalMemorySize int64 `yaml:"total_memory_size"`

	// Whether to turn off scheduler.
	SchedulerOff bool `yaml:"scheduler_off"`

	// Build version of the server currently running
	Version string `yaml:"version"`

	// environment
	Env string `yaml:"env"`

	Query         QueryConfig     `yaml:"query"`
	DiskStore     DiskStoreConfig `yaml:"disk_store"`
	HTTP          HTTPConfig      `yaml:"http"`
	RedoLogConfig RedoLogConfig   `yaml:"redolog"`

	// Cluster determines the cluster mode configuration of aresdb
	Cluster ClusterConfig `yaml:"cluster"`
}

AresServerConfig is config specific for ares server.

type ClusterConfig

type ClusterConfig struct {
	// Enable controls whether to start in cluster mode
	Enable bool `yaml:"enable"`

	// Enable distributed mode
	Distributed bool `yaml:"distributed"`

	// Namespace is the cluster namespace to join
	Namespace string `yaml:"namespace"`

	// InstanceID is the cluster wide unique name to identify current instance
	// it can be static configured in yaml, or dynamically set on start up
	InstanceID string `yaml:"instance_id"`

	// controller config
	Controller *ControllerConfig `yaml:"controller,omitempty"`

	// etcd client required config
	Etcd etcd.Configuration `yaml:"etcd"`

	// heartbeat config
	HeartbeatConfig HeartbeatConfig `yaml:"heartbeat"`
}

ClusterConfig is the config for starting current instance with cluster mode

type ControllerConfig

type ControllerConfig struct {
	Address    string      `yaml:"address"`
	Headers    http.Header `yaml:"headers"`
	TimeoutSec int         `yaml:"timeout"`
}

ControllerConfig is the config for ares-controller client

type DiskRedoLogConfig added in v0.0.2

type DiskRedoLogConfig struct {
	// disable local disk redolog, default will be enabled
	Disabled bool `yaml:"disabled"`
}

local redolog config

type DiskStoreConfig

type DiskStoreConfig struct {
	WriteSync bool `yaml:"write_sync"`
}

DiskStoreConfig is the static configuration for disk store.

type HTTPConfig

type HTTPConfig struct {
	MaxConnections        int `yaml:"max_connections"`
	ReadTimeOutInSeconds  int `yaml:"read_time_out_in_seconds"`
	WriteTimeOutInSeconds int `yaml:"write_time_out_in_seconds"`
}

HTTPConfig is the static configuration for main http server (query and schema).

type HeartbeatConfig added in v0.0.2

type HeartbeatConfig struct {
	// heartbeat timeout value
	Timeout int `yaml:"timeout"`
	// heartbeat interval value
	Interval int `yaml:"interval"`
}

HeartbeatConfig is the config for timeout and check interval with etcd

type KafkaRedoLogConfig added in v0.0.2

type KafkaRedoLogConfig struct {
	// enable redolog from kafka, default will be disabled
	Enabled bool `yaml:"enabled"`
	// kafka brokers
	Brokers []string `yaml:"brokers"`
	// topic name suffix
	TopicSuffix string `yaml:"suffix"`
}

Kafka source config

type Logger added in v0.0.2

type Logger interface {
	// Log at debug level
	Debug(args ...interface{})

	// Log at debug level with fmt.Printf-like formatting
	Debugf(format string, args ...interface{})

	// Log at info level
	Info(args ...interface{})

	// Log at info level with fmt.Printf-like formatting
	Infof(format string, args ...interface{})

	// Log at warning level
	Warn(args ...interface{})

	// Log at warning level with fmt.Printf-like formatting
	Warnf(format string, args ...interface{})

	// Log at error level
	Error(args ...interface{})

	// Log at error level with fmt.Printf-like formatting
	Errorf(format string, args ...interface{})

	// Log at fatal level, then terminate process (irrecoverable)
	Fatal(args ...interface{})

	// Log at fatal level with fmt.Printf-like formatting, then terminate process (irrecoverable)
	Fatalf(format string, args ...interface{})

	// Log at panic level, then panic (recoverable)
	Panic(args ...interface{})

	// Log at panic level with fmt.Printf-like formatting, then panic (recoverable)
	Panicf(format string, args ...interface{})

	// Return a logger with the specified key-value pair set, to be logged in a subsequent normal logging call
	With(args ...interface{}) Logger
}

Logger is a general logger interface

type LoggerFactory

type LoggerFactory interface {
	// GetDefaultLogger returns the default logger.
	GetDefaultLogger() Logger
	// GetLogger returns logger given the logger name.
	GetLogger(name string) Logger
}

LoggerFactory defines the log factory ares needs.

func NewLoggerFactory

func NewLoggerFactory() LoggerFactory

NewLoggerFactory creates a default zap LoggerFactory implementation.

type Metrics

type Metrics interface {
	NewRootScope() (tally.Scope, io.Closer, error)
}

Metrics is the interface for stats reporting based on tally. The application call NewRootScope() at start up time to get the root scope and calls closer.Close() before shutdown.

func NewNoopMetrics

func NewNoopMetrics() Metrics

NewNoopMetrics returns a Metrics that will do nothing for reporting.

type NoopLogger added in v0.0.2

type NoopLogger struct{}

NoopLogger is wrapper of noop logger

func (*NoopLogger) Debug added in v0.0.2

func (z *NoopLogger) Debug(args ...interface{})

Debug is log at debug level

func (*NoopLogger) Debugf added in v0.0.2

func (z *NoopLogger) Debugf(format string, args ...interface{})

Debugf is log at debug level with fmt.Printf-like formatting

func (*NoopLogger) Error added in v0.0.2

func (z *NoopLogger) Error(args ...interface{})

Error is log at error level

func (*NoopLogger) Errorf added in v0.0.2

func (z *NoopLogger) Errorf(format string, args ...interface{})

Errorf is log at error level with fmt.Printf-like formatting

func (*NoopLogger) Fatal added in v0.0.2

func (z *NoopLogger) Fatal(args ...interface{})

Fatal is log at fatal level, then terminate process (irrecoverable)

func (*NoopLogger) Fatalf added in v0.0.2

func (z *NoopLogger) Fatalf(format string, args ...interface{})

Fatalf is log at fatal level with fmt.Printf-like formatting, then terminate process (irrecoverable)

func (*NoopLogger) Info added in v0.0.2

func (z *NoopLogger) Info(args ...interface{})

Info is log at info level

func (*NoopLogger) Infof added in v0.0.2

func (z *NoopLogger) Infof(format string, args ...interface{})

Infof is log at info level with fmt.Printf-like formatting

func (*NoopLogger) Panic added in v0.0.2

func (z *NoopLogger) Panic(args ...interface{})

Panic is log at panic level, then panic (recoverable)

func (*NoopLogger) Panicf added in v0.0.2

func (z *NoopLogger) Panicf(format string, args ...interface{})

Panicf is log at panic level with fmt.Printf-like formatting, then panic (recoverable)

func (*NoopLogger) Warn added in v0.0.2

func (z *NoopLogger) Warn(args ...interface{})

Warn is log at warning level

func (*NoopLogger) Warnf added in v0.0.2

func (z *NoopLogger) Warnf(format string, args ...interface{})

Warnf is log at warning level with fmt.Printf-like formatting

func (*NoopLogger) With added in v0.0.2

func (z *NoopLogger) With(args ...interface{}) Logger

With returns a logger with the specified key-value pair set, to be logged in a subsequent normal logging call

type QueryConfig

type QueryConfig struct {
	// how much portion of the device memory we are allowed use
	DeviceMemoryUtilization float32 `yaml:"device_memory_utilization"`
	// timeout in seconds for choosing device
	DeviceChoosingTimeout int            `yaml:"device_choosing_timeout"`
	TimezoneTable         TimezoneConfig `yaml:"timezone_table"`
	EnableHashReduction   bool           `yaml:"enable_hash_reduction"`
}

QueryConfig is the static configuration for query.

type RedoLogConfig added in v0.0.2

type RedoLogConfig struct {
	// Disk redolog config
	DiskConfig DiskRedoLogConfig `yaml:"disk"`
	// Kafka redolog config
	KafkaConfig KafkaRedoLogConfig `yaml:"kafka"`
	// Disk only redolog for unsharded tables
	DiskOnlyForUnsharded bool `yaml:"diskOnlyForUnsharded"`
}

Configs related to data import and redolog option

type TimezoneConfig

type TimezoneConfig struct {
	// table to lookup timezone columns
	TableName string `yaml:"table_name"`
}

TimezoneConfig is the static config for timezone column support

type ZapLogger added in v0.0.2

type ZapLogger struct {
	// contains filtered or unexported fields
}

ZapLogger is wrapper of zap

func (*ZapLogger) Debug added in v0.0.2

func (z *ZapLogger) Debug(args ...interface{})

Debug is log at debug level

func (*ZapLogger) Debugf added in v0.0.2

func (z *ZapLogger) Debugf(format string, args ...interface{})

Debugf is log at debug level with fmt.Printf-like formatting

func (*ZapLogger) Error added in v0.0.2

func (z *ZapLogger) Error(args ...interface{})

Error is log at error level

func (*ZapLogger) Errorf added in v0.0.2

func (z *ZapLogger) Errorf(format string, args ...interface{})

Errorf is log at error level with fmt.Printf-like formatting

func (*ZapLogger) Fatal added in v0.0.2

func (z *ZapLogger) Fatal(args ...interface{})

Fatal is log at fatal level, then terminate process (irrecoverable)

func (*ZapLogger) Fatalf added in v0.0.2

func (z *ZapLogger) Fatalf(format string, args ...interface{})

Fatalf is log at fatal level with fmt.Printf-like formatting, then terminate process (irrecoverable)

func (*ZapLogger) Info added in v0.0.2

func (z *ZapLogger) Info(args ...interface{})

Info is log at info level

func (*ZapLogger) Infof added in v0.0.2

func (z *ZapLogger) Infof(format string, args ...interface{})

Infof is log at info level with fmt.Printf-like formatting

func (*ZapLogger) Panic added in v0.0.2

func (z *ZapLogger) Panic(args ...interface{})

Panic is log at panic level, then panic (recoverable)

func (*ZapLogger) Panicf added in v0.0.2

func (z *ZapLogger) Panicf(format string, args ...interface{})

Panicf is log at panic level with fmt.Printf-like formatting, then panic (recoverable)

func (*ZapLogger) Warn added in v0.0.2

func (z *ZapLogger) Warn(args ...interface{})

Warn is log at warning level

func (*ZapLogger) Warnf added in v0.0.2

func (z *ZapLogger) Warnf(format string, args ...interface{})

Warnf is log at warning level with fmt.Printf-like formatting

func (*ZapLogger) With added in v0.0.2

func (z *ZapLogger) With(args ...interface{}) Logger

With returns a logger with the specified key-value pair set, to be logged in a subsequent normal logging call

type ZapLoggerFactory added in v0.0.2

type ZapLoggerFactory struct {
	// contains filtered or unexported fields
}

ZapLoggerFactory is the stdlog implementation of LoggerFactory

func (*ZapLoggerFactory) GetDefaultLogger added in v0.0.2

func (r *ZapLoggerFactory) GetDefaultLogger() Logger

GetDefaultLogger returns the default zap logger.

func (*ZapLoggerFactory) GetLogger added in v0.0.2

func (r *ZapLoggerFactory) GetLogger(name string) Logger

GetLogger of ZapLoggerFactory ignores the given name and just return the default logger.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL