walk

package
v0.0.0-...-3f8eaf4 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: GPL-3.0 Imports: 10 Imported by: 0

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_Results:      "results",
	Cache_Logs:         "logs",
	Cache_Slurps:       "slurps",
	Cache_State:        "state",
	Cache_Statements:   "statements",
	Cache_Tokens:       "tokens",
	Cache_Traces:       "traces",
	Cache_Transactions: "transactions",
	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 CacheName

func CacheName(ct CacheType) string

func GetCacheItem

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

func GetDecachePath

func GetDecachePath(chain string, typ CacheType, address base.Address, blockNum, txid uint32) (basePath, path string)

GetDecachePath returns the path and the basePath for a given cache item depending on type

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 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_Results
	Cache_Logs
	Cache_Slurps
	Cache_State
	Cache_Statements
	Cache_Tokens
	Cache_Traces
	Cache_Transactions

	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 []uint64) error

func (*CacheWalker) WalkRegularFolder

func (walker *CacheWalker) WalkRegularFolder(path string, blockNums []uint64) error

Jump to

Keyboard shortcuts

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