walk

package
v0.0.0-...-2de43c5 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2024 License: GPL-3.0 Imports: 9 Imported by: 2

Documentation

Overview

Package walk allows callers to walk the cache folders for various reasons.

Index

Constants

This section is empty.

Variables

View Source
var CacheTypeToFolder = map[CacheType]string{
	Cache_NotACache:    "unknown",
	Cache_Abis:         "abis",
	Cache_Monitors:     "monitors",
	Cache_Names:        "names",
	Cache_Tmp:          "tmp",
	Cache_Blocks:       "blocks",
	Cache_Logs:         "logs",
	Cache_Receipts:     "receipts",
	Cache_Results:      "results",
	Cache_Slurps:       "slurps",
	Cache_State:        "state",
	Cache_Statements:   "statements",
	Cache_Tokens:       "tokens",
	Cache_Traces:       "traces",
	Cache_Transactions: "transactions",
	Cache_Withdrawals:  "withdrawals",
	Index_Bloom:        "blooms",
	Index_Final:        "finalized",
	Index_Ripe:         "ripe",
	Index_Staging:      "staging",
	Index_Unripe:       "unripe",
	Index_Maps:         "maps",
	Config:             "config",
	Regular:            "regular",
}

CacheTypeToFolder is a map of cache types to the folder name (also, it acts as the mode in chifra status)

Functions

func ForEveryFileInFolder

func ForEveryFileInFolder(path string, forEvery ForEveryFunc, vP any) error

func GetCacheItem

func GetCacheItem(chain string, testMode bool, cT CacheType, cacheInfo *CacheFileInfo) (map[string]any, error)

func GetRootPathFromCacheType

func GetRootPathFromCacheType(chain string, cacheType CacheType) string

func IsCacheType

func IsCacheType(path string, cT CacheType, checkExt bool) bool

func WalkCacheFolder

func WalkCacheFolder(ctx context.Context, chain string, cacheType CacheType, data interface{}, filenameChan chan<- CacheFileInfo)

func WalkCacheName

func WalkCacheName(ct CacheType) string

func WalkConfigFolders

func WalkConfigFolders(ctx context.Context, data interface{}, filenameChan chan<- CacheFileInfo)

func WalkFolder

func WalkFolder(ctx context.Context, path string, data interface{}, filenameChan chan<- CacheFileInfo)

Types

type CacheFileInfo

type CacheFileInfo struct {
	Type      CacheType
	FileRange base.FileRange
	TsRange   base.TimestampRange
	Path      string
	IsDir     bool
	Data      interface{}
}

type CacheType

type CacheType uint
const (
	Cache_NotACache CacheType = iota
	Cache_Abis
	Cache_Monitors
	Cache_Names
	Cache_Tmp

	Cache_Blocks
	Cache_Logs
	Cache_Receipts
	Cache_Results
	Cache_Slurps
	Cache_State
	Cache_Statements
	Cache_Tokens
	Cache_Traces
	Cache_Transactions
	Cache_Withdrawals

	Index_Bloom
	Index_Final
	Index_Ripe
	Index_Staging
	Index_Unripe
	Index_Maps

	Config
	Regular
)

func CacheTypesFromStringSlice

func CacheTypesFromStringSlice(strs []string) []CacheType

func (CacheType) String

func (ct CacheType) String() string

type CacheWalker

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

func NewCacheWalker

func NewCacheWalker(chain string, testMode bool, maxTests int, visitFunc walkerFunc) CacheWalker

func (*CacheWalker) MaxTests

func (walker *CacheWalker) MaxTests() int

func (*CacheWalker) WalkBloomFilters

func (walker *CacheWalker) WalkBloomFilters(blockNums []base.Blknum) error

func (*CacheWalker) WalkRegularFolder

func (walker *CacheWalker) WalkRegularFolder(path string) error

type ForEveryFunc

type ForEveryFunc func(path string, vP any) (bool, error)

Jump to

Keyboard shortcuts

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