Documentation
¶
Index ¶
- func FindModuleInPackage(pkg *pbsubstreams.Package, name string) (*pbsubstreams.Module, error)
- func InferEndpointFromNamespace(namespace string) string
- func LoadSpkgFromURL(spkgURL string, skipValidation bool) (*pbsubstreams.Package, error)
- func NewToolsLogsCmd(logger *zap.Logger) *cobra.Command
- func NewToolsLogsConnectionCmd(logger *zap.Logger) *cobra.Command
- func NewToolsLogsConnectionsCmd(logger *zap.Logger) *cobra.Command
- func NewToolsLogsReexecCmd(logger *zap.Logger) *cobra.Command
- func NewToolsStoreSizeCmd(logger *zap.Logger) *cobra.Command
- func NewToolsSubstreamsCmd[B firecore.Block](chain *firecore.Chain[B], logger *zap.Logger) *cobra.Command
- func ParseLogDateRange(args []string) (time.Time, time.Time, error)
- func ResolveAndLoadSpkg(ctx context.Context, stateStore, moduleHash string) (*pbsubstreams.Package, string, bool, error)
- func ResolveEndpoint(flagValue, namespace string) (string, error)
- func SpkgPackageLabel(pkg *pbsubstreams.Package) string
- type StoreSizeQuerier
- type StoreSizes
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FindModuleInPackage ¶ added in v1.14.6
func FindModuleInPackage(pkg *pbsubstreams.Package, name string) (*pbsubstreams.Module, error)
FindModuleInPackage finds a module by name in a package, with a fallback that strips a "<prefix>:<name>" form (e.g. "graph_node:map_events") since some output module names carry such a prefix while the package stores them without.
func InferEndpointFromNamespace ¶ added in v1.14.6
InferEndpointFromNamespace tries to find a Substreams endpoint for the given k8s namespace. Namespaces are typically "<chain>-<network>" (e.g. "eth-polygon-mainnet"). It progressively strips leading dash-separated segments until a match is found:
eth-polygon-mainnet → polygon-mainnet → mainnet
func LoadSpkgFromURL ¶ added in v1.14.6
func LoadSpkgFromURL(spkgURL string, skipValidation bool) (*pbsubstreams.Package, error)
LoadSpkgFromURL reads and parses the spkg at the given URL. When skipValidation is true, module output type and package validation are disabled — required for .partial.spkg.zst files produced by older Substreams RPC versions.
func NewToolsLogsCmd ¶ added in v1.13.1
NewToolsLogsCmd returns the parent "logs" command for Substreams logs analysis tools
func NewToolsLogsConnectionCmd ¶ added in v1.14.6
NewToolsLogsConnectionCmd returns the "connection" subcommand which prints the .spkg URL and the relevant Substreams request information for a single trace ID.
func NewToolsLogsConnectionsCmd ¶ added in v1.13.1
NewToolsLogsConnectionsCmd returns the "connections" subcommand
func NewToolsLogsReexecCmd ¶ added in v1.14.4
func NewToolsSubstreamsCmd ¶
func ParseLogDateRange ¶ added in v1.14.6
ParseLogDateRange parses 1 or 2 args into a [start, end) time range.
One arg supports:
- relative duration ("1d", "2hr", "30m", "1 day ago")
- "<start>/<end>" or "<start>:<end>" range (the colon split scans right-to-left so timezone-suffixed timestamps like "...10:00:00Z" work)
- a single ISO timestamp, treated as [timestamp, now)
Two args treats arg[0] as start and arg[1] as end.
func ResolveAndLoadSpkg ¶ added in v1.14.6
func ResolveAndLoadSpkg(ctx context.Context, stateStore, moduleHash string) (*pbsubstreams.Package, string, bool, error)
ResolveAndLoadSpkg checks which spkg variant exists under stateStore/moduleHash/ and loads it. Older Substreams RPC versions produced .partial.spkg.zst files which require skipping package and module output type validation. Returns the package, the full URL that was loaded, whether it is partial, and any error.
func ResolveEndpoint ¶ added in v1.14.6
ResolveEndpoint returns the endpoint to use: the explicit flag value if set, otherwise inferred from the k8s namespace via the networks registry. When inferred, a one-line note is printed to stdout for the user.
func SpkgPackageLabel ¶ added in v1.14.6
func SpkgPackageLabel(pkg *pbsubstreams.Package) string
SpkgPackageLabel returns a "name@version" label for the given package, or "<unknown>" if no PackageMeta is set.
Types ¶
type StoreSizeQuerier ¶
type StoreSizeQuerier interface {
// GetStoreSizes returns both total compressed size and latest file's uncompressed size
GetStoreSizes(ctx context.Context, path string) (*StoreSizes, error)
}
StoreSizeQuerier provides an interface for getting the total size of files in a storage location. This is structured to be easily portable back to dstore.
func NewStoreSizeQuerier ¶
func NewStoreSizeQuerier(storeURL string) (StoreSizeQuerier, error)
NewStoreSizeQuerier creates an appropriate size querier based on the storage URL
type StoreSizes ¶
type StoreSizes struct {
TotalCompressed int64 // Total size of all files (compressed)
LiveUncompressed *int64 // Uncompressed size from latest file metadata (nil if not available)
LiveCompressed int64 // Compressed size of latest file only
LatestFile string // Name of the latest file
}
StoreSizes contains the compressed (total) and uncompressed (live) sizes