Documentation ¶
Index ¶
- func Base64StdDecode(src []byte) ([]byte, error)
- func CatchUpFileID(loggerName, currentDay string) (int64, int64, error)
- func CurrentDay(day time.Time) string
- func DayTime(dayStr string) time.Time
- func DirFileCount(dirPath string) int
- func ExecuteFunctionByRetry(f func() error) error
- func GenChainID(forkHeight int32) string
- func GenEventOrphanTableName(exporterTag string, timestamp Timestamp) string
- func GenExporterInfoKey(exporterTag string) string
- func GenLogFileParentPath(basePath, loggerName string, day string) string
- func GenLogFilename(id int64) string
- func GenLogFilepath(basePath, loggerName string, day string, id int64) string
- func GenResolverTag(exporterTag string) string
- func GenRevisionTableName(exporterTag string, timestamp Timestamp) string
- func GenSnapshotDataTableName(exporterTag string, timestamp Timestamp) string
- func GenSnapshotID(targetChainID string, targetChainHeight int32, initTimestamp Timestamp) string
- func GenSnapshotSyncTableName(exporterTag string, timestamp Timestamp) string
- func GenStateTableName(exporterTag string, timestamp Timestamp) string
- func IsDirExisted(dirPath string) bool
- func IsFileExisted(filePath string) bool
- func LookupEnv(envKey string) (string, error)
- func LookupEnvPairs(envPairs *map[string]string)
- func ParseChainIDFromSnapshotID(snapshotID string) string
- func ParseExporterTagFromExporterInfoKey(exporterInfoKey string) string
- func ScanFileLines(filePath string, startN int64) ([][]byte, bool, error)
- func StructToJsonStr(s any) string
- type Timestamp
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Base64StdDecode ¶
Base64StdDecode 自动解码传入的 base64 字节数组
func CurrentDay ¶
func DirFileCount ¶
func ExecuteFunctionByRetry ¶
func GenChainID ¶
GenChainID 根据当前链所处的 fork 的区块高度作为该 chain 的唯一标识, TODO 存在不同 fork 高度相同的情况,需要加以区分
func GenEventOrphanTableName ¶ added in v0.0.2
func GenExporterInfoKey ¶
func GenLogFileParentPath ¶
GenLogFileParentPath basePath/loggerName/day/
func GenLogFilename ¶
func GenLogFilepath ¶
GenLogFilepath basePath/loggerName/day/id.log
func GenResolverTag ¶
func GenRevisionTableName ¶
func GenSnapshotID ¶
func GenStateTableName ¶
func IsDirExisted ¶
func IsFileExisted ¶
func LookupEnvPairs ¶
LookupEnvPairs 根据所有 key 查找环境变量,并通过 map 保存,如果中途有 error 不会直接中断,而是继续
func ScanFileLines ¶
ScanFileLines 从 startN 处开始,scan 数据到达文件结尾,返回数据数组,eof 和 error, eof 判断是按照自定义的一行来判断的,注意这里潜在的问题是 logger 与 exporter 读写竞争可能导致日志输出到错误的 day, 所以在 resolver 处理时,只依赖数据本身,不依赖 logger 的信息,logger 和 exporter 只需要保证不丢数据就行
func StructToJsonStr ¶
Types ¶
type Timestamp ¶
type Timestamp int64
Timestamp 是 19 位长,精确到纳秒的时间戳
func (Timestamp) FormatString ¶
func (Timestamp) FormatTime ¶
Click to show internal directories.
Click to hide internal directories.