service

package
v0.0.0-...-a3dc05e Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2021 License: MIT Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const PageSize = 1000

PageSize page size dump to disk

Variables

View Source
var Logger = logrus.New()

Functions

func AddConfigInfo

func AddConfigInfo(dataID, group, content string) error

AddConfigInfo add config to database/save it to disk and notify other gdiamond server nodes

func AddOrUpdate

func AddOrUpdate(dataID, group, content string) error

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

func FindConfigInfoLike(pageNo, pageSize int, dataID, group string) (*model.Page, error)

FindConfigInfoLike find config info by like dataID and group

func FindConfigInfoPage

func FindConfigInfoPage(pageNo, pageSize int, group, dataID string) (*model.Page, error)

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

func GetConfigInfoPath(dataID, group string) string

GetConfigInfoPath get local file path by dataID and group

func GetContentMD5

func GetContentMD5(dataID, group string) string

GetContentMD5 get memory cache md5 from dataID and group

func GetFilePath

func GetFilePath(dir string) string

GetFilePath filepath where diamond-server store config data

func IsModified

func IsModified(dataID, group string) bool

IsModified whether modified config info by memory cache

func LoadConfigInfoToDisk

func LoadConfigInfoToDisk(dataID, group string) error

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

func RemoveConfigInfoFromDisk(dataID, group string) error

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 SetupDumpTask

func SetupDumpTask() error

Init schedule dump disk task

func SetupLogger

func SetupLogger()

SetupLogger setup logrus path and format

func SetupRegisterTask

func SetupRegisterTask() error

SetupRegisterTask setup task register to name server

func UpdateConfigInfo

func UpdateConfigInfo(dataID, group, content string) error

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

Jump to

Keyboard shortcuts

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