Documentation ¶
Index ¶
- Constants
- Variables
- func AddConfigInfo(dataID, group, content string) error
- func AddOrUpdate(dataID, group, content string) error
- func DumpAll2Disk() error
- func FetchPage(sqlCountRows, sqlFetchRows string, pageNo, pageSize int, args ...interface{}) (*model.Page, error)
- func FindConfigInfo(dataID, group string) (*model.ConfigInfo, error)
- func FindConfigInfoLike(pageNo, pageSize int, dataID, group string) (*model.Page, error)
- func FindConfigInfoPage(pageNo, pageSize int, group, dataID string) (*model.Page, error)
- func GetCache(dataID, group string) *model.ConfigInfo
- func GetConfigInfoPath(dataID, group string) string
- func GetContentMD5(dataID, group string) string
- func GetFilePath(dir string) string
- func IsModified(dataID, group string) bool
- func LoadConfigInfoToDisk(dataID, group string) error
- func NotifyOtherNodes(dataID, group string)
- func RemoveConfigInfoFromDisk(dataID, group string) error
- func SaveToDisk(info *model.ConfigInfo) error
- func SetupDumpTask() error
- func SetupLogger()
- func SetupRegisterTask() error
- func UpdateConfigInfo(dataID, group, content string) error
- func UpdateMD5Cache(configInfo *model.ConfigInfo)
- type Register
Constants ¶
const PageSize = 1000
PageSize page size dump to disk
Variables ¶
var Logger = logrus.New()
Functions ¶
func AddConfigInfo ¶
AddConfigInfo add config to database/save it to disk and notify other gdiamond server nodes
func AddOrUpdate ¶
func DumpAll2Disk ¶
func DumpAll2Disk() error
DumpAll2Disk dump all config info from database to disk
func FetchPage ¶
func FetchPage(sqlCountRows, sqlFetchRows string, pageNo, pageSize int, args ...interface{}) (*model.Page, error)
FetchPage util for fetch data by page page data need total count and total page so it count rows sql, args will pass to count row sql and fetch row sql
func FindConfigInfo ¶
func FindConfigInfo(dataID, group string) (*model.ConfigInfo, error)
FindConfigInfo find config info from db by dataID and group
func FindConfigInfoLike ¶
FindConfigInfoLike find config info by like dataID and group
func FindConfigInfoPage ¶
FindConfigInfoPage find config info by page, group and dataID may be empty
func GetCache ¶
func GetCache(dataID, group string) *model.ConfigInfo
GetCache get memory cache by dataID and group
func GetConfigInfoPath ¶
GetConfigInfoPath get local file path by dataID and group
func GetContentMD5 ¶
GetContentMD5 get memory cache md5 from dataID and group
func GetFilePath ¶
GetFilePath filepath where diamond-server store config data
func IsModified ¶
IsModified whether modified config info by memory cache
func LoadConfigInfoToDisk ¶
LoadConfigInfoToDisk when other node call NotifyOtherNodes method gdiamond-server will invoke it method to load config info from db to disk
func NotifyOtherNodes ¶
func NotifyOtherNodes(dataID, group string)
NotifyOtherNodes notify other gdiamond server node when config info changed
func RemoveConfigInfoFromDisk ¶
RemoveConfigInfoFromDisk remove config info file from disk, it mean delete file
func SaveToDisk ¶
func SaveToDisk(info *model.ConfigInfo) error
SaveToDisk write config info data to local file create dir or file if necessary
func SetupRegisterTask ¶
func SetupRegisterTask() error
SetupRegisterTask setup task register to name server
func UpdateConfigInfo ¶
UpdateConfigInfo update config info
func UpdateMD5Cache ¶
func UpdateMD5Cache(configInfo *model.ConfigInfo)
UpdateMD5Cache update memory cache, the most important is md5
Types ¶
type Register ¶
type Register struct { }
Register register gdiamond-server to nameserver
func (*Register) RegisterServerAll ¶
func (r *Register) RegisterServerAll(nameServerAddressList *singlylinkedlist.List)
RegisterServerAll register gdiamond-server to all nameserver