config

package
v0.0.0-...-303e327 Latest Latest
Warning

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

Go to latest
Published: May 22, 2023 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AccessConnMode

func AccessConnMode() uint8

func AccessConsulAddr

func AccessConsulAddr() string

func AccessFailRetryIntervalS

func AccessFailRetryIntervalS() int

func AccessHostTryTimes

func AccessHostTryTimes() int

func AccessMaxFailsPeriodS

func AccessMaxFailsPeriodS() int

func AccessMaxHostRetry

func AccessMaxHostRetry() int

func AccessMaxPartRetry

func AccessMaxPartRetry() int

func AccessMaxSizePutOnce

func AccessMaxSizePutOnce() int64

func AccessPriorityAddrs

func AccessPriorityAddrs() []string

func AccessServiceIntervalS

func AccessServiceIntervalS() int

func All

func All() map[string]interface{}

All returns all cache

func Cluster

func Cluster() *cmapi.Client

Cluster returns config default cluster.

func ClusterMgrSecret

func ClusterMgrSecret() string

func Clusters

func Clusters() (clusters map[string][]string)

Clusters returns cluster manager clusters

func DefaultClusterID

func DefaultClusterID() int

func Del

func Del(key string)

Del del cache of key

func Get

func Get(key string) interface{}

Get cache getter

func LoadConfig

func LoadConfig(path string)

LoadConfig load config from path

func NewCluster

func NewCluster(clusterID string, hosts []string, secret string) *cmapi.Client

NewCluster returns cluster client. TODO: returns cached cluster with the same params.

func NewConsulClient

func NewConsulClient(addr string) (*api.Client, error)

NewConsulClient returns client of consul with address.

func PrintType

func PrintType()

PrintType print type of keyValuer

func Region

func Region() string

func Set

func Set(key string, value interface{})

Set cache setter

func SetFrom

func SetFrom(key, value string)

SetFrom value from string

func Verbose

func Verbose() bool

Verbose returns app verbose

func Vverbose

func Vverbose() bool

Vverbose returns app verbose verbose

Types

type Config

type Config struct {
	Region           string `json:"region" cache:"Key-Region" help:"region to choose cluster"`
	DefaultClusterID int    `json:"default_cluster_id" cache:"Key-DefaultClusterID" help:"ID to choose default cluster"`

	Verbose  bool `json:"verbose" cache:"Flag-Verbose" help:"enable verbose mode"`
	Vverbose bool `json:"vverbose" cache:"Flag-Vverbose" help:"enable verbose verbose mode"`

	ClusterMgrCluster map[string]string `json:"cm_cluster" cache:"Key-ClusterMgrCluster" help:"cluster manager addrs"`
	ClusterMgrSecret  string            `json:"cm_secret" cache:"Key-ClusterMgrSecret" help:"cluster manager secret"`

	Access struct {
		ConnMode           uint8    `json:"conn_mode" cache:"Key-Access-ConnMode" help:"connection mode, 4 means no timeout"`
		ConsulAddr         string   `json:"consul_addr" cache:"Key-Access-ConsulAddr" help:"consul address"`
		ServiceIntervalS   int      `json:"service_interval_s" cache:"Key-Access-ServiceIntervalS" help:"service interval second"`
		PriorityAddrs      []string `json:"priority_addrs" cache:"Key-Access-PriorityAddrs" help:"priority addresses to try"`
		MaxSizePutOnce     int64    `json:"max_size_put_once" cache:"Key-Access-MaxSizePutOnce" help:"max size put once"`
		MaxPartRetry       int      `json:"max_part_retry" cache:"Key-Access-MaxPartRetry" help:"max times to retry part"`
		MaxHostRetry       int      `json:"max_host_retry" cache:"Key-Access-MaxHostRetry" help:"max times to retry host"`
		FailRetryIntervalS int      `json:"fail_retry_interval_s" cache:"Key-Access-FailRetryIntervalS" help:"interval for the failed host to retry"`
		MaxFailsPeriodS    int      `` /* 136-byte string literal not displayed */
		HostTryTimes       int      `json:"host_try_times" cache:"Key-Access-HostTryTimes" help:"number of host failure retries"`
	} `json:"access"`
}

Config config in file

Jump to

Keyboard shortcuts

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