diamond_client

package module
v0.0.0-...-5b5abfe Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2019 License: MIT Imports: 18 Imported by: 0

README

go-diamond-client

config client of diamond for go.

Build Status codecov GitHub version MIT Licence GoDoc

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ConnTimeout = 3000 // milli seconds
View Source
var DataDir = "config-data"
View Source
var DefHolderPrefix = "${"
View Source
var DefHolderPrefixBytes = []byte(DefHolderPrefix)
View Source
var DefHolderPrefixLen = len(DefHolderPrefixBytes)
View Source
var DefHolderSuffix = "}"
View Source
var DefHolderSuffixBytes = []byte(DefHolderSuffix)
View Source
var DefHolderSuffixLen = len(DefHolderSuffixBytes)
View Source
var DefaultGroupName = "DEFAULT_GROUP"
View Source
var Diamond = &diamond{miner: NewMiner()}
View Source
var DiamondStoneExt = ".diamond"
View Source
var Mock = &mockServer{mocks: make(map[Axis]string)}
View Source
var OnceTimeout = 3000 // milli seconds
View Source
var PollingInterval = 15 // seconds
View Source
var RecvWaitTimeout = OnceTimeout * 5 // milli seconds
View Source
var Separator = string(os.PathSeparator)
View Source
var SnapshotDir = "snapshot"
View Source
var Subscriber *subscriberServer

Functions

func CurrentTimeMillis

func CurrentTimeMillis() int64

func ParseStoneToProperties

func ParseStoneToProperties(stone string) *Properties

func RandString

func RandString(length int) string

func Substitute

func Substitute(strVal string, ignoreBadHolders bool, group string, dataId string, lastProperties *Properties) (string, error)

func SubstituteRecursive

func SubstituteRecursive(strVal string, visitedHolders *Hashset, ignoreBadHolders bool, group string, dataId string, lastProperties *Properties) (string, error)

func SubstringMatch

func SubstringMatch(bytes []byte, index int, subbytes []byte) bool

func ToBool

func ToBool(str string) bool

func TryDecrypt

func TryDecrypt(original string, dataId string) (string, error)

func TryDecryptProperties

func TryDecryptProperties(properties *Properties) *Properties

Types

type AbstractMiner

type AbstractMiner struct {
	Minerable
	DefaultGroup
}

func (*AbstractMiner) GetMiner

func (miner *AbstractMiner) GetMiner(group string, dataId string) (Minerable, error)

func (*AbstractMiner) GetMinerOfDefaultGroup

func (miner *AbstractMiner) GetMinerOfDefaultGroup(dataId string) (Minerable, error)

func (*AbstractMiner) GetProperties

func (miner *AbstractMiner) GetProperties(group string, dataId string) (*Properties, error)

func (*AbstractMiner) GetPropertiesOfDefaultGroup

func (miner *AbstractMiner) GetPropertiesOfDefaultGroup(dataId string) (*Properties, error)

func (*AbstractMiner) GetStoneOrDefault

func (miner *AbstractMiner) GetStoneOrDefault(group string, dataId string, defaultValue string) (string, error)

func (*AbstractMiner) GetString

func (miner *AbstractMiner) GetString(key string) string

func (*AbstractMiner) GetStringOrDefault

func (miner *AbstractMiner) GetStringOrDefault(key string, defaultValue string) string

type Axis

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

func NewAxis

func NewAxis(group string, dataId string) *Axis

func NewAxisOfDefaultGroup

func NewAxisOfDefaultGroup(dataId string) *Axis

func (*Axis) GetDataId

func (axis *Axis) GetDataId() string

func (*Axis) GetGroup

func (axis *Axis) GetGroup() string

func (*Axis) String

func (axis *Axis) String() string

type DefaultGroup

type DefaultGroup interface {
	DefaultGroupName() string
}

type HttpClient

type HttpClient struct {
}

func (*HttpClient) ResetHostConfig

func (client *HttpClient) ResetHostConfig(hostPort string)

type Local

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

func NewLocal

func NewLocal() *Local

func (*Local) ReadLocal

func (local *Local) ReadLocal(meta *Meta) (string, error)

func (*Local) Start

func (local *Local) Start(conf *ManagerConf)

type Manager

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

func NewManager

func NewManager(group string, dataId string) *Manager

func NewManagerOfDefaultGroup

func NewManagerOfDefaultGroup(dataId string) *Manager

func (*Manager) GetDiamond

func (manager *Manager) GetDiamond() (string, error)

func (*Manager) SetTimeoutMillis

func (manager *Manager) SetTimeoutMillis(timeoutMillis int64)

type ManagerConf

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

func NewManagerConf

func NewManagerConf() *ManagerConf

func (*ManagerConf) AddDomainName

func (conf *ManagerConf) AddDomainName(domainName string)

func (*ManagerConf) GetConnectionTimeout

func (conf *ManagerConf) GetConnectionTimeout() int

func (*ManagerConf) GetDomainName

func (conf *ManagerConf) GetDomainName() string

func (*ManagerConf) GetFilePath

func (conf *ManagerConf) GetFilePath() string

func (*ManagerConf) GetMaxHostConnections

func (conf *ManagerConf) GetMaxHostConnections() int

func (*ManagerConf) GetMaxTotalConnections

func (conf *ManagerConf) GetMaxTotalConnections() int

func (*ManagerConf) GetOnceTimeout

func (conf *ManagerConf) GetOnceTimeout() int

func (*ManagerConf) GetPollingInterval

func (conf *ManagerConf) GetPollingInterval() int

func (*ManagerConf) GetReceiveWaitTime

func (conf *ManagerConf) GetReceiveWaitTime() int

