common

package
v1.5.4 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2023 License: Apache-2.0, BSD-2-Clause, BSD-3-Clause, + 3 more Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// PatternService is the pattern of service name
	PatternService = "svc#%s#%s#%s"
	// CacheSuffix filesystem suffix
	CacheSuffix = ".json"
	// PatternGlob is the pattern of glob
	PatternGlob = "svc#?*#?*#?*"
)

Variables

This section is empty.

Functions

func ServiceEventKeyToFileName

func ServiceEventKeyToFileName(svcKey model.ServiceEventKey) string

ServiceEventKeyToFileName 服务名转化为文件名

Types

type CacheFileInfo

type CacheFileInfo struct {
	Msg      proto.Message
	FileInfo os.FileInfo
}

CacheFileInfo 文件信息

type CachePersistHandler

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

CachePersistHandler 持久化工具类

func NewCachePersistHandler

func NewCachePersistHandler(persistDir string, maxWriteRetry int,
	maxReadRetry int, retryInterval time.Duration) (*CachePersistHandler, error)

NewCachePersistHandler create persistence handler

func (*CachePersistHandler) DeleteCacheFromFile

func (cph *CachePersistHandler) DeleteCacheFromFile(fileName string)

DeleteCacheFromFile 删除缓存文件

func (*CachePersistHandler) LoadMessageFromFile

func (cph *CachePersistHandler) LoadMessageFromFile(relativeFile string, message proto.Message) error

LoadMessageFromFile 从相对文件中加载缓存

func (*CachePersistHandler) LoadPersistedServices

func (cph *CachePersistHandler) LoadPersistedServices() map[model.ServiceEventKey]CacheFileInfo

LoadPersistedServices 加载目录中所有的缓存文件

func (*CachePersistHandler) SaveMessageToFile

func (cph *CachePersistHandler) SaveMessageToFile(fileName string, svcResp proto.Message)

SaveMessageToFile 按服务来进行缓存存储

Jump to

Keyboard shortcuts

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