logic

package
v0.0.0-...-68bdf18 Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2018 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrEditByOther  = errors.New("this service configure is editing by other user now")
	ErrExist        = errors.New("this service is already exist")
	ErrVersionWrong = errors.New("version number is wrong")
	ErrNoChange     = errors.New("no any different")
)

错误

View Source
var AdminServer *tcp.Server

全局:admin server,服务于web操作

View Source
var BrokerServer *tcp.Server

全局:broker server,服务于agent

Functions

func AddConfig

func AddConfig(serviceKey string, confKeys []string, values []string) error

新增配置

func PullConfigHandler

func PullConfigHandler(session *tcp.Session, pb proto.Message)

PullServiceConfigReqId消息的回调函数

func StartAdminService

func StartAdminService()

func StartBrokerService

func StartBrokerService()

func SubscribeHandler

func SubscribeHandler(session *tcp.Session, pb proto.Message)

SubscribeReqId消息的回调函数

func UpdateConfig

func UpdateConfig(serviceKey string, version uint, confKeys []string, values []string) error

修改配置

Types

type CacheLayerStructure

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

缓存层

var CacheLayer CacheLayerStructure

全局配置

func (*CacheLayerStructure) GetData

func (cd *CacheLayerStructure) GetData(serviceKey string) ([]string, []string, uint)

读取缓存,获取serviceKey, 最后一个返回值是版本号,是否存在系统中不存在则为0

func (*CacheLayerStructure) UpdateExpiredItem

func (cd *CacheLayerStructure) UpdateExpiredItem(delay int64)

更新过期缓存 (过期时间:delay,秒)

func (*CacheLayerStructure) WriteBack

func (cd *CacheLayerStructure) WriteBack(serviceKey string, newVersion uint, configKeys []string, values []string)

回写缓存

type CacheUint

type CacheUint struct {
	dao.ServiceData
	// contains filtered or unexported fields
}

缓存单元,记录了加载时间

type EditControl

type EditControl struct {
	// contains filtered or unexported fields
}
var EditingControl EditControl //记录正在编辑

func (*EditControl) DoneEditing

func (editControl *EditControl) DoneEditing(serviceKey string)

完成编辑

func (*EditControl) TryMarkEditing

func (editControl *EditControl) TryMarkEditing(serviceKey string) bool

标记某service key处于“编辑”状态 若已在编辑中,返回false 否则返回true

Jump to

Keyboard shortcuts

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