Documentation
¶
Index ¶
- Variables
- func CheckMergedBlocks(ctx context.Context, logger *zap.Logger, storeURL string, fileBlockSize uint32, ...) error
- func DownloadFirehoseBlocks(ctx context.Context, endpoint string, jwt string, insecure bool, ...) error
- func FlagMergedBlocks(ctx context.Context, logger *zap.Logger, sourceStoreURL string, ...) error
- func PrettyBlockNum(b uint64) string
- func RoundToBundleEndBlock(block, fileBlockSize uint32) uint32
- func RoundToBundleStartBlock(block, fileBlockSize uint32) uint32
- func WalkBlockPrefix(blockRange BlockRange, fileBlockSize uint32) string
- type BlockNum
- type BlockRange
- type FilteringFilters
- type FirehoseResponseDecoder
- type PrintDetails
- type TransformsSetter
Constants ¶
This section is empty.
Variables ¶
var Flags = &flags{}
var GetFirehoseClientCmd = func(zlog *zap.Logger, tracer logging.Tracer, transformsSetter TransformsSetter) *cobra.Command { out := &cobra.Command{ Use: "firehose-client", Short: "Connects to a Firehose endpoint over gRPC and print block stream as JSON to terminal", Args: cobra.ExactArgs(3), RunE: getFirehoseClientE(zlog, tracer, transformsSetter), } out.Flags().StringP("api-token-env-var", "a", "FIREHOSE_API_TOKEN", "Look for a JWT in this environment variable to authenticate against endpoint") out.Flags().String("compression", "none", "The HTTP compression: use either 'none', 'gzip' or 'zstd'") out.Flags().String("cursor", "", "Use this cursor with the request to resume your stream at the following block pointed by the cursor") out.Flags().BoolP("plaintext", "p", false, "Use plaintext connection to Firehose") out.Flags().BoolP("insecure", "k", false, "Use SSL connection to Firehose but skip SSL certificate validation") out.Flags().Bool("print-cursor-only", false, "Skip block decoding, only print the step cursor (useful for performance testing)") out.Flags().Bool("final-blocks-only", false, "Only ask for final blocks") return out }
You should add your custom 'transforms' flags to this command in your init(), then parse them in transformsSetter
var GetFirehosePrometheusExporterCmd = func(zlog *zap.Logger, tracer logging.Tracer, transformsSetter TransformsSetter) *cobra.Command { out := &cobra.Command{ Use: "firehose-prometheus-exporter <endpoint:port>", Short: "stream blocks near the chain HEAD and report to prometheus", Args: cobra.ExactArgs(1), RunE: runPrometheusExporterE(zlog, tracer, transformsSetter), } out.Flags().StringP("api-token-env-var", "a", "FIREHOSE_API_TOKEN", "Look for a JWT in this environment variable to authenticate against endpoint") out.Flags().BoolP("plaintext", "p", false, "Use plaintext connection to firehose") out.Flags().BoolP("insecure", "k", false, "Skip SSL certificate validation when connecting to firehose") return out }
You should add your custom 'transforms' flags to this command in your init(), then parse them in transformsSetter
var GetFirehoseSingleBlockClientCmd = func(zlog *zap.Logger, tracer logging.Tracer) *cobra.Command { out := &cobra.Command{ Use: "firehose-single-block-client {endpoint} {block_num|block_num:block_id|cursor}", Short: "fetch a single block from firehose and print as JSON", Args: cobra.ExactArgs(2), RunE: getFirehoseSingleBlockClientE(zlog, tracer), Example: "firehose-single-block-client --compression=gzip my.firehose.endpoint:443 2344:0x32d8e8d98a798da98d6as9d69899as86s9898d8ss8d87", } out.Flags().StringP("api-token-env-var", "a", "FIREHOSE_API_TOKEN", "Look for a JWT in this environment variable to authenticate against endpoint") out.Flags().String("compression", "none", "http compression: use either 'none', 'gzip' or 'zstd'") out.Flags().BoolP("plaintext", "p", false, "Use plaintext connection to firehose") out.Flags().BoolP("insecure", "k", false, "Skip SSL certificate validation when connecting to firehose") return out }
You should add your custom 'transforms' flags to this command in your init(), then parse them in transformsSetter
var GetMergedBlocksUpgrader = func(zlog *zap.Logger, tracer logging.Tracer, tweakFunc func(cmd *cobra.Command, block *bstream.Block) (*bstream.Block, error)) *cobra.Command { out := &cobra.Command{ Use: "upgrade-merged-blocks <source> <destination> <start> <stop>", Short: "from a merged-blocks source, rewrite blocks to a new merged-blocks destination, while applying all possible upgrades", Args: cobra.ExactArgs(4), RunE: getMergedBlockUpgrader(zlog, tracer, tweakFunc), } return out }
Functions ¶
func CheckMergedBlocks ¶
func DownloadFirehoseBlocks ¶
func FlagMergedBlocks ¶
func FlagMergedBlocks( ctx context.Context, logger *zap.Logger, sourceStoreURL string, destStoreURL string, fileBlockSize uint32, blockRange BlockRange, ) error
FlagMergedBlocks will write a list of base-block-numbers to a store, for merged-blocks-files that are broken or missing broken merged-blocks-files are the ones that contain "empty" blocks (no ID) or unlinkable blocks there could be false positives on unlinkable blocks, though output files are like this: 0000123100.broken 0000123500.missing
func PrettyBlockNum ¶
func RoundToBundleEndBlock ¶
func RoundToBundleStartBlock ¶
func WalkBlockPrefix ¶
func WalkBlockPrefix(blockRange BlockRange, fileBlockSize uint32) string
Types ¶
type BlockRange ¶
func (BlockRange) Bounded ¶
func (b BlockRange) Bounded() bool
func (BlockRange) ReprocRange ¶
func (b BlockRange) ReprocRange() string
func (BlockRange) String ¶
func (b BlockRange) String() string
func (BlockRange) Unbounded ¶
func (b BlockRange) Unbounded() bool
type FilteringFilters ¶
func (*FilteringFilters) Key ¶
func (f *FilteringFilters) Key() string
type FirehoseResponseDecoder ¶
FirehoseResponseDecoder will usually look like this (+ error handling):
block := &pbcodec.Block{} // chain-specific protobuf Block
anypb.UnmarshalTo(in, in.block, proto.UnmarshalOptions{})
return codec.BlockFromProto(block) // chain-specific bstream block converter
type PrintDetails ¶
type PrintDetails uint8
const ( PrintNothing PrintDetails = iota PrintStats PrintFull MaxUint64 = ^uint64(0) )