config

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: 18 Imported by: 7

Documentation

Overview

Package config reads and manages configuration files

Index

Constants

This section is empty.

Variables

View Source
var SpecTags = map[string]string{
	"trueblocks-core@v0.40.0":        "QmUou7zX2g2tY58LP1A2GyP5RF9nbJsoxKTp299ah3svgb",
	"trueblocks-core@v2.0.0-release": "QmUyyU8wKW57c3CuwphhMdZb2QA5bsjt9vVfTE6LcBKmE9",
}

SpecTags allows us to go from a version string to an IPFS hash pointing to the spec

View Source
var VersionTags = map[string]string{
	"0x81ae14ba68e372bc9bd4a295b844abd8e72b1de10fcd706e624647701d911da1": "trueblocks-core@v0.40.0",
	"0x6fc0c6dd027719f456c1e50a329f6157767325aa937411fa6e7be9359d9e0046": "trueblocks-core@v2.0.0-release",
}

VersionTags allows us to go from the version bytes found in the chunks to a version string

Functions

func EstablishCachePaths

func EstablishCachePaths(cachePath string)

EstablishCachePaths sets up the cache folders and subfolders. It only returns if it succeeds.

func EstablishIndexPaths

func EstablishIndexPaths(indexPath string)

EstablishIndexPaths sets up the index path and subfolders. It only returns if it succeeds.

func ExpectedVersion

func ExpectedVersion() string

func GetChain

func GetChain(chain string) chainGroup

GetChain returns the chain for a given chain

func GetChains

func GetChains() []chainGroup

GetChains returns a list of all chains configured in the config file. Note, there is no "official" list. Users may add their own chains.

func GetKey

func GetKey(set string) keyGroup

func GetPinning

func GetPinning() pinningGroup

func GetPublisher

func GetPublisher(value string) string

func GetSettings

func GetSettings() settingsGroup

func GetUnchained

func GetUnchained() unchainedGroup

func GetVersion

func GetVersion() versionGroup

func HeaderHash

func HeaderHash(version string) []byte

func IpfsRunning

func IpfsRunning() bool

func IsChainConfigured

func IsChainConfigured(needle string) bool

IsChainConfigured returns true if the chain is configured in the config file.

func KnownVersionTag

func KnownVersionTag(tag string) bool

func MergeScrapeConfig

func MergeScrapeConfig(fn string, scrape *ScrapeSettings) error

func MustGetPathToChainConfig

func MustGetPathToChainConfig(chain string) string

MustGetPathToChainConfig returns the chain-specific config folder ignoring errors

func PathToCache

func PathToCache(chain string) string

PathToCache returns the one and only cachePath

func PathToChainConfig

func PathToChainConfig(chain string) (string, error)

PathToChainConfig returns the chain-specific config folder

func PathToConfigFile

func PathToConfigFile() string

PathToConfigFile returns the path where to find the configuration file

func PathToIndex

func PathToIndex(chain string) string

PathToIndex returns the one and only indexPath

func PathToManifest

func PathToManifest(chain string) string

PathToManifest returns the path to the manifest database per chain

func PathToRootConfig

func PathToRootConfig() string

PathToRootConfig returns the path where to find configuration files

func PathToTimestamps

func PathToTimestamps(chain string) string

PathToTimestamps returns the path to the timestamps database per chain

func SetExpectedVersion

func SetExpectedVersion(version string)

func SetScrapeArgs

func SetScrapeArgs(chain string, args map[string]string)

Types

type ConfigFile

type ConfigFile struct {
	Version   versionGroup          `toml:"version"`
	Settings  settingsGroup         `toml:"settings"`
	Keys      map[string]keyGroup   `toml:"keys"`
	Pinning   pinningGroup          `toml:"pinning"`
	Unchained unchainedGroup        `toml:"unchained"`
	Chains    map[string]chainGroup `toml:"chains"`
}

func GetRootConfig

func GetRootConfig() *ConfigFile

GetRootConfig reads and the configuration located in trueBlocks.toml file. Note that this routine is local to the package

type OldScrape

type OldScrape struct {
	Settings oldScrapeGroup `toml:"settings"`
}

type ScrapeSettings

type ScrapeSettings struct {
	AppsPerChunk uint64 `toml:"appsPerChunk" json:"appsPerChunk"`
	SnapToGrid   uint64 `toml:"snapToGrid" json:"snapToGrid"`
	FirstSnap    uint64 `toml:"firstSnap" json:"firstSnap"`
	UnripeDist   uint64 `toml:"unripeDist" json:"unripeDist"`
	AllowMissing bool   `toml:"allowMissing" json:"allowMissing,omitempty"`
	ChannelCount uint64 `toml:"channelCount" json:"channelCount,omitempty"`
}

ScrapeSettings carries config information for the scraper

func GetScrape

func GetScrape(chain string) ScrapeSettings

GetScrape returns the scraper settings per chain

func (*ScrapeSettings) TestLog

func (s *ScrapeSettings) TestLog(chain string, test bool)

Jump to

Keyboard shortcuts

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