config

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2022 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ClientParameters

type ClientParameters struct {
	Time                time.Duration `yaml:"time" json:"-"`
	Timeout             time.Duration `yaml:"timeout" json:"-"`
	PermitWithoutStream bool          `yaml:"permit_without_stream"`
}

type Configuration

type Configuration struct {
	Listeners []*Listener `yaml:"listeners" json:"listeners"`

	Executors []*Executor `yaml:"executors" json:"executors"`

	Filters []*Filter `yaml:"filters" json:"filters"`

	DataSources []*DataSource `yaml:"data_source_cluster" json:"data_source_cluster"`

	DistributedTransaction *DistributedTransaction `yaml:"distributed_transaction" json:"distributed_transaction"`

	TerminationDrainDuration time.Duration `yaml:"termination_drain_duration" json:"termination_drain_duration"`

	HTTPListenPort *int `yaml:"http_listen_port"`
}

func Load

func Load(path string) *Configuration

Load config file and parse

type DataSource

type DataSource struct {
	Name                     string        `yaml:"name" json:"name"`
	DSN                      string        `yaml:"dsn" json:"dsn"`
	Capacity                 int           `yaml:"capacity" json:"capacity"`         // connection pool capacity
	MaxCapacity              int           `yaml:"max_capacity" json:"max_capacity"` // max connection pool capacity
	IdleTimeout              time.Duration `yaml:"idle_timeout" json:"idle_timeout"` // close backend direct connection after idle_timeout,unit: seconds
	PingInterval             time.Duration `yaml:"ping_interval" json:"ping_interval"`
	PingTimesForChangeStatus int           `yaml:"ping_times_for_change_status" json:"ping_times_for_change_status"`
	Filters                  []string      `yaml:"filters" json:"filters"`
}

DataSource ...

type DataSourceRef

type DataSourceRef struct {
	Name   string `yaml:"name" json:"name"`
	Weight string `yaml:"weight,omitempty" json:"weight,omitempty"`
}

type DataSourceRefGroup

type DataSourceRefGroup struct {
	Name        string                  `yaml:"name" json:"name"`
	LBAlgorithm lb.LoadBalanceAlgorithm `yaml:"load_balance_algorithm" json:"load_balance_algorithm"`
	DataSources []*DataSourceRef        `yaml:"data_sources" json:"data_sources"`
}

type DataSourceRole

type DataSourceRole int

DataSourceRole ...

const (
	Master DataSourceRole = iota
	Slave
	Meta
)

func (*DataSourceRole) UnmarshalText

func (r *DataSourceRole) UnmarshalText(text []byte) error

type DataSourceType

type DataSourceType int

DataSourceType ...

const (
	DBMysql DataSourceType = iota
	DBPostgresSql
)

func (*DataSourceType) UnmarshalText

func (t *DataSourceType) UnmarshalText(text []byte) error

type DistributedTransaction

type DistributedTransaction struct {
	ApplicationID                    string `yaml:"appid" json:"appid"`
	RetryDeadThreshold               int64  `yaml:"retry_dead_threshold" json:"retry_dead_threshold"`
	RollbackRetryTimeoutUnlockEnable bool   `yaml:"rollback_retry_timeout_unlock_enable" json:"rollback_retry_timeout_unlock_enable"`

	EtcdConfig clientv3.Config `yaml:"etcd_config" json:"etcd_config"`
}

type EnforcementPolicy

type EnforcementPolicy struct {
	MinTime             time.Duration `yaml:"min_time" json:"min_time"`
	PermitWithoutStream bool          `yaml:"permit_without_stream" json:"permit_without_stream"`
}

type ExecuteMode

type ExecuteMode byte
const (
	SDB ExecuteMode = iota
	RWS
	SHD
)

func (ExecuteMode) String

func (m ExecuteMode) String() string

func (*ExecuteMode) UnmarshalText

func (m *ExecuteMode) UnmarshalText(text []byte) error

type Executor

type Executor struct {
	Name    string      `yaml:"name" json:"name"`
	Mode    ExecuteMode `yaml:"mode" json:"mode"`
	Config  Parameters  `yaml:"config" json:"config"`
	Filters []string    `yaml:"filters" json:"filters"`
}

type Filter

type Filter struct {
	Name   string     `yaml:"name" json:"name"`
	Kind   string     `yaml:"kind" json:"kind"`
	Config Parameters `yaml:"conf,omitempty" json:"conf,omitempty"`
}

type Listener

type Listener struct {
	ProtocolType  ProtocolType  `yaml:"protocol_type" json:"protocol_type"`
	SocketAddress SocketAddress `yaml:"socket_address" json:"socket_address"`
	Filters       []string      `yaml:"filters" json:"filters"`
	Config        Parameters    `yaml:"config" json:"config"`
	Executor      string        `yaml:"executor" json:"executor"`
}

type LogicTable

type LogicTable struct {
	DBName        string         `yaml:"db_name" json:"db_name"`
	TableName     string         `yaml:"table_name" json:"table_name"`
	AllowFullScan bool           `yaml:"allow_full_scan" json:"allow_full_scan"`
	ShardingRule  *ShardingRule  `yaml:"sharding_rule" json:"sharding_rule"`
	Topology      map[int]string `yaml:"topology" json:"topology"`
}

type Parameters

type Parameters map[string]interface{}

Parameters defines a key-value parameters mapping

type ProtocolType

type ProtocolType int32

ProtocolType protocol type enum

const (
	Http ProtocolType = iota
	Mysql
)

func (*ProtocolType) UnmarshalText

func (t *ProtocolType) UnmarshalText(text []byte) error

type ReadWriteSplittingConfig

type ReadWriteSplittingConfig struct {
	LoadBalanceAlgorithm lb.LoadBalanceAlgorithm `yaml:"load_balance_algorithm" json:"load_balance_algorithm"`
	DataSources          []*DataSourceRef        `yaml:"data_sources" json:"data_sources"`
}

type ServerParameters

type ServerParameters struct {
	MaxConnectionIdle     time.Duration `yaml:"max_connection_idle" json:"max_connection_idle"`
	MaxConnectionAge      time.Duration `yaml:"max_connection_age" json:"max_connection_age"`
	MaxConnectionAgeGrace time.Duration `yaml:"max_connection_age_grace" json:"max_connection_age_grace"`
	Time                  time.Duration `yaml:"time" json:"time"`
	Timeout               time.Duration `yaml:"timeout" json:"Timeout"`
}

type ShardingConfig

type ShardingConfig struct {
	DBGroups    []*DataSourceRefGroup `yaml:"db_groups" json:"db_groups"`
	LogicTables []*LogicTable         `yaml:"logic_tables" json:"logic_tables"`
}

type ShardingRule

type ShardingRule struct {
	Column            string     `yaml:"column" json:"column"`
	ShardingAlgorithm string     `yaml:"sharding_algorithm" json:"sharding_algorithm"`
	Config            Parameters `yaml:"config,omitempty" json:"config,omitempty"`
}

type SocketAddress

type SocketAddress struct {
	Address string `default:"0.0.0.0" yaml:"address" json:"address"`
	Port    int    `default:"8881" yaml:"port" json:"port"`
}

SocketAddress specify either a logical or physical address and port, which are used to tell server where to bind/listen, connect to upstream and find management servers

type Storage

type Storage map[string]Parameters

Storage defines the configuration for registry object storage

func (Storage) Parameters

func (storage Storage) Parameters() Parameters

Parameters returns the Parameters map for a Storage configuration

func (Storage) Type

func (storage Storage) Type() string

Type returns the storage driver type, such as filesystem or s3

Jump to

Keyboard shortcuts

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