func (*ManagerConf) GetRetrieveDataRetryTimes

func (conf *ManagerConf) GetRetrieveDataRetryTimes() int

func (*ManagerConf) GetServers

func (conf *ManagerConf) GetServers() []string

func (*ManagerConf) HasServers

func (conf *ManagerConf) HasServers() bool

func (*ManagerConf) IsConnectionStaleCheckingEnabled

func (conf *ManagerConf) IsConnectionStaleCheckingEnabled() bool

func (*ManagerConf) RotateToNextDomain

func (conf *ManagerConf) RotateToNextDomain(httpClient *HttpClient)

func (*ManagerConf) SetConnectionStaleCheckingEnabled

func (conf *ManagerConf) SetConnectionStaleCheckingEnabled(connectionStaleCheckingEnabled bool)

func (*ManagerConf) SetConnectionTimeout

func (conf *ManagerConf) SetConnectionTimeout(connectionTimeout int)

func (*ManagerConf) SetMaxHostConnections

func (conf *ManagerConf) SetMaxHostConnections(maxHostConnections int)

func (*ManagerConf) SetMaxTotalConnections

func (conf *ManagerConf) SetMaxTotalConnections(maxTotalConnections int)

func (*ManagerConf) SetOnceTimeout

func (conf *ManagerConf) SetOnceTimeout(onceTimeout int)

func (*ManagerConf) SetPollingInterval

func (conf *ManagerConf) SetPollingInterval(pollingInterval int)

func (*ManagerConf) SetReceiveWaitTime

func (conf *ManagerConf) SetReceiveWaitTime(receiveWaitTime int)

func (*ManagerConf) SetRetrieveDataRetryTimes

func (conf *ManagerConf) SetRetrieveDataRetryTimes(retrieveDataRetryTimes int)

func (*ManagerConf) SetServers

func (conf *ManagerConf) SetServers(servers *Hashset, httpClient *HttpClient)

type Meta

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

func NewMeta

func NewMeta(axis *Axis) *Meta

func (*Meta) Clear

func (meta *Meta) Clear()

func (*Meta) FetchCount

func (meta *Meta) FetchCount() int64

func (*Meta) GetAxis

func (meta *Meta) GetAxis() *Axis

func (*Meta) GetLastModifiedHeader

func (meta *Meta) GetLastModifiedHeader() string

func (*Meta) GetLocalFile

func (meta *Meta) GetLocalFile() string

func (*Meta) GetLocalVersion

func (meta *Meta) GetLocalVersion() int64

func (*Meta) GetMd5

func (meta *Meta) GetMd5() string

func (*Meta) IncSuccessCounterAndGet

func (meta *Meta) IncSuccessCounterAndGet() int64

func (*Meta) IsUseLocal

func (meta *Meta) IsUseLocal() bool

func (*Meta) SetLastModifiedHeader

func (meta *Meta) SetLastModifiedHeader(lastModifiedHeader string)

func (*Meta) SetLocalFile

func (meta *Meta) SetLocalFile(localFile string)

func (*Meta) SetLocalVersion

func (meta *Meta) SetLocalVersion(localVersion int64)

func (*Meta) SetMd5

func (meta *Meta) SetMd5(md5 string)

func (*Meta) SetUseLocal

func (meta *Meta) SetUseLocal(useLocal bool)

type Miner

type Miner struct {
	AbstractMiner
	// contains filtered or unexported fields
}

func NewMiner

func NewMiner() *Miner

func NewMinerDefaultGroupName

func NewMinerDefaultGroupName(defaultGroupName string) *Miner

func (*Miner) DefaultGroupName

func (miner *Miner) DefaultGroupName() string

func (*Miner) GetStone

func (miner *Miner) GetStone(group string, dataId string) (string, error)

type Minerable

type Minerable interface {
	GetStone(group string, dataId string) (string, error)
	GetStoneOrDefault(group string, dataId string, defaultValue string) (string, error)

	GetProperties(group string, dataId string) (*Properties, error)
	GetPropertiesOfDefaultGroup(dataId string) (*Properties, error)

	GetMiner(group string, dataId string) (Minerable, error)
	GetMinerOfDefaultGroup(dataId string) (Minerable, error)

	GetString(key string) string
	GetStringOrDefault(key string, defaultValue string) string
}

type Pbe

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

func NewPbe

func NewPbe(salt []byte, iterationCount int) *Pbe

func NewPbeDefault

func NewPbeDefault() *Pbe

func (*Pbe) Decrypt

func (pbe *Pbe) Decrypt(cipherText string, password string) (string, error)

func (*Pbe) Encrypt

func (pbe *Pbe) Encrypt(plainText string, password string) (string, error)

type PropertiesBasedMiner

type PropertiesBasedMiner struct {
	AbstractMiner
	// contains filtered or unexported fields
}

func NewPropertiesBasedMiner

func NewPropertiesBasedMiner(properties *Properties) *PropertiesBasedMiner

func (*PropertiesBasedMiner) DefaultGroupName

func (miner *PropertiesBasedMiner) DefaultGroupName() string

func (*PropertiesBasedMiner) GetStone

func (miner *PropertiesBasedMiner) GetStone(group string, dataId string) (string, error)

type Snapshot

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

func NewSnapshot

func NewSnapshot(conf *ManagerConf) *Snapshot

func (*Snapshot) GetSnapshot

func (snapshot *Snapshot) GetSnapshot(axis *Axis) (string, error)

func (*Snapshot) SaveSnapshot

func (snapshot *Snapshot) SaveSnapshot(axis *Axis, content string) error

Jump to

Keyboard shortcuts

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