{"modulePath":"github.com/parallelcointeam/exploder","version":"v2.1.3+incompatible","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package blockdata\n\n## Functions\n\n```go\nfunc DisableLog()\n```\nDisableLog disables all library log output.  Logging output is disabled by default until UseLogger is called.\n\n```go\nfunc JSONFormatBlockData(data *BlockData) (*bytes.Buffer, error)\n```\nJSONFormatBlockData concatenates block data results into a single JSON object with primary keys for the result type\n\n```go\nfunc NewChainMonitor(collector *Collector,\n\tsavers []BlockDataSaver, reorgSavers []BlockDataSaver,\n\tquit chan struct{}, wg *sync.WaitGroup,\n\taddrs map[string]txhelpers.TxAction, blockChan chan *chainhash.Hash,\n\trecvTxBlockChan chan *txhelpers.BlockWatchedTx,\n\treorgChan chan *ReorgData) *chainMonitor\n```\nNewChainMonitor creates a new chainMonitor\n\n```go\nfunc UseLogger(logger slog.Logger)\n```\nUseLogger uses a specified Logger to output package logging info.\n\n## Types\n\n```go\ntype BlockData struct {\n\tHeader           dcrjson.GetBlockHeaderVerboseResult\n\tConnections      int32\n\tFeeInfo          dcrjson.FeeInfoBlock\n\tCurrentStakeDiff dcrjson.GetStakeDifficultyResult\n\tEstStakeDiff     dcrjson.EstimateStakeDiffResult\n\tPoolInfo         apitypes.TicketPoolInfo\n\tExtraInfo        apitypes.BlockExplorerExtraInfo\n\tPriceWindowNum   int\n\tIdxBlockInWindow int\n\tWinningTickets   []string\n}\n```\nBlockData contains all the data collected by a Collector and stored by a BlockDataSaver. TODO: consider if pointers are desirable here.\n\n```go\nfunc (b *BlockData) ToBlockExplorerSummary() apitypes.BlockExplorerBasic\n```\nToBlockExplorerSummary returns a BlockExplorerBasic\n\n```go\nfunc (b *BlockData) ToBlockSummary() apitypes.BlockDataBasic\n```\nToBlockSummary returns an apitypes.BlockDataBasic object from the blockdata\n\n```go\nfunc (b *BlockData) ToStakeInfoExtended() apitypes.StakeInfoExtended\n```\nToStakeInfoExtended returns an apitypes.StakeInfoExtended object from the blockdata\n\n```go\nfunc (b *BlockData) ToStakeInfoExtendedEstimates() apitypes.StakeInfoExtendedEstimates\n```\nToStakeInfoExtendedEstimates returns an apitypes.StakeInfoExtendedEstimates object from the blockdata\n\n```go\ntype BlockDataSaver interface {\n\tStore(*BlockData, *wire.MsgBlock) error\n}\n```\nBlockDataSaver is an interface for saving/storing BlockData\n\n```go\ntype BlockDataToJSONFiles struct {\n\t// contains filtered or unexported fields\n}\n```\nBlockDataToJSONFiles implements BlockDataSaver interface for JSON output to the file system\n\n```go\nfunc NewBlockDataToJSONFiles(folder string, fileBase string,\n\tm ...*sync.Mutex) *BlockDataToJSONFiles\n```\nNewBlockDataToJSONFiles creates a new BlockDataToJSONFiles with optional existing mutex\n\n```go\nfunc (s *BlockDataToJSONFiles) Store(data *BlockData, _ *wire.MsgBlock) error\n```\nStore writes BlockData to a file in JSON format The file name is nameBase+height+\".json\".\n\n```go\ntype BlockDataToJSONStdOut struct {\n\t// contains filtered or unexported fields\n}\n```\nBlockDataToJSONStdOut implements BlockDataSaver interface for JSON output to stdout\n\n```go\nfunc NewBlockDataToJSONStdOut(m ...*sync.Mutex) *BlockDataToJSONStdOut\n```\nNewBlockDataToJSONStdOut creates a new BlockDataToJSONStdOut with optional existing mutex\n\n```go\nfunc (s *BlockDataToJSONStdOut) Store(data *BlockData, _ *wire.MsgBlock) error\n```\nStore writes BlockData to stdout in JSON format\n\n```go\ntype BlockDataToSummaryStdOut struct {\n\t// contains filtered or unexported fields\n}\n```\nBlockDataToSummaryStdOut implements BlockDataSaver interface for plain text summary to stdout\n\n```go\nfunc NewBlockDataToSummaryStdOut(sdiffWinSize int64, m ...*sync.Mutex) *BlockDataToSummaryStdOut\n```\nNewBlockDataToSummaryStdOut creates a new BlockDataToSummaryStdOut with optional existing mutex\n\n```go\nfunc (s *BlockDataToSummaryStdOut) Store(data *BlockData, _ *wire.MsgBlock) error\n```\nStore writes BlockData to stdout as plain text summary\n\n```go\ntype Collector struct {\n\t// contains filtered or unexported fields\n}\n```\nCollector models a structure for the source of the blockdata\n\n```go\nfunc NewCollector(dcrdChainSvr *rpcclient.Client, params *chaincfg.Params,\n\tstakeDB *stakedb.StakeDatabase) *Collector\n```\nNewCollector creates a new Collector.\n\n```go\nfunc (t *Collector) Collect() (*BlockData, *wire.MsgBlock, error)\n```\nCollect collects chain data at the current best block.\n\n```go\nfunc (t *Collector) CollectAPITypes(hash *chainhash.Hash) (*apitypes.BlockDataBasic, *apitypes.StakeInfoExtended)\n```\nCollectAPITypes uses CollectBlockInfo to collect block data, then organizes it into the BlockDataBasic and StakeInfoExtended and dcrdataapi types.\n\n```go\nfunc (t *Collector) CollectBlockInfo(hash *chainhash.Hash) (*apitypes.BlockDataBasic,\n\t*dcrjson.FeeInfoBlock, *dcrjson.GetBlockHeaderVerboseResult,\n\t*apitypes.BlockExplorerExtraInfo, *wire.MsgBlock, error)\n```\nCollectBlockInfo uses the chain server and the stake DB to collect most of the block data required by Collect() that is specific to the block with the given hash.\n\n```go\nfunc (t *Collector) CollectHash(hash *chainhash.Hash) (*BlockData, *wire.MsgBlock, error)\n```\nCollectHash collects chain data at the block with the specified hash.\n\n```go\ntype ReorgData struct {\n\tOldChainHead   chainhash.Hash\n\tOldChainHeight int32\n\tNewChainHead   chainhash.Hash\n\tNewChainHeight int32\n\tWG             *sync.WaitGroup\n}\n```\nReorgData contains the information from a reoranization notification\n\n","path":"github.com/parallelcointeam/exploder/blockdata","name":"blockdata","synopsis":"","isRedistributable":true}
