conf

package
v0.0.0-...-83adff0 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2020 License: GPL-3.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	//ServiceName service name
	ServiceName = "upcredit-service"
)

Variables

View Source
var (
	ConfPath string
	Conf     = &Config{}

	CreditConfig = &CreditConf{}
	IsMaster     = true
)

Conf info.

Functions

func Init

func Init() (err error)

Init conf.

Types

type App

type App struct {
	Key    string
	Secret string
}

App for key secret.

type ArticleRuleConf

type ArticleRuleConf struct {
	AcceptOptypeData []int
	RejectOpTypeData []int

	// [score] ->[ optype list ]
	OptypeScoreData map[string][]int

	AcceptOptypeMap map[int]struct{}
	RejectOptypeMap map[int]struct{}

	// [optype] -> score
	OptypeScoreMap      map[int]int
	InitState           StateMachineState
	ArticleMaxOpenCount int
}

ArticleRuleConf 稿件记分规则

func (*ArticleRuleConf) AfterLoad

func (a *ArticleRuleConf) AfterLoad()

AfterLoad after load

func (*ArticleRuleConf) GetScore

func (a *ArticleRuleConf) GetScore(typ int, opType int, reason int) (score int)

GetScore get score by type, opType, reason

func (*ArticleRuleConf) IsAccepted

func (a *ArticleRuleConf) IsAccepted(typ int, opType int, reason int) (res bool)

IsAccepted is article accepted

func (*ArticleRuleConf) IsRejected

func (a *ArticleRuleConf) IsRejected(typ int, opType int, reason int) (res bool)

IsRejected is article reject

type Config

type Config struct {
	// bm
	BM *HTTPServers
	// db
	DB *DB
	// base
	// elk
	Xlog *log.Config
	// report log
	LogCli *log.AgentConfig
	// httpClinet
	HTTPClient *HTTPClient
	// tracer
	Tracer *trace.Config

	// Redis
	Redis *Redis

	// rpc server
	RPCServer *rpc.ServerConfig
	// auth
	Auth   *permit.Config
	IsTest bool

	CreditLogSub      *databus.Config
	BusinessBinLogSub *databus.Config
	RunStatJobConf    *RunStatJob

	MiscConf          *MiscConfig
	ElectionZooKeeper *Zookeeper
}

Config struct.

type CreditConf

type CreditConf struct {
	CalculateConf *CreditScoreCalculateConfig
	ArticleRule   *ArticleRuleConf
}

CreditConf 信用分数配置

func (*CreditConf) AfterLoad

func (c *CreditConf) AfterLoad()

AfterLoad load之后进行一些计算和整理

type CreditLog

type CreditLog struct {
	NeedLogState map[int]CreditLogStateInfo
}

CreditLog 需要记录日志的那些稿件状态,在配置文件中配置。只有这些状态,才会记录信用日志

type CreditLogStateInfo

type CreditLogStateInfo struct {
}

CreditLogStateInfo nothing

type CreditScoreCalculateConfig

type CreditScoreCalculateConfig struct {
	// 时间衰减因子
	// [离今年的差值] = 权重值
	TimeWeight  map[string]int
	TimeWeight2 map[int]int
}

CreditScoreCalculateConfig 分数计算配置

func (*CreditScoreCalculateConfig) AfterLoad

func (c *CreditScoreCalculateConfig) AfterLoad()

AfterLoad after load

type DB

type DB struct {
	Upcrm       *orm.Config
	UpcrmReader *orm.Config
}

DB conf.

type HTTPClient

type HTTPClient struct {
	Normal *bm.ClientConfig
	Slow   *bm.ClientConfig
}

HTTPClient conf.

type HTTPServers

type HTTPServers struct {
	Inner *blademaster.ServerConfig
}

HTTPServers for http server.

type Host

type Host struct {
	API     string
	Live    string
	Search  string
	Manager string
}

Host conf.

type MC

type MC struct {
	UpExpire time.Duration
	Up       *memcache.Config
}

MC memcache

type MiscConfig

type MiscConfig struct {
	CreditLogWriteRoutineNum int
	BusinessBinLogLimitRate  float64 // 每秒多少个,business bin log 消费速度
}

MiscConfig other config set

type Monitor

type Monitor struct {
	Host          string
	Moni          string
	UserName      string
	AppSecret     string
	AppToken      string
	IntervalAlarm time.Duration
}

Monitor conf.

type Redis

type Redis struct {
	Databus *struct {
		*redis.Config
		Expire time.Duration
	}
}

Redis conf.

type RunStatJob

type RunStatJob struct {
	// 启动时间,比如 12:00:00,每天定时运行
	StartTime string
	// 起的计算线程数
	WorkerNumber int
}

RunStatJob 定时任务时间

type StateMachineState

type StateMachineState struct {
	State  int
	Round  int
	Reason int
}

StateMachineState 状态机数据

type Zookeeper

type Zookeeper struct {
	Root    string
	Addrs   []string
	Timeout time.Duration
}

Zookeeper Server&Client settings.

Jump to

Keyboard shortcuts

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