repo
stringlengths
5
54
path
stringlengths
4
155
func_name
stringlengths
1
118
original_string
stringlengths
52
85.5k
language
stringclasses
1 value
code
stringlengths
52
85.5k
code_tokens
list
docstring
stringlengths
6
2.61k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
85
252
partition
stringclasses
1 value
decred/dcrdata
dcrrates/rateserver/types.go
deleteClient
func (server *RateServer) deleteClient(sid StreamID) { server.clientLock.Lock() defer server.clientLock.Unlock() delete(server.clients, sid) }
go
func (server *RateServer) deleteClient(sid StreamID) { server.clientLock.Lock() defer server.clientLock.Unlock() delete(server.clients, sid) }
[ "func", "(", "server", "*", "RateServer", ")", "deleteClient", "(", "sid", "StreamID", ")", "{", "server", ".", "clientLock", ".", "Lock", "(", ")", "\n", "defer", "server", ".", "clientLock", ".", "Unlock", "(", ")", "\n", "delete", "(", "server", "."...
// deleteClient deletes the client from the map.
[ "deleteClient", "deletes", "the", "client", "from", "the", "map", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/dcrrates/rateserver/types.go#L135-L139
train
decred/dcrdata
dcrrates/rateserver/types.go
NewRateClient
func NewRateClient(stream GRPCStream, exchanges []string) RateClient { return &rateClient{ stream: stream, exchanges: exchanges, } }
go
func NewRateClient(stream GRPCStream, exchanges []string) RateClient { return &rateClient{ stream: stream, exchanges: exchanges, } }
[ "func", "NewRateClient", "(", "stream", "GRPCStream", ",", "exchanges", "[", "]", "string", ")", "RateClient", "{", "return", "&", "rateClient", "{", "stream", ":", "stream", ",", "exchanges", ":", "exchanges", ",", "}", "\n", "}" ]
// NewRateClient is a constructor for rate client. It returns the RateClient // interface rather than rateClient itself.
[ "NewRateClient", "is", "a", "constructor", "for", "rate", "client", ".", "It", "returns", "the", "RateClient", "interface", "rather", "than", "rateClient", "itself", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/dcrrates/rateserver/types.go#L150-L155
train
decred/dcrdata
dcrrates/rateserver/types.go
makeExchangeRateUpdate
func makeExchangeRateUpdate(update *exchanges.ExchangeUpdate) *dcrrates.ExchangeRateUpdate { state := update.State protoUpdate := &dcrrates.ExchangeRateUpdate{ Token: update.Token, Price: state.Price, BaseVolume: state.BaseVolume, Volume: state.Volume, Change: state.Change, Stamp: s...
go
func makeExchangeRateUpdate(update *exchanges.ExchangeUpdate) *dcrrates.ExchangeRateUpdate { state := update.State protoUpdate := &dcrrates.ExchangeRateUpdate{ Token: update.Token, Price: state.Price, BaseVolume: state.BaseVolume, Volume: state.Volume, Change: state.Change, Stamp: s...
[ "func", "makeExchangeRateUpdate", "(", "update", "*", "exchanges", ".", "ExchangeUpdate", ")", "*", "dcrrates", ".", "ExchangeRateUpdate", "{", "state", ":=", "update", ".", "State", "\n", "protoUpdate", ":=", "&", "dcrrates", ".", "ExchangeRateUpdate", "{", "To...
// Translate from the ExchangeBot's type to the gRPC type.
[ "Translate", "from", "the", "ExchangeBot", "s", "type", "to", "the", "gRPC", "type", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/dcrrates/rateserver/types.go#L158-L211
train
decred/dcrdata
dcrrates/rateserver/types.go
SendExchangeUpdate
func (client *rateClient) SendExchangeUpdate(update *dcrrates.ExchangeRateUpdate) (err error) { for i := range client.exchanges { if client.exchanges[i] == update.Token { err = client.stream.Send(update) return } } return }
go
func (client *rateClient) SendExchangeUpdate(update *dcrrates.ExchangeRateUpdate) (err error) { for i := range client.exchanges { if client.exchanges[i] == update.Token { err = client.stream.Send(update) return } } return }
[ "func", "(", "client", "*", "rateClient", ")", "SendExchangeUpdate", "(", "update", "*", "dcrrates", ".", "ExchangeRateUpdate", ")", "(", "err", "error", ")", "{", "for", "i", ":=", "range", "client", ".", "exchanges", "{", "if", "client", ".", "exchanges"...
// SendExchangeUpdate sends the update if the client is subscribed to the exchange.
[ "SendExchangeUpdate", "sends", "the", "update", "if", "the", "client", "is", "subscribed", "to", "the", "exchange", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/dcrrates/rateserver/types.go#L214-L222
train
decred/dcrdata
blockdata/datasaver.go
NewBlockDataToSummaryStdOut
func NewBlockDataToSummaryStdOut(sdiffWinSize int64, m ...*sync.Mutex) *BlockDataToSummaryStdOut { if len(m) > 1 { panic("Too many inputs.") } if len(m) > 0 { return &BlockDataToSummaryStdOut{m[0], sdiffWinSize} } return &BlockDataToSummaryStdOut{sdiffWinSize: sdiffWinSize} }
go
func NewBlockDataToSummaryStdOut(sdiffWinSize int64, m ...*sync.Mutex) *BlockDataToSummaryStdOut { if len(m) > 1 { panic("Too many inputs.") } if len(m) > 0 { return &BlockDataToSummaryStdOut{m[0], sdiffWinSize} } return &BlockDataToSummaryStdOut{sdiffWinSize: sdiffWinSize} }
[ "func", "NewBlockDataToSummaryStdOut", "(", "sdiffWinSize", "int64", ",", "m", "...", "*", "sync", ".", "Mutex", ")", "*", "BlockDataToSummaryStdOut", "{", "if", "len", "(", "m", ")", ">", "1", "{", "panic", "(", "\"", "\"", ")", "\n", "}", "\n", "if",...
// NewBlockDataToSummaryStdOut creates a new BlockDataToSummaryStdOut with // optional existing mutex
[ "NewBlockDataToSummaryStdOut", "creates", "a", "new", "BlockDataToSummaryStdOut", "with", "optional", "existing", "mutex" ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/blockdata/datasaver.go#L77-L85
train
decred/dcrdata
blockdata/datasaver.go
NewBlockDataToJSONFiles
func NewBlockDataToJSONFiles(folder string, fileBase string, m ...*sync.Mutex) *BlockDataToJSONFiles { if len(m) > 1 { panic("Too many inputs.") } var mtx *sync.Mutex if len(m) > 0 { mtx = m[0] } else { mtx = new(sync.Mutex) } return &BlockDataToJSONFiles{ fileSaver: fileSaver{ folder: folder, ...
go
func NewBlockDataToJSONFiles(folder string, fileBase string, m ...*sync.Mutex) *BlockDataToJSONFiles { if len(m) > 1 { panic("Too many inputs.") } var mtx *sync.Mutex if len(m) > 0 { mtx = m[0] } else { mtx = new(sync.Mutex) } return &BlockDataToJSONFiles{ fileSaver: fileSaver{ folder: folder, ...
[ "func", "NewBlockDataToJSONFiles", "(", "folder", "string", ",", "fileBase", "string", ",", "m", "...", "*", "sync", ".", "Mutex", ")", "*", "BlockDataToJSONFiles", "{", "if", "len", "(", "m", ")", ">", "1", "{", "panic", "(", "\"", "\"", ")", "\n", ...
// NewBlockDataToJSONFiles creates a new BlockDataToJSONFiles with optional // existing mutex
[ "NewBlockDataToJSONFiles", "creates", "a", "new", "BlockDataToJSONFiles", "with", "optional", "existing", "mutex" ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/blockdata/datasaver.go#L89-L110
train
decred/dcrdata
blockdata/datasaver.go
Store
func (s *BlockDataToJSONStdOut) Store(data *BlockData, _ *wire.MsgBlock) error { if s.mtx != nil { s.mtx.Lock() defer s.mtx.Unlock() } // Marshall all the block data results in to a single JSON object, indented jsonConcat, err := JSONFormatBlockData(data) if err != nil { return err } // Write JSON to std...
go
func (s *BlockDataToJSONStdOut) Store(data *BlockData, _ *wire.MsgBlock) error { if s.mtx != nil { s.mtx.Lock() defer s.mtx.Unlock() } // Marshall all the block data results in to a single JSON object, indented jsonConcat, err := JSONFormatBlockData(data) if err != nil { return err } // Write JSON to std...
[ "func", "(", "s", "*", "BlockDataToJSONStdOut", ")", "Store", "(", "data", "*", "BlockData", ",", "_", "*", "wire", ".", "MsgBlock", ")", "error", "{", "if", "s", ".", "mtx", "!=", "nil", "{", "s", ".", "mtx", ".", "Lock", "(", ")", "\n", "defer"...
// Store writes BlockData to stdout in JSON format
[ "Store", "writes", "BlockData", "to", "stdout", "in", "JSON", "format" ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/blockdata/datasaver.go#L113-L131
train
decred/dcrdata
blockdata/datasaver.go
Store
func (s *BlockDataToSummaryStdOut) Store(data *BlockData, _ *wire.MsgBlock) error { if s.mtx != nil { s.mtx.Lock() defer s.mtx.Unlock() } fmt.Printf("\nBlock %v:\n", data.Header.Height) fmt.Printf(" Stake difficulty: %9.3f -> %.3f (current -> next block)\n", data.CurrentStakeDiff.CurrentSta...
go
func (s *BlockDataToSummaryStdOut) Store(data *BlockData, _ *wire.MsgBlock) error { if s.mtx != nil { s.mtx.Lock() defer s.mtx.Unlock() } fmt.Printf("\nBlock %v:\n", data.Header.Height) fmt.Printf(" Stake difficulty: %9.3f -> %.3f (current -> next block)\n", data.CurrentStakeDiff.CurrentSta...
[ "func", "(", "s", "*", "BlockDataToSummaryStdOut", ")", "Store", "(", "data", "*", "BlockData", ",", "_", "*", "wire", ".", "MsgBlock", ")", "error", "{", "if", "s", ".", "mtx", "!=", "nil", "{", "s", ".", "mtx", ".", "Lock", "(", ")", "\n", "def...
// Store writes BlockData to stdout as plain text summary
[ "Store", "writes", "BlockData", "to", "stdout", "as", "plain", "text", "summary" ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/blockdata/datasaver.go#L134-L163
train
decred/dcrdata
blockdata/datasaver.go
Store
func (s *BlockDataToJSONFiles) Store(data *BlockData, _ *wire.MsgBlock) error { if s.mtx != nil { s.mtx.Lock() defer s.mtx.Unlock() } // Marshall all the block data results in to a single JSON object, indented jsonConcat, err := JSONFormatBlockData(data) if err != nil { return err } // Write JSON to a fi...
go
func (s *BlockDataToJSONFiles) Store(data *BlockData, _ *wire.MsgBlock) error { if s.mtx != nil { s.mtx.Lock() defer s.mtx.Unlock() } // Marshall all the block data results in to a single JSON object, indented jsonConcat, err := JSONFormatBlockData(data) if err != nil { return err } // Write JSON to a fi...
[ "func", "(", "s", "*", "BlockDataToJSONFiles", ")", "Store", "(", "data", "*", "BlockData", ",", "_", "*", "wire", ".", "MsgBlock", ")", "error", "{", "if", "s", ".", "mtx", "!=", "nil", "{", "s", ".", "mtx", ".", "Lock", "(", ")", "\n", "defer",...
// Store writes BlockData to a file in JSON format // The file name is nameBase+height+".json".
[ "Store", "writes", "BlockData", "to", "a", "file", "in", "JSON", "format", "The", "file", "name", "is", "nameBase", "+", "height", "+", ".", "json", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/blockdata/datasaver.go#L167-L194
train
decred/dcrdata
blockdata/datasaver.go
JSONFormatBlockData
func JSONFormatBlockData(data *BlockData) (*bytes.Buffer, error) { var jsonAll bytes.Buffer jsonAll.WriteString("{\"estimatestakediff\": ") stakeDiffEstJSON, err := json.Marshal(data.EstStakeDiff) if err != nil { return nil, err } jsonAll.Write(stakeDiffEstJSON) //stakeDiffEstJSON, err := json.MarshalIndent(d...
go
func JSONFormatBlockData(data *BlockData) (*bytes.Buffer, error) { var jsonAll bytes.Buffer jsonAll.WriteString("{\"estimatestakediff\": ") stakeDiffEstJSON, err := json.Marshal(data.EstStakeDiff) if err != nil { return nil, err } jsonAll.Write(stakeDiffEstJSON) //stakeDiffEstJSON, err := json.MarshalIndent(d...
[ "func", "JSONFormatBlockData", "(", "data", "*", "BlockData", ")", "(", "*", "bytes", ".", "Buffer", ",", "error", ")", "{", "var", "jsonAll", "bytes", ".", "Buffer", "\n\n", "jsonAll", ".", "WriteString", "(", "\"", "\\\"", "\\\"", "\"", ")", "\n", "s...
// JSONFormatBlockData concatenates block data results into a single JSON // object with primary keys for the result type
[ "JSONFormatBlockData", "concatenates", "block", "data", "results", "into", "a", "single", "JSON", "object", "with", "primary", "keys", "for", "the", "result", "type" ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/blockdata/datasaver.go#L204-L253
train
decred/dcrdata
blockdata/datasaver.go
Store
func (s BlockTrigger) Store(bd *BlockData, _ *wire.MsgBlock) error { s.Saver(bd.Header.Hash, bd.Header.Height) return nil }
go
func (s BlockTrigger) Store(bd *BlockData, _ *wire.MsgBlock) error { s.Saver(bd.Header.Hash, bd.Header.Height) return nil }
[ "func", "(", "s", "BlockTrigger", ")", "Store", "(", "bd", "*", "BlockData", ",", "_", "*", "wire", ".", "MsgBlock", ")", "error", "{", "s", ".", "Saver", "(", "bd", ".", "Header", ".", "Hash", ",", "bd", ".", "Header", ".", "Height", ")", "\n", ...
// Store reduces the block data to the hash and height in builtin types, // and passes the data to the saver.
[ "Store", "reduces", "the", "block", "data", "to", "the", "hash", "and", "height", "in", "builtin", "types", "and", "passes", "the", "data", "to", "the", "saver", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/blockdata/datasaver.go#L263-L266
train
decred/dcrdata
blockdata/blockdata.go
ToStakeInfoExtended
func (b *BlockData) ToStakeInfoExtended() apitypes.StakeInfoExtended { return apitypes.StakeInfoExtended{ Hash: b.Header.Hash, Feeinfo: b.FeeInfo, StakeDiff: b.CurrentStakeDiff.CurrentStakeDifficulty, PriceWindowNum: b.PriceWindowNum, IdxBlockInWindow: b.IdxBlockInWindow, Pool...
go
func (b *BlockData) ToStakeInfoExtended() apitypes.StakeInfoExtended { return apitypes.StakeInfoExtended{ Hash: b.Header.Hash, Feeinfo: b.FeeInfo, StakeDiff: b.CurrentStakeDiff.CurrentStakeDifficulty, PriceWindowNum: b.PriceWindowNum, IdxBlockInWindow: b.IdxBlockInWindow, Pool...
[ "func", "(", "b", "*", "BlockData", ")", "ToStakeInfoExtended", "(", ")", "apitypes", ".", "StakeInfoExtended", "{", "return", "apitypes", ".", "StakeInfoExtended", "{", "Hash", ":", "b", ".", "Header", ".", "Hash", ",", "Feeinfo", ":", "b", ".", "FeeInfo"...
// ToStakeInfoExtended returns an apitypes.StakeInfoExtended object from the // blockdata
[ "ToStakeInfoExtended", "returns", "an", "apitypes", ".", "StakeInfoExtended", "object", "from", "the", "blockdata" ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/blockdata/blockdata.go#L42-L51
train
decred/dcrdata
blockdata/blockdata.go
ToStakeInfoExtendedEstimates
func (b *BlockData) ToStakeInfoExtendedEstimates() apitypes.StakeInfoExtendedEstimates { return apitypes.StakeInfoExtendedEstimates{ Hash: b.Header.Hash, Feeinfo: b.FeeInfo, StakeDiff: apitypes.StakeDiff{ GetStakeDifficultyResult: b.CurrentStakeDiff, Estimates: b.EstStakeDiff, IdxBlock...
go
func (b *BlockData) ToStakeInfoExtendedEstimates() apitypes.StakeInfoExtendedEstimates { return apitypes.StakeInfoExtendedEstimates{ Hash: b.Header.Hash, Feeinfo: b.FeeInfo, StakeDiff: apitypes.StakeDiff{ GetStakeDifficultyResult: b.CurrentStakeDiff, Estimates: b.EstStakeDiff, IdxBlock...
[ "func", "(", "b", "*", "BlockData", ")", "ToStakeInfoExtendedEstimates", "(", ")", "apitypes", ".", "StakeInfoExtendedEstimates", "{", "return", "apitypes", ".", "StakeInfoExtendedEstimates", "{", "Hash", ":", "b", ".", "Header", ".", "Hash", ",", "Feeinfo", ":"...
// ToStakeInfoExtendedEstimates returns an apitypes.StakeInfoExtendedEstimates // object from the blockdata
[ "ToStakeInfoExtendedEstimates", "returns", "an", "apitypes", ".", "StakeInfoExtendedEstimates", "object", "from", "the", "blockdata" ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/blockdata/blockdata.go#L55-L70
train
decred/dcrdata
blockdata/blockdata.go
ToBlockSummary
func (b *BlockData) ToBlockSummary() apitypes.BlockDataBasic { t := dbtypes.NewTimeDefFromUNIX(b.Header.Time) return apitypes.BlockDataBasic{ Height: b.Header.Height, Size: b.Header.Size, Hash: b.Header.Hash, Difficulty: b.Header.Difficulty, StakeDiff: b.Header.SBits, Time: apitypes...
go
func (b *BlockData) ToBlockSummary() apitypes.BlockDataBasic { t := dbtypes.NewTimeDefFromUNIX(b.Header.Time) return apitypes.BlockDataBasic{ Height: b.Header.Height, Size: b.Header.Size, Hash: b.Header.Hash, Difficulty: b.Header.Difficulty, StakeDiff: b.Header.SBits, Time: apitypes...
[ "func", "(", "b", "*", "BlockData", ")", "ToBlockSummary", "(", ")", "apitypes", ".", "BlockDataBasic", "{", "t", ":=", "dbtypes", ".", "NewTimeDefFromUNIX", "(", "b", ".", "Header", ".", "Time", ")", "\n", "return", "apitypes", ".", "BlockDataBasic", "{",...
// ToBlockSummary returns an apitypes.BlockDataBasic object from the blockdata
[ "ToBlockSummary", "returns", "an", "apitypes", ".", "BlockDataBasic", "object", "from", "the", "blockdata" ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/blockdata/blockdata.go#L73-L84
train
decred/dcrdata
blockdata/blockdata.go
ToBlockExplorerSummary
func (b *BlockData) ToBlockExplorerSummary() apitypes.BlockExplorerBasic { extra := b.ExtraInfo t := dbtypes.NewTimeDefFromUNIX(b.Header.Time) return apitypes.BlockExplorerBasic{ Height: b.Header.Height, Size: b.Header.Size, Voters: b.Header.Voters, Revocatio...
go
func (b *BlockData) ToBlockExplorerSummary() apitypes.BlockExplorerBasic { extra := b.ExtraInfo t := dbtypes.NewTimeDefFromUNIX(b.Header.Time) return apitypes.BlockExplorerBasic{ Height: b.Header.Height, Size: b.Header.Size, Voters: b.Header.Voters, Revocatio...
[ "func", "(", "b", "*", "BlockData", ")", "ToBlockExplorerSummary", "(", ")", "apitypes", ".", "BlockExplorerBasic", "{", "extra", ":=", "b", ".", "ExtraInfo", "\n", "t", ":=", "dbtypes", ".", "NewTimeDefFromUNIX", "(", "b", ".", "Header", ".", "Time", ")",...
// ToBlockExplorerSummary returns a BlockExplorerBasic
[ "ToBlockExplorerSummary", "returns", "a", "BlockExplorerBasic" ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/blockdata/blockdata.go#L87-L100
train
decred/dcrdata
blockdata/blockdata.go
NewCollector
func NewCollector(dcrdChainSvr *rpcclient.Client, params *chaincfg.Params, stakeDB *stakedb.StakeDatabase) *Collector { return &Collector{ dcrdChainSvr: dcrdChainSvr, netParams: params, stakeDB: stakeDB, } }
go
func NewCollector(dcrdChainSvr *rpcclient.Client, params *chaincfg.Params, stakeDB *stakedb.StakeDatabase) *Collector { return &Collector{ dcrdChainSvr: dcrdChainSvr, netParams: params, stakeDB: stakeDB, } }
[ "func", "NewCollector", "(", "dcrdChainSvr", "*", "rpcclient", ".", "Client", ",", "params", "*", "chaincfg", ".", "Params", ",", "stakeDB", "*", "stakedb", ".", "StakeDatabase", ")", "*", "Collector", "{", "return", "&", "Collector", "{", "dcrdChainSvr", ":...
// NewCollector creates a new Collector.
[ "NewCollector", "creates", "a", "new", "Collector", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/blockdata/blockdata.go#L111-L118
train
decred/dcrdata
blockdata/blockdata.go
CollectAPITypes
func (t *Collector) CollectAPITypes(hash *chainhash.Hash) (*apitypes.BlockDataBasic, *apitypes.StakeInfoExtended) { blockDataBasic, feeInfoBlock, _, _, _, err := t.CollectBlockInfo(hash) if err != nil { return nil, nil } height := int64(blockDataBasic.Height) winSize := t.netParams.StakeDiffWindowSize stakeIn...
go
func (t *Collector) CollectAPITypes(hash *chainhash.Hash) (*apitypes.BlockDataBasic, *apitypes.StakeInfoExtended) { blockDataBasic, feeInfoBlock, _, _, _, err := t.CollectBlockInfo(hash) if err != nil { return nil, nil } height := int64(blockDataBasic.Height) winSize := t.netParams.StakeDiffWindowSize stakeIn...
[ "func", "(", "t", "*", "Collector", ")", "CollectAPITypes", "(", "hash", "*", "chainhash", ".", "Hash", ")", "(", "*", "apitypes", ".", "BlockDataBasic", ",", "*", "apitypes", ".", "StakeInfoExtended", ")", "{", "blockDataBasic", ",", "feeInfoBlock", ",", ...
// CollectAPITypes uses CollectBlockInfo to collect block data, then organizes // it into the BlockDataBasic and StakeInfoExtended and dcrdataapi types.
[ "CollectAPITypes", "uses", "CollectBlockInfo", "to", "collect", "block", "data", "then", "organizes", "it", "into", "the", "BlockDataBasic", "and", "StakeInfoExtended", "and", "dcrdataapi", "types", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/blockdata/blockdata.go#L122-L141
train
decred/dcrdata
blockdata/blockdata.go
CollectHash
func (t *Collector) CollectHash(hash *chainhash.Hash) (*BlockData, *wire.MsgBlock, error) { // In case of a very fast block, make sure previous call to collect is not // still running, or dcrd may be mad. t.mtx.Lock() defer t.mtx.Unlock() // Time this function defer func(start time.Time) { log.Debugf("Collecto...
go
func (t *Collector) CollectHash(hash *chainhash.Hash) (*BlockData, *wire.MsgBlock, error) { // In case of a very fast block, make sure previous call to collect is not // still running, or dcrd may be mad. t.mtx.Lock() defer t.mtx.Unlock() // Time this function defer func(start time.Time) { log.Debugf("Collecto...
[ "func", "(", "t", "*", "Collector", ")", "CollectHash", "(", "hash", "*", "chainhash", ".", "Hash", ")", "(", "*", "BlockData", ",", "*", "wire", ".", "MsgBlock", ",", "error", ")", "{", "// In case of a very fast block, make sure previous call to collect is not",...
// CollectHash collects chain data at the block with the specified hash.
[ "CollectHash", "collects", "chain", "data", "at", "the", "block", "with", "the", "specified", "hash", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/blockdata/blockdata.go#L225-L277
train
decred/dcrdata
blockdata/blockdata.go
Collect
func (t *Collector) Collect() (*BlockData, *wire.MsgBlock, error) { // In case of a very fast block, make sure previous call to collect is not // still running, or dcrd may be mad. t.mtx.Lock() defer t.mtx.Unlock() // Time this function defer func(start time.Time) { log.Debugf("Collector.Collect() completed in...
go
func (t *Collector) Collect() (*BlockData, *wire.MsgBlock, error) { // In case of a very fast block, make sure previous call to collect is not // still running, or dcrd may be mad. t.mtx.Lock() defer t.mtx.Unlock() // Time this function defer func(start time.Time) { log.Debugf("Collector.Collect() completed in...
[ "func", "(", "t", "*", "Collector", ")", "Collect", "(", ")", "(", "*", "BlockData", ",", "*", "wire", ".", "MsgBlock", ",", "error", ")", "{", "// In case of a very fast block, make sure previous call to collect is not", "// still running, or dcrd may be mad.", "t", ...
// Collect collects chain data at the current best block.
[ "Collect", "collects", "chain", "data", "at", "the", "current", "best", "block", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/blockdata/blockdata.go#L280-L367
train
decred/dcrdata
explorer/websocket.go
NewWebsocketHub
func NewWebsocketHub() *WebsocketHub { return &WebsocketHub{ clients: make(map[*hubSpoke]*clientHubSpoke), Register: make(chan *clientHubSpoke), Unregister: make(chan *hubSpoke), HubRelay: make(chan hubMessage), newTxBuffer: make([]*types.MempoolTx, 0, newTxBufferSize), ...
go
func NewWebsocketHub() *WebsocketHub { return &WebsocketHub{ clients: make(map[*hubSpoke]*clientHubSpoke), Register: make(chan *clientHubSpoke), Unregister: make(chan *hubSpoke), HubRelay: make(chan hubMessage), newTxBuffer: make([]*types.MempoolTx, 0, newTxBufferSize), ...
[ "func", "NewWebsocketHub", "(", ")", "*", "WebsocketHub", "{", "return", "&", "WebsocketHub", "{", "clients", ":", "make", "(", "map", "[", "*", "hubSpoke", "]", "*", "clientHubSpoke", ")", ",", "Register", ":", "make", "(", "chan", "*", "clientHubSpoke", ...
// NewWebsocketHub creates a new WebsocketHub
[ "NewWebsocketHub", "creates", "a", "new", "WebsocketHub" ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/explorer/websocket.go#L90-L102
train
decred/dcrdata
explorer/websocket.go
NumClients
func (wsh *WebsocketHub) NumClients() int { // Swallow any type assertion error since the default int of 0 is OK. n, _ := wsh.numClients.Load().(int) return n }
go
func (wsh *WebsocketHub) NumClients() int { // Swallow any type assertion error since the default int of 0 is OK. n, _ := wsh.numClients.Load().(int) return n }
[ "func", "(", "wsh", "*", "WebsocketHub", ")", "NumClients", "(", ")", "int", "{", "// Swallow any type assertion error since the default int of 0 is OK.", "n", ",", "_", ":=", "wsh", ".", "numClients", ".", "Load", "(", ")", ".", "(", "int", ")", "\n", "return...
// NumClients returns the number of clients connected to the websocket hub.
[ "NumClients", "returns", "the", "number", "of", "clients", "connected", "to", "the", "websocket", "hub", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/explorer/websocket.go#L111-L115
train
decred/dcrdata
explorer/websocket.go
RegisterClient
func (wsh *WebsocketHub) RegisterClient(c *hubSpoke, xcChan exchangeChannel) *client { cl := new(client) wsh.Register <- &clientHubSpoke{cl, c, xcChan} return cl }
go
func (wsh *WebsocketHub) RegisterClient(c *hubSpoke, xcChan exchangeChannel) *client { cl := new(client) wsh.Register <- &clientHubSpoke{cl, c, xcChan} return cl }
[ "func", "(", "wsh", "*", "WebsocketHub", ")", "RegisterClient", "(", "c", "*", "hubSpoke", ",", "xcChan", "exchangeChannel", ")", "*", "client", "{", "cl", ":=", "new", "(", "client", ")", "\n", "wsh", ".", "Register", "<-", "&", "clientHubSpoke", "{", ...
// RegisterClient registers a websocket connection with the hub, and returns a // pointer to the new client data object.
[ "RegisterClient", "registers", "a", "websocket", "connection", "with", "the", "hub", "and", "returns", "a", "pointer", "to", "the", "new", "client", "data", "object", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/explorer/websocket.go#L123-L127
train
decred/dcrdata
explorer/websocket.go
pingClients
func (wsh *WebsocketHub) pingClients() chan<- struct{} { stopPing := make(chan struct{}) go func() { // start the client ping ticker ticker := time.NewTicker(pingInterval) defer ticker.Stop() for { select { case <-ticker.C: wsh.HubRelay <- pstypes.HubMessage{Signal: sigPingAndUserCount} case _,...
go
func (wsh *WebsocketHub) pingClients() chan<- struct{} { stopPing := make(chan struct{}) go func() { // start the client ping ticker ticker := time.NewTicker(pingInterval) defer ticker.Stop() for { select { case <-ticker.C: wsh.HubRelay <- pstypes.HubMessage{Signal: sigPingAndUserCount} case _,...
[ "func", "(", "wsh", "*", "WebsocketHub", ")", "pingClients", "(", ")", "chan", "<-", "struct", "{", "}", "{", "stopPing", ":=", "make", "(", "chan", "struct", "{", "}", ")", "\n\n", "go", "func", "(", ")", "{", "// start the client ping ticker", "ticker"...
// Periodically ping clients over websocket connection. Stop the ping loop by // closing the returned channel.
[ "Periodically", "ping", "clients", "over", "websocket", "connection", ".", "Stop", "the", "ping", "loop", "by", "closing", "the", "returned", "channel", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/explorer/websocket.go#L171-L193
train
decred/dcrdata
explorer/websocket.go
addTxToBuffer
func (wsh *WebsocketHub) addTxToBuffer(tx *types.MempoolTx) bool { wsh.bufferMtx.Lock() defer wsh.bufferMtx.Unlock() wsh.newTxBuffer = append(wsh.newTxBuffer, tx) return len(wsh.newTxBuffer) >= newTxBufferSize }
go
func (wsh *WebsocketHub) addTxToBuffer(tx *types.MempoolTx) bool { wsh.bufferMtx.Lock() defer wsh.bufferMtx.Unlock() wsh.newTxBuffer = append(wsh.newTxBuffer, tx) return len(wsh.newTxBuffer) >= newTxBufferSize }
[ "func", "(", "wsh", "*", "WebsocketHub", ")", "addTxToBuffer", "(", "tx", "*", "types", ".", "MempoolTx", ")", "bool", "{", "wsh", ".", "bufferMtx", ".", "Lock", "(", ")", "\n", "defer", "wsh", ".", "bufferMtx", ".", "Unlock", "(", ")", "\n\n", "wsh"...
// addTxToBuffer adds a tx to the buffer, then returns if the buffer is full
[ "addTxToBuffer", "adds", "a", "tx", "to", "the", "buffer", "then", "returns", "if", "the", "buffer", "is", "full" ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/explorer/websocket.go#L358-L365
train
decred/dcrdata
explorer/websocket.go
periodicBufferSend
func (wsh *WebsocketHub) periodicBufferSend() { ticker := time.NewTicker(bufferTickerInterval * time.Second) for { select { case <-ticker.C: wsh.sendBufferChan <- bufferSend case sig := <-wsh.bufferTickerChan: switch sig { case tickerSigReset: ticker.Stop() ticker = time.NewTicker(bufferTickerI...
go
func (wsh *WebsocketHub) periodicBufferSend() { ticker := time.NewTicker(bufferTickerInterval * time.Second) for { select { case <-ticker.C: wsh.sendBufferChan <- bufferSend case sig := <-wsh.bufferTickerChan: switch sig { case tickerSigReset: ticker.Stop() ticker = time.NewTicker(bufferTickerI...
[ "func", "(", "wsh", "*", "WebsocketHub", ")", "periodicBufferSend", "(", ")", "{", "ticker", ":=", "time", ".", "NewTicker", "(", "bufferTickerInterval", "*", "time", ".", "Second", ")", "\n", "for", "{", "select", "{", "case", "<-", "ticker", ".", "C", ...
// periodicBufferSend initiates a buffer send every bufferTickerInterval seconds
[ "periodicBufferSend", "initiates", "a", "buffer", "send", "every", "bufferTickerInterval", "seconds" ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/explorer/websocket.go#L368-L385
train
decred/dcrdata
blockdata/chainmonitor.go
NewChainMonitor
func NewChainMonitor(ctx context.Context, collector *Collector, savers []BlockDataSaver, reorgSavers []BlockDataSaver, wg *sync.WaitGroup, addrs map[string]txhelpers.TxAction, recvTxBlockChan chan *txhelpers.BlockWatchedTx, reorgChan chan *txhelpers.ReorgData) *chainMonitor { return &chainMonitor{ ctx: ...
go
func NewChainMonitor(ctx context.Context, collector *Collector, savers []BlockDataSaver, reorgSavers []BlockDataSaver, wg *sync.WaitGroup, addrs map[string]txhelpers.TxAction, recvTxBlockChan chan *txhelpers.BlockWatchedTx, reorgChan chan *txhelpers.ReorgData) *chainMonitor { return &chainMonitor{ ctx: ...
[ "func", "NewChainMonitor", "(", "ctx", "context", ".", "Context", ",", "collector", "*", "Collector", ",", "savers", "[", "]", "BlockDataSaver", ",", "reorgSavers", "[", "]", "BlockDataSaver", ",", "wg", "*", "sync", ".", "WaitGroup", ",", "addrs", "map", ...
// NewChainMonitor creates a new chainMonitor.
[ "NewChainMonitor", "creates", "a", "new", "chainMonitor", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/blockdata/chainmonitor.go#L34-L47
train
decred/dcrdata
db/dcrpg/pgblockchain.go
TicketPoolData
func TicketPoolData(interval dbtypes.TimeBasedGrouping, height int64) (timeGraph *dbtypes.PoolTicketsData, priceGraph *dbtypes.PoolTicketsData, donutChart *dbtypes.PoolTicketsData, actualHeight int64, intervalFound, isStale bool) { ticketPoolGraphsCache.RLock() defer ticketPoolGraphsCache.RUnlock() var tFound, pFo...
go
func TicketPoolData(interval dbtypes.TimeBasedGrouping, height int64) (timeGraph *dbtypes.PoolTicketsData, priceGraph *dbtypes.PoolTicketsData, donutChart *dbtypes.PoolTicketsData, actualHeight int64, intervalFound, isStale bool) { ticketPoolGraphsCache.RLock() defer ticketPoolGraphsCache.RUnlock() var tFound, pFo...
[ "func", "TicketPoolData", "(", "interval", "dbtypes", ".", "TimeBasedGrouping", ",", "height", "int64", ")", "(", "timeGraph", "*", "dbtypes", ".", "PoolTicketsData", ",", "priceGraph", "*", "dbtypes", ".", "PoolTicketsData", ",", "donutChart", "*", "dbtypes", "...
// TicketPoolData is a thread-safe way to access the ticketpool graphs data // stored in the cache.
[ "TicketPoolData", "is", "a", "thread", "-", "safe", "way", "to", "access", "the", "ticketpool", "graphs", "data", "stored", "in", "the", "cache", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/pgblockchain.go#L81-L96
train
decred/dcrdata
db/dcrpg/pgblockchain.go
UpdateTicketPoolData
func UpdateTicketPoolData(interval dbtypes.TimeBasedGrouping, timeGraph *dbtypes.PoolTicketsData, priceGraph *dbtypes.PoolTicketsData, donutcharts *dbtypes.PoolTicketsData, height int64) { ticketPoolGraphsCache.Lock() defer ticketPoolGraphsCache.Unlock() ticketPoolGraphsCache.Height[interval] = height ticketPoolG...
go
func UpdateTicketPoolData(interval dbtypes.TimeBasedGrouping, timeGraph *dbtypes.PoolTicketsData, priceGraph *dbtypes.PoolTicketsData, donutcharts *dbtypes.PoolTicketsData, height int64) { ticketPoolGraphsCache.Lock() defer ticketPoolGraphsCache.Unlock() ticketPoolGraphsCache.Height[interval] = height ticketPoolG...
[ "func", "UpdateTicketPoolData", "(", "interval", "dbtypes", ".", "TimeBasedGrouping", ",", "timeGraph", "*", "dbtypes", ".", "PoolTicketsData", ",", "priceGraph", "*", "dbtypes", ".", "PoolTicketsData", ",", "donutcharts", "*", "dbtypes", ".", "PoolTicketsData", ","...
// UpdateTicketPoolData updates the ticket pool cache with the latest data fetched. // This is a thread-safe way to update ticket pool cache data. TryLock helps avoid // stacking calls to update the cache.
[ "UpdateTicketPoolData", "updates", "the", "ticket", "pool", "cache", "with", "the", "latest", "data", "fetched", ".", "This", "is", "a", "thread", "-", "safe", "way", "to", "update", "ticket", "pool", "cache", "data", ".", "TryLock", "helps", "avoid", "stack...
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/pgblockchain.go#L101-L110
train
decred/dcrdata
db/dcrpg/pgblockchain.go
newUtxoStore
func newUtxoStore(prealloc int) utxoStore { return utxoStore{ c: make(map[string]map[uint32]*dbtypes.UTXOData, prealloc), } }
go
func newUtxoStore(prealloc int) utxoStore { return utxoStore{ c: make(map[string]map[uint32]*dbtypes.UTXOData, prealloc), } }
[ "func", "newUtxoStore", "(", "prealloc", "int", ")", "utxoStore", "{", "return", "utxoStore", "{", "c", ":", "make", "(", "map", "[", "string", "]", "map", "[", "uint32", "]", "*", "dbtypes", ".", "UTXOData", ",", "prealloc", ")", ",", "}", "\n", "}"...
// newUtxoStore constructs a new utxoStore.
[ "newUtxoStore", "constructs", "a", "new", "utxoStore", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/pgblockchain.go#L119-L123
train
decred/dcrdata
db/dcrpg/pgblockchain.go
Get
func (u *utxoStore) Get(txHash string, txIndex uint32) (*dbtypes.UTXOData, bool) { u.Lock() defer u.Unlock() utxoData, ok := u.c[txHash][txIndex] if ok { u.c[txHash][txIndex] = nil delete(u.c[txHash], txIndex) if len(u.c[txHash]) == 0 { delete(u.c, txHash) } } return utxoData, ok }
go
func (u *utxoStore) Get(txHash string, txIndex uint32) (*dbtypes.UTXOData, bool) { u.Lock() defer u.Unlock() utxoData, ok := u.c[txHash][txIndex] if ok { u.c[txHash][txIndex] = nil delete(u.c[txHash], txIndex) if len(u.c[txHash]) == 0 { delete(u.c, txHash) } } return utxoData, ok }
[ "func", "(", "u", "*", "utxoStore", ")", "Get", "(", "txHash", "string", ",", "txIndex", "uint32", ")", "(", "*", "dbtypes", ".", "UTXOData", ",", "bool", ")", "{", "u", ".", "Lock", "(", ")", "\n", "defer", "u", ".", "Unlock", "(", ")", "\n", ...
// Get attempts to locate UTXOData for the specified outpoint. If the data is // not in the cache, a nil pointer and false are returned. If the data is // located, the data and true are returned, and the data is evicted from cache.
[ "Get", "attempts", "to", "locate", "UTXOData", "for", "the", "specified", "outpoint", ".", "If", "the", "data", "is", "not", "in", "the", "cache", "a", "nil", "pointer", "and", "false", "are", "returned", ".", "If", "the", "data", "is", "located", "the",...
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/pgblockchain.go#L128-L140
train
decred/dcrdata
db/dcrpg/pgblockchain.go
Set
func (u *utxoStore) Set(txHash string, txIndex uint32, addrs []string, val int64) { u.Lock() defer u.Unlock() u.set(txHash, txIndex, addrs, val) }
go
func (u *utxoStore) Set(txHash string, txIndex uint32, addrs []string, val int64) { u.Lock() defer u.Unlock() u.set(txHash, txIndex, addrs, val) }
[ "func", "(", "u", "*", "utxoStore", ")", "Set", "(", "txHash", "string", ",", "txIndex", "uint32", ",", "addrs", "[", "]", "string", ",", "val", "int64", ")", "{", "u", ".", "Lock", "(", ")", "\n", "defer", "u", ".", "Unlock", "(", ")", "\n", "...
// Set stores the addresses and amount in a UTXOData entry in the cache for the // given outpoint.
[ "Set", "stores", "the", "addresses", "and", "amount", "in", "a", "UTXOData", "entry", "in", "the", "cache", "for", "the", "given", "outpoint", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/pgblockchain.go#L161-L165
train
decred/dcrdata
db/dcrpg/pgblockchain.go
Reinit
func (u *utxoStore) Reinit(utxos []dbtypes.UTXO) { u.Lock() defer u.Unlock() // Pre-allocate the transaction hash map assuming the number of unique // transaction hashes in input is roughly 2/3 of the number of UTXOs. prealloc := 2 * len(utxos) / 3 u.c = make(map[string]map[uint32]*dbtypes.UTXOData, prealloc) fo...
go
func (u *utxoStore) Reinit(utxos []dbtypes.UTXO) { u.Lock() defer u.Unlock() // Pre-allocate the transaction hash map assuming the number of unique // transaction hashes in input is roughly 2/3 of the number of UTXOs. prealloc := 2 * len(utxos) / 3 u.c = make(map[string]map[uint32]*dbtypes.UTXOData, prealloc) fo...
[ "func", "(", "u", "*", "utxoStore", ")", "Reinit", "(", "utxos", "[", "]", "dbtypes", ".", "UTXO", ")", "{", "u", ".", "Lock", "(", ")", "\n", "defer", "u", ".", "Unlock", "(", ")", "\n", "// Pre-allocate the transaction hash map assuming the number of uniqu...
// Reinit re-initializes the utxoStore with the given UTXOs.
[ "Reinit", "re", "-", "initializes", "the", "utxoStore", "with", "the", "given", "UTXOs", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/pgblockchain.go#L168-L178
train
decred/dcrdata
db/dcrpg/pgblockchain.go
Size
func (u *utxoStore) Size() (sz int) { u.Lock() defer u.Unlock() for _, m := range u.c { sz += len(m) } return }
go
func (u *utxoStore) Size() (sz int) { u.Lock() defer u.Unlock() for _, m := range u.c { sz += len(m) } return }
[ "func", "(", "u", "*", "utxoStore", ")", "Size", "(", ")", "(", "sz", "int", ")", "{", "u", ".", "Lock", "(", ")", "\n", "defer", "u", ".", "Unlock", "(", ")", "\n", "for", "_", ",", "m", ":=", "range", "u", ".", "c", "{", "sz", "+=", "le...
// Size returns the size of the utxo cache in number of UTXOs.
[ "Size", "returns", "the", "size", "of", "the", "utxo", "cache", "in", "number", "of", "UTXOs", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/pgblockchain.go#L181-L188
train
decred/dcrdata
db/dcrpg/pgblockchain.go
NewChainDBRPC
func NewChainDBRPC(chaindb *ChainDB, cl *rpcclient.Client) (*ChainDBRPC, error) { return &ChainDBRPC{chaindb, cl}, nil }
go
func NewChainDBRPC(chaindb *ChainDB, cl *rpcclient.Client) (*ChainDBRPC, error) { return &ChainDBRPC{chaindb, cl}, nil }
[ "func", "NewChainDBRPC", "(", "chaindb", "*", "ChainDB", ",", "cl", "*", "rpcclient", ".", "Client", ")", "(", "*", "ChainDBRPC", ",", "error", ")", "{", "return", "&", "ChainDBRPC", "{", "chaindb", ",", "cl", "}", ",", "nil", "\n", "}" ]
// NewChainDBRPC contains ChainDB and RPC client parameters. By default, // duplicate row checks on insertion are enabled. also enables rpc client
[ "NewChainDBRPC", "contains", "ChainDB", "and", "RPC", "client", "parameters", ".", "By", "default", "duplicate", "row", "checks", "on", "insertion", "are", "enabled", ".", "also", "enables", "rpc", "client" ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/pgblockchain.go#L288-L290
train
decred/dcrdata
db/dcrpg/pgblockchain.go
MissingSideChainBlocks
func (pgb *ChainDBRPC) MissingSideChainBlocks() ([]dbtypes.SideChain, int, error) { // First get the side chain tips (head blocks). tips, err := rpcutils.SideChains(pgb.Client) if err != nil { return nil, 0, fmt.Errorf("unable to get chain tips from node: %v", err) } nSideChains := len(tips) // Build a list of...
go
func (pgb *ChainDBRPC) MissingSideChainBlocks() ([]dbtypes.SideChain, int, error) { // First get the side chain tips (head blocks). tips, err := rpcutils.SideChains(pgb.Client) if err != nil { return nil, 0, fmt.Errorf("unable to get chain tips from node: %v", err) } nSideChains := len(tips) // Build a list of...
[ "func", "(", "pgb", "*", "ChainDBRPC", ")", "MissingSideChainBlocks", "(", ")", "(", "[", "]", "dbtypes", ".", "SideChain", ",", "int", ",", "error", ")", "{", "// First get the side chain tips (head blocks).", "tips", ",", "err", ":=", "rpcutils", ".", "SideC...
// MissingSideChainBlocks identifies side chain blocks that are missing from the // DB. Side chains known to dcrd are listed via the getchaintips RPC. Each block // presence in the postgres DB is checked, and any missing block is returned in // a SideChain along with a count of the total number of missing blocks.
[ "MissingSideChainBlocks", "identifies", "side", "chain", "blocks", "that", "are", "missing", "from", "the", "DB", ".", "Side", "chains", "known", "to", "dcrd", "are", "listed", "via", "the", "getchaintips", "RPC", ".", "Each", "block", "presence", "in", "the",...
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/pgblockchain.go#L337-L389
train
decred/dcrdata
db/dcrpg/pgblockchain.go
TxnDbID
func (t *TicketTxnIDGetter) TxnDbID(txid string, expire bool) (uint64, error) { if t == nil { panic("You're using an uninitialized TicketTxnIDGetter") } t.mtx.RLock() dbID, ok := t.idCache[txid] t.mtx.RUnlock() if ok { if expire { t.mtx.Lock() delete(t.idCache, txid) t.mtx.Unlock() } return dbID,...
go
func (t *TicketTxnIDGetter) TxnDbID(txid string, expire bool) (uint64, error) { if t == nil { panic("You're using an uninitialized TicketTxnIDGetter") } t.mtx.RLock() dbID, ok := t.idCache[txid] t.mtx.RUnlock() if ok { if expire { t.mtx.Lock() delete(t.idCache, txid) t.mtx.Unlock() } return dbID,...
[ "func", "(", "t", "*", "TicketTxnIDGetter", ")", "TxnDbID", "(", "txid", "string", ",", "expire", "bool", ")", "(", "uint64", ",", "error", ")", "{", "if", "t", "==", "nil", "{", "panic", "(", "\"", "\"", ")", "\n", "}", "\n", "t", ".", "mtx", ...
// TxnDbID fetches DB row ID for the ticket specified by the input transaction // hash. A cache is checked first. In the event of a cache hit, the DB ID is // returned and deleted from the internal cache. In the event of a cache miss, // the database is queried. If the database query fails, the error is non-nil.
[ "TxnDbID", "fetches", "DB", "row", "ID", "for", "the", "ticket", "specified", "by", "the", "input", "transaction", "hash", ".", "A", "cache", "is", "checked", "first", ".", "In", "the", "event", "of", "a", "cache", "hit", "the", "DB", "ID", "is", "retu...
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/pgblockchain.go#L402-L420
train
decred/dcrdata
db/dcrpg/pgblockchain.go
NewTicketTxnIDGetter
func NewTicketTxnIDGetter(db *sql.DB) *TicketTxnIDGetter { return &TicketTxnIDGetter{ db: db, idCache: make(map[string]uint64), } }
go
func NewTicketTxnIDGetter(db *sql.DB) *TicketTxnIDGetter { return &TicketTxnIDGetter{ db: db, idCache: make(map[string]uint64), } }
[ "func", "NewTicketTxnIDGetter", "(", "db", "*", "sql", ".", "DB", ")", "*", "TicketTxnIDGetter", "{", "return", "&", "TicketTxnIDGetter", "{", "db", ":", "db", ",", "idCache", ":", "make", "(", "map", "[", "string", "]", "uint64", ")", ",", "}", "\n", ...
// NewTicketTxnIDGetter constructs a new TicketTxnIDGetter with an empty cache.
[ "NewTicketTxnIDGetter", "constructs", "a", "new", "TicketTxnIDGetter", "with", "an", "empty", "cache", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/pgblockchain.go#L445-L450
train
decred/dcrdata
db/dcrpg/pgblockchain.go
NewChainDB
func NewChainDB(dbi *DBInfo, params *chaincfg.Params, stakeDB *stakedb.StakeDatabase, devPrefetch, hidePGConfig bool, addrCacheCap int, mp rpcutils.MempoolAddressChecker, parser ProposalsFetcher, bg BlockGetter) (*ChainDB, error) { ctx := context.Background() chainDB, err := NewChainDBWithCancel(ctx, dbi, params, s...
go
func NewChainDB(dbi *DBInfo, params *chaincfg.Params, stakeDB *stakedb.StakeDatabase, devPrefetch, hidePGConfig bool, addrCacheCap int, mp rpcutils.MempoolAddressChecker, parser ProposalsFetcher, bg BlockGetter) (*ChainDB, error) { ctx := context.Background() chainDB, err := NewChainDBWithCancel(ctx, dbi, params, s...
[ "func", "NewChainDB", "(", "dbi", "*", "DBInfo", ",", "params", "*", "chaincfg", ".", "Params", ",", "stakeDB", "*", "stakedb", ".", "StakeDatabase", ",", "devPrefetch", ",", "hidePGConfig", "bool", ",", "addrCacheCap", "int", ",", "mp", "rpcutils", ".", "...
// NewChainDB constructs a ChainDB for the given connection and Decred network // parameters. By default, duplicate row checks on insertion are enabled. See // NewChainDBWithCancel to enable context cancellation of running queries. // proposalsUpdateChan is used to manage politeia update notifications trigger // betwee...
[ "NewChainDB", "constructs", "a", "ChainDB", "for", "the", "given", "connection", "and", "Decred", "network", "parameters", ".", "By", "default", "duplicate", "row", "checks", "on", "insertion", "are", "enabled", ".", "See", "NewChainDBWithCancel", "to", "enable", ...
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/pgblockchain.go#L464-L475
train
decred/dcrdata
db/dcrpg/pgblockchain.go
InitUtxoCache
func (pgb *ChainDB) InitUtxoCache(utxos []dbtypes.UTXO) { pgb.utxoCache.Reinit(utxos) }
go
func (pgb *ChainDB) InitUtxoCache(utxos []dbtypes.UTXO) { pgb.utxoCache.Reinit(utxos) }
[ "func", "(", "pgb", "*", "ChainDB", ")", "InitUtxoCache", "(", "utxos", "[", "]", "dbtypes", ".", "UTXO", ")", "{", "pgb", ".", "utxoCache", ".", "Reinit", "(", "utxos", ")", "\n", "}" ]
// InitUtxoCache resets the UTXO cache with the given slice of UTXO data.
[ "InitUtxoCache", "resets", "the", "UTXO", "cache", "with", "the", "given", "slice", "of", "UTXO", "data", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/pgblockchain.go#L790-L792
train
decred/dcrdata
db/dcrpg/pgblockchain.go
SideChainBlocks
func (pgb *ChainDB) SideChainBlocks() ([]*dbtypes.BlockStatus, error) { ctx, cancel := context.WithTimeout(pgb.ctx, pgb.queryTimeout) defer cancel() scb, err := RetrieveSideChainBlocks(ctx, pgb.db) return scb, pgb.replaceCancelError(err) }
go
func (pgb *ChainDB) SideChainBlocks() ([]*dbtypes.BlockStatus, error) { ctx, cancel := context.WithTimeout(pgb.ctx, pgb.queryTimeout) defer cancel() scb, err := RetrieveSideChainBlocks(ctx, pgb.db) return scb, pgb.replaceCancelError(err) }
[ "func", "(", "pgb", "*", "ChainDB", ")", "SideChainBlocks", "(", ")", "(", "[", "]", "*", "dbtypes", ".", "BlockStatus", ",", "error", ")", "{", "ctx", ",", "cancel", ":=", "context", ".", "WithTimeout", "(", "pgb", ".", "ctx", ",", "pgb", ".", "qu...
// SideChainBlocks retrieves all known side chain blocks.
[ "SideChainBlocks", "retrieves", "all", "known", "side", "chain", "blocks", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/pgblockchain.go#L874-L879
train
decred/dcrdata
db/dcrpg/pgblockchain.go
DisapprovedBlocks
func (pgb *ChainDB) DisapprovedBlocks() ([]*dbtypes.BlockStatus, error) { ctx, cancel := context.WithTimeout(pgb.ctx, pgb.queryTimeout) defer cancel() disb, err := RetrieveDisapprovedBlocks(ctx, pgb.db) return disb, pgb.replaceCancelError(err) }
go
func (pgb *ChainDB) DisapprovedBlocks() ([]*dbtypes.BlockStatus, error) { ctx, cancel := context.WithTimeout(pgb.ctx, pgb.queryTimeout) defer cancel() disb, err := RetrieveDisapprovedBlocks(ctx, pgb.db) return disb, pgb.replaceCancelError(err) }
[ "func", "(", "pgb", "*", "ChainDB", ")", "DisapprovedBlocks", "(", ")", "(", "[", "]", "*", "dbtypes", ".", "BlockStatus", ",", "error", ")", "{", "ctx", ",", "cancel", ":=", "context", ".", "WithTimeout", "(", "pgb", ".", "ctx", ",", "pgb", ".", "...
// DisapprovedBlocks retrieves all blocks disapproved by stakeholder votes.
[ "DisapprovedBlocks", "retrieves", "all", "blocks", "disapproved", "by", "stakeholder", "votes", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/pgblockchain.go#L890-L895
train
decred/dcrdata
db/dcrpg/pgblockchain.go
BlockStatus
func (pgb *ChainDB) BlockStatus(hash string) (dbtypes.BlockStatus, error) { ctx, cancel := context.WithTimeout(pgb.ctx, pgb.queryTimeout) defer cancel() bs, err := RetrieveBlockStatus(ctx, pgb.db, hash) return bs, pgb.replaceCancelError(err) }
go
func (pgb *ChainDB) BlockStatus(hash string) (dbtypes.BlockStatus, error) { ctx, cancel := context.WithTimeout(pgb.ctx, pgb.queryTimeout) defer cancel() bs, err := RetrieveBlockStatus(ctx, pgb.db, hash) return bs, pgb.replaceCancelError(err) }
[ "func", "(", "pgb", "*", "ChainDB", ")", "BlockStatus", "(", "hash", "string", ")", "(", "dbtypes", ".", "BlockStatus", ",", "error", ")", "{", "ctx", ",", "cancel", ":=", "context", ".", "WithTimeout", "(", "pgb", ".", "ctx", ",", "pgb", ".", "query...
// BlockStatus retrieves the block chain status of the specified block.
[ "BlockStatus", "retrieves", "the", "block", "chain", "status", "of", "the", "specified", "block", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/pgblockchain.go#L898-L903
train
decred/dcrdata
db/dcrpg/pgblockchain.go
blockFlags
func (pgb *ChainDB) blockFlags(ctx context.Context, hash string) (bool, bool, error) { iv, im, err := RetrieveBlockFlags(ctx, pgb.db, hash) return iv, im, pgb.replaceCancelError(err) }
go
func (pgb *ChainDB) blockFlags(ctx context.Context, hash string) (bool, bool, error) { iv, im, err := RetrieveBlockFlags(ctx, pgb.db, hash) return iv, im, pgb.replaceCancelError(err) }
[ "func", "(", "pgb", "*", "ChainDB", ")", "blockFlags", "(", "ctx", "context", ".", "Context", ",", "hash", "string", ")", "(", "bool", ",", "bool", ",", "error", ")", "{", "iv", ",", "im", ",", "err", ":=", "RetrieveBlockFlags", "(", "ctx", ",", "p...
// blockFlags retrieves the block's isValid and isMainchain flags.
[ "blockFlags", "retrieves", "the", "block", "s", "isValid", "and", "isMainchain", "flags", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/pgblockchain.go#L906-L909
train
decred/dcrdata
db/dcrpg/pgblockchain.go
BlockFlags
func (pgb *ChainDB) BlockFlags(hash string) (bool, bool, error) { ctx, cancel := context.WithTimeout(pgb.ctx, pgb.queryTimeout) defer cancel() return pgb.blockFlags(ctx, hash) }
go
func (pgb *ChainDB) BlockFlags(hash string) (bool, bool, error) { ctx, cancel := context.WithTimeout(pgb.ctx, pgb.queryTimeout) defer cancel() return pgb.blockFlags(ctx, hash) }
[ "func", "(", "pgb", "*", "ChainDB", ")", "BlockFlags", "(", "hash", "string", ")", "(", "bool", ",", "bool", ",", "error", ")", "{", "ctx", ",", "cancel", ":=", "context", ".", "WithTimeout", "(", "pgb", ".", "ctx", ",", "pgb", ".", "queryTimeout", ...
// BlockFlags retrieves the block's isValid and isMainchain flags.
[ "BlockFlags", "retrieves", "the", "block", "s", "isValid", "and", "isMainchain", "flags", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/pgblockchain.go#L912-L916
train
decred/dcrdata
db/dcrpg/pgblockchain.go
BlockFlagsNoCancel
func (pgb *ChainDB) BlockFlagsNoCancel(hash string) (bool, bool, error) { return pgb.blockFlags(context.Background(), hash) }
go
func (pgb *ChainDB) BlockFlagsNoCancel(hash string) (bool, bool, error) { return pgb.blockFlags(context.Background(), hash) }
[ "func", "(", "pgb", "*", "ChainDB", ")", "BlockFlagsNoCancel", "(", "hash", "string", ")", "(", "bool", ",", "bool", ",", "error", ")", "{", "return", "pgb", ".", "blockFlags", "(", "context", ".", "Background", "(", ")", ",", "hash", ")", "\n", "}" ...
// BlockFlagsNoCancel retrieves the block's isValid and isMainchain flags.
[ "BlockFlagsNoCancel", "retrieves", "the", "block", "s", "isValid", "and", "isMainchain", "flags", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/pgblockchain.go#L919-L921
train
decred/dcrdata
db/dcrpg/pgblockchain.go
blockChainDbID
func (pgb *ChainDB) blockChainDbID(ctx context.Context, hash string) (dbID uint64, err error) { err = pgb.db.QueryRowContext(ctx, internal.SelectBlockChainRowIDByHash, hash).Scan(&dbID) err = pgb.replaceCancelError(err) return }
go
func (pgb *ChainDB) blockChainDbID(ctx context.Context, hash string) (dbID uint64, err error) { err = pgb.db.QueryRowContext(ctx, internal.SelectBlockChainRowIDByHash, hash).Scan(&dbID) err = pgb.replaceCancelError(err) return }
[ "func", "(", "pgb", "*", "ChainDB", ")", "blockChainDbID", "(", "ctx", "context", ".", "Context", ",", "hash", "string", ")", "(", "dbID", "uint64", ",", "err", "error", ")", "{", "err", "=", "pgb", ".", "db", ".", "QueryRowContext", "(", "ctx", ",",...
// blockChainDbID gets the row ID of the given block hash in the block_chain // table. The cancellation context is used without timeout.
[ "blockChainDbID", "gets", "the", "row", "ID", "of", "the", "given", "block", "hash", "in", "the", "block_chain", "table", ".", "The", "cancellation", "context", "is", "used", "without", "timeout", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/pgblockchain.go#L925-L929
train
decred/dcrdata
db/dcrpg/pgblockchain.go
BlockChainDbID
func (pgb *ChainDB) BlockChainDbID(hash string) (dbID uint64, err error) { return pgb.blockChainDbID(pgb.ctx, hash) }
go
func (pgb *ChainDB) BlockChainDbID(hash string) (dbID uint64, err error) { return pgb.blockChainDbID(pgb.ctx, hash) }
[ "func", "(", "pgb", "*", "ChainDB", ")", "BlockChainDbID", "(", "hash", "string", ")", "(", "dbID", "uint64", ",", "err", "error", ")", "{", "return", "pgb", ".", "blockChainDbID", "(", "pgb", ".", "ctx", ",", "hash", ")", "\n", "}" ]
// BlockChainDbID gets the row ID of the given block hash in the block_chain // table. The cancellation context is used without timeout.
[ "BlockChainDbID", "gets", "the", "row", "ID", "of", "the", "given", "block", "hash", "in", "the", "block_chain", "table", ".", "The", "cancellation", "context", "is", "used", "without", "timeout", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/pgblockchain.go#L933-L935
train
decred/dcrdata
db/dcrpg/pgblockchain.go
BlockChainDbIDNoCancel
func (pgb *ChainDB) BlockChainDbIDNoCancel(hash string) (dbID uint64, err error) { return pgb.blockChainDbID(context.Background(), hash) }
go
func (pgb *ChainDB) BlockChainDbIDNoCancel(hash string) (dbID uint64, err error) { return pgb.blockChainDbID(context.Background(), hash) }
[ "func", "(", "pgb", "*", "ChainDB", ")", "BlockChainDbIDNoCancel", "(", "hash", "string", ")", "(", "dbID", "uint64", ",", "err", "error", ")", "{", "return", "pgb", ".", "blockChainDbID", "(", "context", ".", "Background", "(", ")", ",", "hash", ")", ...
// BlockChainDbIDNoCancel gets the row ID of the given block hash in the // block_chain table. The cancellation context is used without timeout.
[ "BlockChainDbIDNoCancel", "gets", "the", "row", "ID", "of", "the", "given", "block", "hash", "in", "the", "block_chain", "table", ".", "The", "cancellation", "context", "is", "used", "without", "timeout", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/pgblockchain.go#L939-L941
train
decred/dcrdata
db/dcrpg/pgblockchain.go
TransactionBlocks
func (pgb *ChainDB) TransactionBlocks(txHash string) ([]*dbtypes.BlockStatus, []uint32, error) { ctx, cancel := context.WithTimeout(pgb.ctx, pgb.queryTimeout) defer cancel() hashes, heights, inds, valids, mainchains, err := RetrieveTxnsBlocks(ctx, pgb.db, txHash) if err != nil { return nil, nil, pgb.replaceCancel...
go
func (pgb *ChainDB) TransactionBlocks(txHash string) ([]*dbtypes.BlockStatus, []uint32, error) { ctx, cancel := context.WithTimeout(pgb.ctx, pgb.queryTimeout) defer cancel() hashes, heights, inds, valids, mainchains, err := RetrieveTxnsBlocks(ctx, pgb.db, txHash) if err != nil { return nil, nil, pgb.replaceCancel...
[ "func", "(", "pgb", "*", "ChainDB", ")", "TransactionBlocks", "(", "txHash", "string", ")", "(", "[", "]", "*", "dbtypes", ".", "BlockStatus", ",", "[", "]", "uint32", ",", "error", ")", "{", "ctx", ",", "cancel", ":=", "context", ".", "WithTimeout", ...
// TransactionBlocks retrieves the blocks in which the specified transaction // appears, along with the index of the transaction in each of the blocks. The // next and previous block hashes are NOT SET in each BlockStatus.
[ "TransactionBlocks", "retrieves", "the", "blocks", "in", "which", "the", "specified", "transaction", "appears", "along", "with", "the", "index", "of", "the", "transaction", "in", "each", "of", "the", "blocks", ".", "The", "next", "and", "previous", "block", "h...
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/pgblockchain.go#L968-L989
train
decred/dcrdata
db/dcrpg/pgblockchain.go
HeightDB
func (pgb *ChainDB) HeightDB() (int64, error) { ctx, cancel := context.WithTimeout(pgb.ctx, pgb.queryTimeout) defer cancel() bestHeight, _, _, err := RetrieveBestBlockHeight(ctx, pgb.db) height := int64(bestHeight) if err == sql.ErrNoRows { height = -1 } // DO NOT change this to return -1 if err == sql.ErrNoRo...
go
func (pgb *ChainDB) HeightDB() (int64, error) { ctx, cancel := context.WithTimeout(pgb.ctx, pgb.queryTimeout) defer cancel() bestHeight, _, _, err := RetrieveBestBlockHeight(ctx, pgb.db) height := int64(bestHeight) if err == sql.ErrNoRows { height = -1 } // DO NOT change this to return -1 if err == sql.ErrNoRo...
[ "func", "(", "pgb", "*", "ChainDB", ")", "HeightDB", "(", ")", "(", "int64", ",", "error", ")", "{", "ctx", ",", "cancel", ":=", "context", ".", "WithTimeout", "(", "pgb", ".", "ctx", ",", "pgb", ".", "queryTimeout", ")", "\n", "defer", "cancel", "...
// HeightDB queries the DB for the best block height. When the tables are empty, // the returned height will be -1.
[ "HeightDB", "queries", "the", "DB", "for", "the", "best", "block", "height", ".", "When", "the", "tables", "are", "empty", "the", "returned", "height", "will", "be", "-", "1", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/pgblockchain.go#L993-L1003
train
decred/dcrdata
db/dcrpg/pgblockchain.go
HashDB
func (pgb *ChainDB) HashDB() (string, error) { ctx, cancel := context.WithTimeout(pgb.ctx, pgb.queryTimeout) defer cancel() _, bestHash, _, err := RetrieveBestBlockHeight(ctx, pgb.db) return bestHash, pgb.replaceCancelError(err) }
go
func (pgb *ChainDB) HashDB() (string, error) { ctx, cancel := context.WithTimeout(pgb.ctx, pgb.queryTimeout) defer cancel() _, bestHash, _, err := RetrieveBestBlockHeight(ctx, pgb.db) return bestHash, pgb.replaceCancelError(err) }
[ "func", "(", "pgb", "*", "ChainDB", ")", "HashDB", "(", ")", "(", "string", ",", "error", ")", "{", "ctx", ",", "cancel", ":=", "context", ".", "WithTimeout", "(", "pgb", ".", "ctx", ",", "pgb", ".", "queryTimeout", ")", "\n", "defer", "cancel", "(...
// HashDB queries the DB for the best block's hash.
[ "HashDB", "queries", "the", "DB", "for", "the", "best", "block", "s", "hash", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/pgblockchain.go#L1006-L1011
train
decred/dcrdata
db/dcrpg/pgblockchain.go
HeightHashDB
func (pgb *ChainDB) HeightHashDB() (uint64, string, error) { ctx, cancel := context.WithTimeout(pgb.ctx, pgb.queryTimeout) defer cancel() height, hash, _, err := RetrieveBestBlockHeight(ctx, pgb.db) return height, hash, pgb.replaceCancelError(err) }
go
func (pgb *ChainDB) HeightHashDB() (uint64, string, error) { ctx, cancel := context.WithTimeout(pgb.ctx, pgb.queryTimeout) defer cancel() height, hash, _, err := RetrieveBestBlockHeight(ctx, pgb.db) return height, hash, pgb.replaceCancelError(err) }
[ "func", "(", "pgb", "*", "ChainDB", ")", "HeightHashDB", "(", ")", "(", "uint64", ",", "string", ",", "error", ")", "{", "ctx", ",", "cancel", ":=", "context", ".", "WithTimeout", "(", "pgb", ".", "ctx", ",", "pgb", ".", "queryTimeout", ")", "\n", ...
// HeightHashDB queries the DB for the best block's height and hash.
[ "HeightHashDB", "queries", "the", "DB", "for", "the", "best", "block", "s", "height", "and", "hash", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/pgblockchain.go#L1014-L1019
train
decred/dcrdata
db/dcrpg/pgblockchain.go
Height
func (block *BestBlock) Height() int64 { block.mtx.RLock() defer block.mtx.RUnlock() return block.height }
go
func (block *BestBlock) Height() int64 { block.mtx.RLock() defer block.mtx.RUnlock() return block.height }
[ "func", "(", "block", "*", "BestBlock", ")", "Height", "(", ")", "int64", "{", "block", ".", "mtx", ".", "RLock", "(", ")", "\n", "defer", "block", ".", "mtx", ".", "RUnlock", "(", ")", "\n", "return", "block", ".", "height", "\n", "}" ]
// Height uses the last stored height.
[ "Height", "uses", "the", "last", "stored", "height", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/pgblockchain.go#L1027-L1031
train
decred/dcrdata
db/dcrpg/pgblockchain.go
HashStr
func (block *BestBlock) HashStr() string { block.mtx.RLock() defer block.mtx.RUnlock() return block.hash }
go
func (block *BestBlock) HashStr() string { block.mtx.RLock() defer block.mtx.RUnlock() return block.hash }
[ "func", "(", "block", "*", "BestBlock", ")", "HashStr", "(", ")", "string", "{", "block", ".", "mtx", ".", "RLock", "(", ")", "\n", "defer", "block", ".", "mtx", ".", "RUnlock", "(", ")", "\n", "return", "block", ".", "hash", "\n", "}" ]
// HashStr uses the last stored block hash.
[ "HashStr", "uses", "the", "last", "stored", "block", "hash", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/pgblockchain.go#L1040-L1044
train
decred/dcrdata
db/dcrpg/pgblockchain.go
Hash
func (block *BestBlock) Hash() *chainhash.Hash { // Caller should check hash instead of error hash, _ := chainhash.NewHashFromStr(block.HashStr()) return hash }
go
func (block *BestBlock) Hash() *chainhash.Hash { // Caller should check hash instead of error hash, _ := chainhash.NewHashFromStr(block.HashStr()) return hash }
[ "func", "(", "block", "*", "BestBlock", ")", "Hash", "(", ")", "*", "chainhash", ".", "Hash", "{", "// Caller should check hash instead of error", "hash", ",", "_", ":=", "chainhash", ".", "NewHashFromStr", "(", "block", ".", "HashStr", "(", ")", ")", "\n", ...
// Hash uses the last stored block hash.
[ "Hash", "uses", "the", "last", "stored", "block", "hash", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/pgblockchain.go#L1047-L1051
train
decred/dcrdata
db/dcrpg/pgblockchain.go
BlockHeight
func (pgb *ChainDB) BlockHeight(hash string) (int64, error) { ctx, cancel := context.WithTimeout(pgb.ctx, pgb.queryTimeout) defer cancel() height, err := RetrieveBlockHeight(ctx, pgb.db, hash) return height, pgb.replaceCancelError(err) }
go
func (pgb *ChainDB) BlockHeight(hash string) (int64, error) { ctx, cancel := context.WithTimeout(pgb.ctx, pgb.queryTimeout) defer cancel() height, err := RetrieveBlockHeight(ctx, pgb.db, hash) return height, pgb.replaceCancelError(err) }
[ "func", "(", "pgb", "*", "ChainDB", ")", "BlockHeight", "(", "hash", "string", ")", "(", "int64", ",", "error", ")", "{", "ctx", ",", "cancel", ":=", "context", ".", "WithTimeout", "(", "pgb", ".", "ctx", ",", "pgb", ".", "queryTimeout", ")", "\n", ...
// BlockHeight queries the DB for the height of the specified hash.
[ "BlockHeight", "queries", "the", "DB", "for", "the", "height", "of", "the", "specified", "hash", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/pgblockchain.go#L1077-L1082
train
decred/dcrdata
db/dcrpg/pgblockchain.go
BlockHash
func (pgb *ChainDB) BlockHash(height int64) (string, error) { ctx, cancel := context.WithTimeout(pgb.ctx, pgb.queryTimeout) defer cancel() hash, err := RetrieveBlockHash(ctx, pgb.db, height) return hash, pgb.replaceCancelError(err) }
go
func (pgb *ChainDB) BlockHash(height int64) (string, error) { ctx, cancel := context.WithTimeout(pgb.ctx, pgb.queryTimeout) defer cancel() hash, err := RetrieveBlockHash(ctx, pgb.db, height) return hash, pgb.replaceCancelError(err) }
[ "func", "(", "pgb", "*", "ChainDB", ")", "BlockHash", "(", "height", "int64", ")", "(", "string", ",", "error", ")", "{", "ctx", ",", "cancel", ":=", "context", ".", "WithTimeout", "(", "pgb", ".", "ctx", ",", "pgb", ".", "queryTimeout", ")", "\n", ...
// BlockHash queries the DB for the hash of the mainchain block at the given // height.
[ "BlockHash", "queries", "the", "DB", "for", "the", "hash", "of", "the", "mainchain", "block", "at", "the", "given", "height", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/pgblockchain.go#L1086-L1091
train
decred/dcrdata
db/dcrpg/pgblockchain.go
BlockTimeByHeight
func (pgb *ChainDB) BlockTimeByHeight(height int64) (int64, error) { ctx, cancel := context.WithTimeout(pgb.ctx, pgb.queryTimeout) defer cancel() time, err := RetrieveBlockTimeByHeight(ctx, pgb.db, height) return time.UNIX(), pgb.replaceCancelError(err) }
go
func (pgb *ChainDB) BlockTimeByHeight(height int64) (int64, error) { ctx, cancel := context.WithTimeout(pgb.ctx, pgb.queryTimeout) defer cancel() time, err := RetrieveBlockTimeByHeight(ctx, pgb.db, height) return time.UNIX(), pgb.replaceCancelError(err) }
[ "func", "(", "pgb", "*", "ChainDB", ")", "BlockTimeByHeight", "(", "height", "int64", ")", "(", "int64", ",", "error", ")", "{", "ctx", ",", "cancel", ":=", "context", ".", "WithTimeout", "(", "pgb", ".", "ctx", ",", "pgb", ".", "queryTimeout", ")", ...
// BlockTimeByHeight queries the DB for the time of the mainchain block at the // given height.
[ "BlockTimeByHeight", "queries", "the", "DB", "for", "the", "time", "of", "the", "mainchain", "block", "at", "the", "given", "height", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/pgblockchain.go#L1095-L1100
train
decred/dcrdata
db/dcrpg/pgblockchain.go
VotesInBlock
func (pgb *ChainDB) VotesInBlock(hash string) (int16, error) { ctx, cancel := context.WithTimeout(pgb.ctx, pgb.queryTimeout) defer cancel() voters, err := RetrieveBlockVoteCount(ctx, pgb.db, hash) if err != nil { err = pgb.replaceCancelError(err) log.Errorf("Unable to get block voter count for hash %s: %v", has...
go
func (pgb *ChainDB) VotesInBlock(hash string) (int16, error) { ctx, cancel := context.WithTimeout(pgb.ctx, pgb.queryTimeout) defer cancel() voters, err := RetrieveBlockVoteCount(ctx, pgb.db, hash) if err != nil { err = pgb.replaceCancelError(err) log.Errorf("Unable to get block voter count for hash %s: %v", has...
[ "func", "(", "pgb", "*", "ChainDB", ")", "VotesInBlock", "(", "hash", "string", ")", "(", "int16", ",", "error", ")", "{", "ctx", ",", "cancel", ":=", "context", ".", "WithTimeout", "(", "pgb", ".", "ctx", ",", "pgb", ".", "queryTimeout", ")", "\n", ...
// VotesInBlock returns the number of votes mined in the block with the // specified hash.
[ "VotesInBlock", "returns", "the", "number", "of", "votes", "mined", "in", "the", "block", "with", "the", "specified", "hash", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/pgblockchain.go#L1104-L1114
train
decred/dcrdata
db/dcrpg/pgblockchain.go
proposalsUpdateHandler
func (pgb *ChainDB) proposalsUpdateHandler() { // Do not initiate the async update if invalid piparser instance was found. if pgb.piparser == nil { log.Debug("invalid piparser instance was found: async update stopped") return } go func() { for range pgb.piparser.UpdateSignal() { count, err := pgb.PiPropos...
go
func (pgb *ChainDB) proposalsUpdateHandler() { // Do not initiate the async update if invalid piparser instance was found. if pgb.piparser == nil { log.Debug("invalid piparser instance was found: async update stopped") return } go func() { for range pgb.piparser.UpdateSignal() { count, err := pgb.PiPropos...
[ "func", "(", "pgb", "*", "ChainDB", ")", "proposalsUpdateHandler", "(", ")", "{", "// Do not initiate the async update if invalid piparser instance was found.", "if", "pgb", ".", "piparser", "==", "nil", "{", "log", ".", "Debug", "(", "\"", "\"", ")", "\n", "retur...
// proposalsUpdateHandler runs in the background asynchronous to retrieve the // politeia proposal updates that the piparser tool signaled.
[ "proposalsUpdateHandler", "runs", "in", "the", "background", "asynchronous", "to", "retrieve", "the", "politeia", "proposal", "updates", "that", "the", "piparser", "tool", "signaled", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/pgblockchain.go#L1118-L1135
train
decred/dcrdata
db/dcrpg/pgblockchain.go
LastPiParserSync
func (pgb *ChainDB) LastPiParserSync() time.Time { pgb.proposalsSync.mtx.RLock() defer pgb.proposalsSync.mtx.RUnlock() return pgb.proposalsSync.syncTime }
go
func (pgb *ChainDB) LastPiParserSync() time.Time { pgb.proposalsSync.mtx.RLock() defer pgb.proposalsSync.mtx.RUnlock() return pgb.proposalsSync.syncTime }
[ "func", "(", "pgb", "*", "ChainDB", ")", "LastPiParserSync", "(", ")", "time", ".", "Time", "{", "pgb", ".", "proposalsSync", ".", "mtx", ".", "RLock", "(", ")", "\n", "defer", "pgb", ".", "proposalsSync", ".", "mtx", ".", "RUnlock", "(", ")", "\n", ...
// LastPiParserSync returns last time value when the piparser run sync on proposals // and proposal_votes table.
[ "LastPiParserSync", "returns", "last", "time", "value", "when", "the", "piparser", "run", "sync", "on", "proposals", "and", "proposal_votes", "table", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/pgblockchain.go#L1139-L1143
train
decred/dcrdata
db/dcrpg/pgblockchain.go
PiProposalsHistory
func (pgb *ChainDB) PiProposalsHistory() (int64, error) { if pgb.piparser == nil { return -1, fmt.Errorf("invalid piparser instance was found") } pgb.proposalsSync.mtx.Lock() // set the sync time pgb.proposalsSync.syncTime = time.Now().UTC() pgb.proposalsSync.mtx.Unlock() var isChecked bool var proposalsD...
go
func (pgb *ChainDB) PiProposalsHistory() (int64, error) { if pgb.piparser == nil { return -1, fmt.Errorf("invalid piparser instance was found") } pgb.proposalsSync.mtx.Lock() // set the sync time pgb.proposalsSync.syncTime = time.Now().UTC() pgb.proposalsSync.mtx.Unlock() var isChecked bool var proposalsD...
[ "func", "(", "pgb", "*", "ChainDB", ")", "PiProposalsHistory", "(", ")", "(", "int64", ",", "error", ")", "{", "if", "pgb", ".", "piparser", "==", "nil", "{", "return", "-", "1", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n\n",...
// PiProposalsHistory queries the politeia's proposal updates via the parser tool // and pushes them to the proposals and proposal_votes tables.
[ "PiProposalsHistory", "queries", "the", "politeia", "s", "proposal", "updates", "via", "the", "parser", "tool", "and", "pushes", "them", "to", "the", "proposals", "and", "proposal_votes", "tables", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/pgblockchain.go#L1147-L1214
train
decred/dcrdata
db/dcrpg/pgblockchain.go
ProposalVotes
func (pgb *ChainDB) ProposalVotes(proposalToken string) (*dbtypes.ProposalChartsData, error) { ctx, cancel := context.WithTimeout(pgb.ctx, pgb.queryTimeout) defer cancel() chartsData, err := retrieveProposalVotesData(ctx, pgb.db, proposalToken) return chartsData, pgb.replaceCancelError(err) }
go
func (pgb *ChainDB) ProposalVotes(proposalToken string) (*dbtypes.ProposalChartsData, error) { ctx, cancel := context.WithTimeout(pgb.ctx, pgb.queryTimeout) defer cancel() chartsData, err := retrieveProposalVotesData(ctx, pgb.db, proposalToken) return chartsData, pgb.replaceCancelError(err) }
[ "func", "(", "pgb", "*", "ChainDB", ")", "ProposalVotes", "(", "proposalToken", "string", ")", "(", "*", "dbtypes", ".", "ProposalChartsData", ",", "error", ")", "{", "ctx", ",", "cancel", ":=", "context", ".", "WithTimeout", "(", "pgb", ".", "ctx", ",",...
// ProposalVotes retrieves all the votes data associated with the provided token.
[ "ProposalVotes", "retrieves", "all", "the", "votes", "data", "associated", "with", "the", "provided", "token", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/pgblockchain.go#L1217-L1222
train
decred/dcrdata
db/dcrpg/pgblockchain.go
SpendingTransactions
func (pgb *ChainDB) SpendingTransactions(fundingTxID string) ([]string, []uint32, []uint32, error) { ctx, cancel := context.WithTimeout(pgb.ctx, pgb.queryTimeout) defer cancel() _, spendingTxns, vinInds, voutInds, err := RetrieveSpendingTxsByFundingTx(ctx, pgb.db, fundingTxID) return spendingTxns, vinInds, voutInds...
go
func (pgb *ChainDB) SpendingTransactions(fundingTxID string) ([]string, []uint32, []uint32, error) { ctx, cancel := context.WithTimeout(pgb.ctx, pgb.queryTimeout) defer cancel() _, spendingTxns, vinInds, voutInds, err := RetrieveSpendingTxsByFundingTx(ctx, pgb.db, fundingTxID) return spendingTxns, vinInds, voutInds...
[ "func", "(", "pgb", "*", "ChainDB", ")", "SpendingTransactions", "(", "fundingTxID", "string", ")", "(", "[", "]", "string", ",", "[", "]", "uint32", ",", "[", "]", "uint32", ",", "error", ")", "{", "ctx", ",", "cancel", ":=", "context", ".", "WithTi...
// SpendingTransactions retrieves all transactions spending outpoints from the // specified funding transaction. The spending transaction hashes, the spending // tx input indexes, and the corresponding funding tx output indexes, and an // error value are returned.
[ "SpendingTransactions", "retrieves", "all", "transactions", "spending", "outpoints", "from", "the", "specified", "funding", "transaction", ".", "The", "spending", "transaction", "hashes", "the", "spending", "tx", "input", "indexes", "and", "the", "corresponding", "fun...
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/pgblockchain.go#L1228-L1233
train
decred/dcrdata
db/dcrpg/pgblockchain.go
SpendingTransaction
func (pgb *ChainDB) SpendingTransaction(fundingTxID string, fundingTxVout uint32) (string, uint32, int8, error) { ctx, cancel := context.WithTimeout(pgb.ctx, pgb.queryTimeout) defer cancel() _, spendingTx, vinInd, tree, err := RetrieveSpendingTxByTxOut(ctx, pgb.db, fundingTxID, fundingTxVout) return spendingTx, vi...
go
func (pgb *ChainDB) SpendingTransaction(fundingTxID string, fundingTxVout uint32) (string, uint32, int8, error) { ctx, cancel := context.WithTimeout(pgb.ctx, pgb.queryTimeout) defer cancel() _, spendingTx, vinInd, tree, err := RetrieveSpendingTxByTxOut(ctx, pgb.db, fundingTxID, fundingTxVout) return spendingTx, vi...
[ "func", "(", "pgb", "*", "ChainDB", ")", "SpendingTransaction", "(", "fundingTxID", "string", ",", "fundingTxVout", "uint32", ")", "(", "string", ",", "uint32", ",", "int8", ",", "error", ")", "{", "ctx", ",", "cancel", ":=", "context", ".", "WithTimeout",...
// SpendingTransaction returns the transaction that spends the specified // transaction outpoint, if it is spent. The spending transaction hash, input // index, tx tree, and an error value are returned.
[ "SpendingTransaction", "returns", "the", "transaction", "that", "spends", "the", "specified", "transaction", "outpoint", "if", "it", "is", "spent", ".", "The", "spending", "transaction", "hash", "input", "index", "tx", "tree", "and", "an", "error", "value", "are...
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/pgblockchain.go#L1238-L1244
train
decred/dcrdata
db/dcrpg/pgblockchain.go
BlockTransactions
func (pgb *ChainDB) BlockTransactions(blockHash string) ([]string, []uint32, []int8, error) { ctx, cancel := context.WithTimeout(pgb.ctx, pgb.queryTimeout) defer cancel() _, blockTransactions, blockInds, trees, _, err := RetrieveTxsByBlockHash(ctx, pgb.db, blockHash) return blockTransactions, blockInds, trees, pgb....
go
func (pgb *ChainDB) BlockTransactions(blockHash string) ([]string, []uint32, []int8, error) { ctx, cancel := context.WithTimeout(pgb.ctx, pgb.queryTimeout) defer cancel() _, blockTransactions, blockInds, trees, _, err := RetrieveTxsByBlockHash(ctx, pgb.db, blockHash) return blockTransactions, blockInds, trees, pgb....
[ "func", "(", "pgb", "*", "ChainDB", ")", "BlockTransactions", "(", "blockHash", "string", ")", "(", "[", "]", "string", ",", "[", "]", "uint32", ",", "[", "]", "int8", ",", "error", ")", "{", "ctx", ",", "cancel", ":=", "context", ".", "WithTimeout",...
// BlockTransactions retrieves all transactions in the specified block, their // indexes in the block, their tree, and an error value.
[ "BlockTransactions", "retrieves", "all", "transactions", "in", "the", "specified", "block", "their", "indexes", "in", "the", "block", "their", "tree", "and", "an", "error", "value", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/pgblockchain.go#L1248-L1253
train
decred/dcrdata
db/dcrpg/pgblockchain.go
Transaction
func (pgb *ChainDB) Transaction(txHash string) ([]*dbtypes.Tx, error) { ctx, cancel := context.WithTimeout(pgb.ctx, pgb.queryTimeout) defer cancel() _, dbTxs, err := RetrieveDbTxsByHash(ctx, pgb.db, txHash) return dbTxs, pgb.replaceCancelError(err) }
go
func (pgb *ChainDB) Transaction(txHash string) ([]*dbtypes.Tx, error) { ctx, cancel := context.WithTimeout(pgb.ctx, pgb.queryTimeout) defer cancel() _, dbTxs, err := RetrieveDbTxsByHash(ctx, pgb.db, txHash) return dbTxs, pgb.replaceCancelError(err) }
[ "func", "(", "pgb", "*", "ChainDB", ")", "Transaction", "(", "txHash", "string", ")", "(", "[", "]", "*", "dbtypes", ".", "Tx", ",", "error", ")", "{", "ctx", ",", "cancel", ":=", "context", ".", "WithTimeout", "(", "pgb", ".", "ctx", ",", "pgb", ...
// Transaction retrieves all rows from the transactions table for the given // transaction hash.
[ "Transaction", "retrieves", "all", "rows", "from", "the", "transactions", "table", "for", "the", "given", "transaction", "hash", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/pgblockchain.go#L1257-L1262
train
decred/dcrdata
db/dcrpg/pgblockchain.go
BlockMissedVotes
func (pgb *ChainDB) BlockMissedVotes(blockHash string) ([]string, error) { ctx, cancel := context.WithTimeout(pgb.ctx, pgb.queryTimeout) defer cancel() mv, err := RetrieveMissedVotesInBlock(ctx, pgb.db, blockHash) return mv, pgb.replaceCancelError(err) }
go
func (pgb *ChainDB) BlockMissedVotes(blockHash string) ([]string, error) { ctx, cancel := context.WithTimeout(pgb.ctx, pgb.queryTimeout) defer cancel() mv, err := RetrieveMissedVotesInBlock(ctx, pgb.db, blockHash) return mv, pgb.replaceCancelError(err) }
[ "func", "(", "pgb", "*", "ChainDB", ")", "BlockMissedVotes", "(", "blockHash", "string", ")", "(", "[", "]", "string", ",", "error", ")", "{", "ctx", ",", "cancel", ":=", "context", ".", "WithTimeout", "(", "pgb", ".", "ctx", ",", "pgb", ".", "queryT...
// BlockMissedVotes retrieves the ticket IDs for all missed votes in the // specified block, and an error value.
[ "BlockMissedVotes", "retrieves", "the", "ticket", "IDs", "for", "all", "missed", "votes", "in", "the", "specified", "block", "and", "an", "error", "value", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/pgblockchain.go#L1266-L1271
train
decred/dcrdata
db/dcrpg/pgblockchain.go
PoolStatusForTicket
func (pgb *ChainDB) PoolStatusForTicket(txid string) (dbtypes.TicketSpendType, dbtypes.TicketPoolStatus, error) { ctx, cancel := context.WithTimeout(pgb.ctx, pgb.queryTimeout) defer cancel() _, spendType, poolStatus, err := RetrieveTicketStatusByHash(ctx, pgb.db, txid) return spendType, poolStatus, pgb.replaceCance...
go
func (pgb *ChainDB) PoolStatusForTicket(txid string) (dbtypes.TicketSpendType, dbtypes.TicketPoolStatus, error) { ctx, cancel := context.WithTimeout(pgb.ctx, pgb.queryTimeout) defer cancel() _, spendType, poolStatus, err := RetrieveTicketStatusByHash(ctx, pgb.db, txid) return spendType, poolStatus, pgb.replaceCance...
[ "func", "(", "pgb", "*", "ChainDB", ")", "PoolStatusForTicket", "(", "txid", "string", ")", "(", "dbtypes", ".", "TicketSpendType", ",", "dbtypes", ".", "TicketPoolStatus", ",", "error", ")", "{", "ctx", ",", "cancel", ":=", "context", ".", "WithTimeout", ...
// PoolStatusForTicket retrieves the specified ticket's spend status and ticket // pool status, and an error value.
[ "PoolStatusForTicket", "retrieves", "the", "specified", "ticket", "s", "spend", "status", "and", "ticket", "pool", "status", "and", "an", "error", "value", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/pgblockchain.go#L1296-L1301
train
decred/dcrdata
db/dcrpg/pgblockchain.go
VoutValue
func (pgb *ChainDB) VoutValue(txID string, vout uint32) (uint64, error) { ctx, cancel := context.WithTimeout(pgb.ctx, pgb.queryTimeout) defer cancel() voutValue, err := RetrieveVoutValue(ctx, pgb.db, txID, vout) if err != nil { return 0, pgb.replaceCancelError(err) } return voutValue, nil }
go
func (pgb *ChainDB) VoutValue(txID string, vout uint32) (uint64, error) { ctx, cancel := context.WithTimeout(pgb.ctx, pgb.queryTimeout) defer cancel() voutValue, err := RetrieveVoutValue(ctx, pgb.db, txID, vout) if err != nil { return 0, pgb.replaceCancelError(err) } return voutValue, nil }
[ "func", "(", "pgb", "*", "ChainDB", ")", "VoutValue", "(", "txID", "string", ",", "vout", "uint32", ")", "(", "uint64", ",", "error", ")", "{", "ctx", ",", "cancel", ":=", "context", ".", "WithTimeout", "(", "pgb", ".", "ctx", ",", "pgb", ".", "que...
// VoutValue retrieves the value of the specified transaction outpoint in atoms.
[ "VoutValue", "retrieves", "the", "value", "of", "the", "specified", "transaction", "outpoint", "in", "atoms", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/pgblockchain.go#L1304-L1312
train
decred/dcrdata
db/dcrpg/pgblockchain.go
VoutValues
func (pgb *ChainDB) VoutValues(txID string) ([]uint64, []uint32, []int8, error) { ctx, cancel := context.WithTimeout(pgb.ctx, pgb.queryTimeout) defer cancel() voutValues, txInds, txTrees, err := RetrieveVoutValues(ctx, pgb.db, txID) if err != nil { return nil, nil, nil, pgb.replaceCancelError(err) } return vout...
go
func (pgb *ChainDB) VoutValues(txID string) ([]uint64, []uint32, []int8, error) { ctx, cancel := context.WithTimeout(pgb.ctx, pgb.queryTimeout) defer cancel() voutValues, txInds, txTrees, err := RetrieveVoutValues(ctx, pgb.db, txID) if err != nil { return nil, nil, nil, pgb.replaceCancelError(err) } return vout...
[ "func", "(", "pgb", "*", "ChainDB", ")", "VoutValues", "(", "txID", "string", ")", "(", "[", "]", "uint64", ",", "[", "]", "uint32", ",", "[", "]", "int8", ",", "error", ")", "{", "ctx", ",", "cancel", ":=", "context", ".", "WithTimeout", "(", "p...
// VoutValues retrieves the values of each outpoint of the specified // transaction. The corresponding indexes in the block and tx trees of the // outpoints, and an error value are also returned.
[ "VoutValues", "retrieves", "the", "values", "of", "each", "outpoint", "of", "the", "specified", "transaction", ".", "The", "corresponding", "indexes", "in", "the", "block", "and", "tx", "trees", "of", "the", "outpoints", "and", "an", "error", "value", "are", ...
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/pgblockchain.go#L1317-L1325
train
decred/dcrdata
db/dcrpg/pgblockchain.go
TransactionBlock
func (pgb *ChainDB) TransactionBlock(txID string) (string, uint32, int8, error) { ctx, cancel := context.WithTimeout(pgb.ctx, pgb.queryTimeout) defer cancel() _, blockHash, blockInd, tree, err := RetrieveTxByHash(ctx, pgb.db, txID) return blockHash, blockInd, tree, pgb.replaceCancelError(err) }
go
func (pgb *ChainDB) TransactionBlock(txID string) (string, uint32, int8, error) { ctx, cancel := context.WithTimeout(pgb.ctx, pgb.queryTimeout) defer cancel() _, blockHash, blockInd, tree, err := RetrieveTxByHash(ctx, pgb.db, txID) return blockHash, blockInd, tree, pgb.replaceCancelError(err) }
[ "func", "(", "pgb", "*", "ChainDB", ")", "TransactionBlock", "(", "txID", "string", ")", "(", "string", ",", "uint32", ",", "int8", ",", "error", ")", "{", "ctx", ",", "cancel", ":=", "context", ".", "WithTimeout", "(", "pgb", ".", "ctx", ",", "pgb",...
// TransactionBlock retrieves the hash of the block containing the specified // transaction. The index of the transaction within the block, the transaction // index, and an error value are also returned.
[ "TransactionBlock", "retrieves", "the", "hash", "of", "the", "block", "containing", "the", "specified", "transaction", ".", "The", "index", "of", "the", "transaction", "within", "the", "block", "the", "transaction", "index", "and", "an", "error", "value", "are",...
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/pgblockchain.go#L1330-L1335
train
decred/dcrdata
db/dcrpg/pgblockchain.go
AgendaVotes
func (pgb *ChainDB) AgendaVotes(agendaID string, chartType int) (*dbtypes.AgendaVoteChoices, error) { ctx, cancel := context.WithTimeout(pgb.ctx, pgb.queryTimeout) defer cancel() chainInfo := pgb.ChainInfo() agendaInfo := chainInfo.AgendaMileStones[agendaID] // check if starttime is in the future exit. if time....
go
func (pgb *ChainDB) AgendaVotes(agendaID string, chartType int) (*dbtypes.AgendaVoteChoices, error) { ctx, cancel := context.WithTimeout(pgb.ctx, pgb.queryTimeout) defer cancel() chainInfo := pgb.ChainInfo() agendaInfo := chainInfo.AgendaMileStones[agendaID] // check if starttime is in the future exit. if time....
[ "func", "(", "pgb", "*", "ChainDB", ")", "AgendaVotes", "(", "agendaID", "string", ",", "chartType", "int", ")", "(", "*", "dbtypes", ".", "AgendaVoteChoices", ",", "error", ")", "{", "ctx", ",", "cancel", ":=", "context", ".", "WithTimeout", "(", "pgb",...
// AgendaVotes fetches the data used to plot a graph of votes cast per day per // choice for the provided agenda.
[ "AgendaVotes", "fetches", "the", "data", "used", "to", "plot", "a", "graph", "of", "votes", "cast", "per", "day", "per", "choice", "for", "the", "provided", "agenda", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/pgblockchain.go#L1339-L1354
train
decred/dcrdata
db/dcrpg/pgblockchain.go
AgendasVotesSummary
func (pgb *ChainDB) AgendasVotesSummary(agendaID string) (summary *dbtypes.AgendaSummary, err error) { ctx, cancel := context.WithTimeout(pgb.ctx, pgb.queryTimeout) defer cancel() chainInfo := pgb.ChainInfo() agendaInfo := chainInfo.AgendaMileStones[agendaID] // Check if starttime is in the future and exit if tr...
go
func (pgb *ChainDB) AgendasVotesSummary(agendaID string) (summary *dbtypes.AgendaSummary, err error) { ctx, cancel := context.WithTimeout(pgb.ctx, pgb.queryTimeout) defer cancel() chainInfo := pgb.ChainInfo() agendaInfo := chainInfo.AgendaMileStones[agendaID] // Check if starttime is in the future and exit if tr...
[ "func", "(", "pgb", "*", "ChainDB", ")", "AgendasVotesSummary", "(", "agendaID", "string", ")", "(", "summary", "*", "dbtypes", ".", "AgendaSummary", ",", "err", "error", ")", "{", "ctx", ",", "cancel", ":=", "context", ".", "WithTimeout", "(", "pgb", "....
// AgendasVotesSummary fetches the total vote choices count for the provided agenda.
[ "AgendasVotesSummary", "fetches", "the", "total", "vote", "choices", "count", "for", "the", "provided", "agenda", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/pgblockchain.go#L1357-L1377
train
decred/dcrdata
db/dcrpg/pgblockchain.go
AgendaVoteCounts
func (pgb *ChainDB) AgendaVoteCounts(agendaID string) (yes, abstain, no uint32, err error) { ctx, cancel := context.WithTimeout(pgb.ctx, pgb.queryTimeout) defer cancel() chainInfo := pgb.ChainInfo() agendaInfo := chainInfo.AgendaMileStones[agendaID] // Check if starttime is in the future and exit if true. if ti...
go
func (pgb *ChainDB) AgendaVoteCounts(agendaID string) (yes, abstain, no uint32, err error) { ctx, cancel := context.WithTimeout(pgb.ctx, pgb.queryTimeout) defer cancel() chainInfo := pgb.ChainInfo() agendaInfo := chainInfo.AgendaMileStones[agendaID] // Check if starttime is in the future and exit if true. if ti...
[ "func", "(", "pgb", "*", "ChainDB", ")", "AgendaVoteCounts", "(", "agendaID", "string", ")", "(", "yes", ",", "abstain", ",", "no", "uint32", ",", "err", "error", ")", "{", "ctx", ",", "cancel", ":=", "context", ".", "WithTimeout", "(", "pgb", ".", "...
// AgendaVoteCounts returns the vote counts for the agenda as builtin types.
[ "AgendaVoteCounts", "returns", "the", "vote", "counts", "for", "the", "agenda", "as", "builtin", "types", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/pgblockchain.go#L1380-L1394
train
decred/dcrdata
db/dcrpg/pgblockchain.go
AllAgendas
func (pgb *ChainDB) AllAgendas() (map[string]dbtypes.MileStone, error) { return retrieveAllAgendas(pgb.db) }
go
func (pgb *ChainDB) AllAgendas() (map[string]dbtypes.MileStone, error) { return retrieveAllAgendas(pgb.db) }
[ "func", "(", "pgb", "*", "ChainDB", ")", "AllAgendas", "(", ")", "(", "map", "[", "string", "]", "dbtypes", ".", "MileStone", ",", "error", ")", "{", "return", "retrieveAllAgendas", "(", "pgb", ".", "db", ")", "\n", "}" ]
// AllAgendas returns all the agendas stored currently.
[ "AllAgendas", "returns", "all", "the", "agendas", "stored", "currently", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/pgblockchain.go#L1397-L1399
train
decred/dcrdata
db/dcrpg/pgblockchain.go
NumAddressIntervals
func (pgb *ChainDB) NumAddressIntervals(addr string, grouping dbtypes.TimeBasedGrouping) (int64, error) { ctx, cancel := context.WithTimeout(pgb.ctx, pgb.queryTimeout) defer cancel() return retrieveAddressTxsCount(ctx, pgb.db, addr, grouping.String()) }
go
func (pgb *ChainDB) NumAddressIntervals(addr string, grouping dbtypes.TimeBasedGrouping) (int64, error) { ctx, cancel := context.WithTimeout(pgb.ctx, pgb.queryTimeout) defer cancel() return retrieveAddressTxsCount(ctx, pgb.db, addr, grouping.String()) }
[ "func", "(", "pgb", "*", "ChainDB", ")", "NumAddressIntervals", "(", "addr", "string", ",", "grouping", "dbtypes", ".", "TimeBasedGrouping", ")", "(", "int64", ",", "error", ")", "{", "ctx", ",", "cancel", ":=", "context", ".", "WithTimeout", "(", "pgb", ...
// NumAddressIntervals gets the number of unique time intervals for the // specified grouping where there are entries in the addresses table for the // given address.
[ "NumAddressIntervals", "gets", "the", "number", "of", "unique", "time", "intervals", "for", "the", "specified", "grouping", "where", "there", "are", "entries", "in", "the", "addresses", "table", "for", "the", "given", "address", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/pgblockchain.go#L1404-L1408
train
decred/dcrdata
db/dcrpg/pgblockchain.go
AddressMetrics
func (pgb *ChainDB) AddressMetrics(addr string) (*dbtypes.AddressMetrics, error) { // For each time grouping/interval size, get the number if intervals with // data for the address. var metrics dbtypes.AddressMetrics for _, s := range dbtypes.TimeIntervals { numIntervals, err := pgb.NumAddressIntervals(addr, s) ...
go
func (pgb *ChainDB) AddressMetrics(addr string) (*dbtypes.AddressMetrics, error) { // For each time grouping/interval size, get the number if intervals with // data for the address. var metrics dbtypes.AddressMetrics for _, s := range dbtypes.TimeIntervals { numIntervals, err := pgb.NumAddressIntervals(addr, s) ...
[ "func", "(", "pgb", "*", "ChainDB", ")", "AddressMetrics", "(", "addr", "string", ")", "(", "*", "dbtypes", ".", "AddressMetrics", ",", "error", ")", "{", "// For each time grouping/interval size, get the number if intervals with", "// data for the address.", "var", "me...
// AddressMetrics returns the block time of the oldest transaction and the // total count for all the transactions linked to the provided address grouped // by years, months, weeks and days time grouping in seconds. // This helps plot more meaningful address history graphs to the user.
[ "AddressMetrics", "returns", "the", "block", "time", "of", "the", "oldest", "transaction", "and", "the", "total", "count", "for", "all", "the", "transactions", "linked", "to", "the", "provided", "address", "grouped", "by", "years", "months", "weeks", "and", "d...
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/pgblockchain.go#L1414-L1447
train
decred/dcrdata
db/dcrpg/pgblockchain.go
AddressTransactionsAll
func (pgb *ChainDB) AddressTransactionsAll(address string) (addressRows []*dbtypes.AddressRow, err error) { ctx, cancel := context.WithTimeout(pgb.ctx, pgb.queryTimeout) defer cancel() addressRows, err = RetrieveAllMainchainAddressTxns(ctx, pgb.db, address) err = pgb.replaceCancelError(err) return }
go
func (pgb *ChainDB) AddressTransactionsAll(address string) (addressRows []*dbtypes.AddressRow, err error) { ctx, cancel := context.WithTimeout(pgb.ctx, pgb.queryTimeout) defer cancel() addressRows, err = RetrieveAllMainchainAddressTxns(ctx, pgb.db, address) err = pgb.replaceCancelError(err) return }
[ "func", "(", "pgb", "*", "ChainDB", ")", "AddressTransactionsAll", "(", "address", "string", ")", "(", "addressRows", "[", "]", "*", "dbtypes", ".", "AddressRow", ",", "err", "error", ")", "{", "ctx", ",", "cancel", ":=", "context", ".", "WithTimeout", "...
// AddressTransactionsAll retrieves all non-merged main chain addresses table // rows for the given address.
[ "AddressTransactionsAll", "retrieves", "all", "non", "-", "merged", "main", "chain", "addresses", "table", "rows", "for", "the", "given", "address", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/pgblockchain.go#L1483-L1490
train
decred/dcrdata
db/dcrpg/pgblockchain.go
AddressHistoryAll
func (pgb *ChainDB) AddressHistoryAll(address string, N, offset int64) ([]*dbtypes.AddressRow, *dbtypes.AddressBalance, error) { return pgb.AddressHistory(address, N, offset, dbtypes.AddrTxnAll) }
go
func (pgb *ChainDB) AddressHistoryAll(address string, N, offset int64) ([]*dbtypes.AddressRow, *dbtypes.AddressBalance, error) { return pgb.AddressHistory(address, N, offset, dbtypes.AddrTxnAll) }
[ "func", "(", "pgb", "*", "ChainDB", ")", "AddressHistoryAll", "(", "address", "string", ",", "N", ",", "offset", "int64", ")", "(", "[", "]", "*", "dbtypes", ".", "AddressRow", ",", "*", "dbtypes", ".", "AddressBalance", ",", "error", ")", "{", "return...
// AddressHistoryAll retrieves N address rows of type AddrTxnAll, skipping over // offset rows first, in order of block time.
[ "AddressHistoryAll", "retrieves", "N", "address", "rows", "of", "type", "AddrTxnAll", "skipping", "over", "offset", "rows", "first", "in", "order", "of", "block", "time", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/pgblockchain.go#L1507-L1509
train
decred/dcrdata
db/dcrpg/pgblockchain.go
TicketPoolBlockMaturity
func (pgb *ChainDB) TicketPoolBlockMaturity() int64 { bestBlock := int64(pgb.stakeDB.Height()) return bestBlock - int64(pgb.chainParams.TicketMaturity) }
go
func (pgb *ChainDB) TicketPoolBlockMaturity() int64 { bestBlock := int64(pgb.stakeDB.Height()) return bestBlock - int64(pgb.chainParams.TicketMaturity) }
[ "func", "(", "pgb", "*", "ChainDB", ")", "TicketPoolBlockMaturity", "(", ")", "int64", "{", "bestBlock", ":=", "int64", "(", "pgb", ".", "stakeDB", ".", "Height", "(", ")", ")", "\n", "return", "bestBlock", "-", "int64", "(", "pgb", ".", "chainParams", ...
// TicketPoolBlockMaturity returns the block at which all tickets with height // greater than it are immature.
[ "TicketPoolBlockMaturity", "returns", "the", "block", "at", "which", "all", "tickets", "with", "height", "greater", "than", "it", "are", "immature", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/pgblockchain.go#L1513-L1516
train
decred/dcrdata
db/dcrpg/pgblockchain.go
TicketPoolByDateAndInterval
func (pgb *ChainDB) TicketPoolByDateAndInterval(maturityBlock int64, interval dbtypes.TimeBasedGrouping) (*dbtypes.PoolTicketsData, error) { ctx, cancel := context.WithTimeout(pgb.ctx, pgb.queryTimeout) defer cancel() tpd, err := retrieveTicketsByDate(ctx, pgb.db, maturityBlock, interval.String()) return tpd, pgb....
go
func (pgb *ChainDB) TicketPoolByDateAndInterval(maturityBlock int64, interval dbtypes.TimeBasedGrouping) (*dbtypes.PoolTicketsData, error) { ctx, cancel := context.WithTimeout(pgb.ctx, pgb.queryTimeout) defer cancel() tpd, err := retrieveTicketsByDate(ctx, pgb.db, maturityBlock, interval.String()) return tpd, pgb....
[ "func", "(", "pgb", "*", "ChainDB", ")", "TicketPoolByDateAndInterval", "(", "maturityBlock", "int64", ",", "interval", "dbtypes", ".", "TimeBasedGrouping", ")", "(", "*", "dbtypes", ".", "PoolTicketsData", ",", "error", ")", "{", "ctx", ",", "cancel", ":=", ...
// TicketPoolByDateAndInterval fetches the tickets ordered by the purchase date // interval provided and an error value.
[ "TicketPoolByDateAndInterval", "fetches", "the", "tickets", "ordered", "by", "the", "purchase", "date", "interval", "provided", "and", "an", "error", "value", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/pgblockchain.go#L1520-L1526
train
decred/dcrdata
db/dcrpg/pgblockchain.go
PosIntervals
func (pgb *ChainDB) PosIntervals(limit, offset uint64) ([]*dbtypes.BlocksGroupedInfo, error) { ctx, cancel := context.WithTimeout(pgb.ctx, pgb.queryTimeout) defer cancel() bgi, err := retrieveWindowBlocks(ctx, pgb.db, pgb.chainParams.StakeDiffWindowSize, limit, offset) return bgi, pgb.replaceCancelError(err) }
go
func (pgb *ChainDB) PosIntervals(limit, offset uint64) ([]*dbtypes.BlocksGroupedInfo, error) { ctx, cancel := context.WithTimeout(pgb.ctx, pgb.queryTimeout) defer cancel() bgi, err := retrieveWindowBlocks(ctx, pgb.db, pgb.chainParams.StakeDiffWindowSize, limit, offset) return bgi, pgb.replaceCancelError(err) }
[ "func", "(", "pgb", "*", "ChainDB", ")", "PosIntervals", "(", "limit", ",", "offset", "uint64", ")", "(", "[", "]", "*", "dbtypes", ".", "BlocksGroupedInfo", ",", "error", ")", "{", "ctx", ",", "cancel", ":=", "context", ".", "WithTimeout", "(", "pgb",...
// PosIntervals retrieves the blocks at the respective stakebase windows // interval. The term "window" is used here to describe the group of blocks // whose count is defined by chainParams.StakeDiffWindowSize. During this // chainParams.StakeDiffWindowSize block interval the ticket price and the // difficulty value is...
[ "PosIntervals", "retrieves", "the", "blocks", "at", "the", "respective", "stakebase", "windows", "interval", ".", "The", "term", "window", "is", "used", "here", "to", "describe", "the", "group", "of", "blocks", "whose", "count", "is", "defined", "by", "chainPa...
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/pgblockchain.go#L1533-L1538
train
decred/dcrdata
db/dcrpg/pgblockchain.go
TimeBasedIntervals
func (pgb *ChainDB) TimeBasedIntervals(timeGrouping dbtypes.TimeBasedGrouping, limit, offset uint64) ([]*dbtypes.BlocksGroupedInfo, error) { ctx, cancel := context.WithTimeout(pgb.ctx, pgb.queryTimeout) defer cancel() bgi, err := retrieveTimeBasedBlockListing(ctx, pgb.db, timeGrouping.String(), limit, offset) re...
go
func (pgb *ChainDB) TimeBasedIntervals(timeGrouping dbtypes.TimeBasedGrouping, limit, offset uint64) ([]*dbtypes.BlocksGroupedInfo, error) { ctx, cancel := context.WithTimeout(pgb.ctx, pgb.queryTimeout) defer cancel() bgi, err := retrieveTimeBasedBlockListing(ctx, pgb.db, timeGrouping.String(), limit, offset) re...
[ "func", "(", "pgb", "*", "ChainDB", ")", "TimeBasedIntervals", "(", "timeGrouping", "dbtypes", ".", "TimeBasedGrouping", ",", "limit", ",", "offset", "uint64", ")", "(", "[", "]", "*", "dbtypes", ".", "BlocksGroupedInfo", ",", "error", ")", "{", "ctx", ","...
// TimeBasedIntervals retrieves blocks groups by the selected time-based // interval. For the consecutive groups the number of blocks grouped together is // not uniform.
[ "TimeBasedIntervals", "retrieves", "blocks", "groups", "by", "the", "selected", "time", "-", "based", "interval", ".", "For", "the", "consecutive", "groups", "the", "number", "of", "blocks", "grouped", "together", "is", "not", "uniform", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/pgblockchain.go#L1543-L1550
train
decred/dcrdata
db/dcrpg/pgblockchain.go
TicketPoolVisualization
func (pgb *ChainDB) TicketPoolVisualization(interval dbtypes.TimeBasedGrouping) (*dbtypes.PoolTicketsData, *dbtypes.PoolTicketsData, *dbtypes.PoolTicketsData, int64, error) { // Attempt to retrieve data for the current block from cache. heightSeen := pgb.Height() // current block seen *by the ChainDB* if heightSeen...
go
func (pgb *ChainDB) TicketPoolVisualization(interval dbtypes.TimeBasedGrouping) (*dbtypes.PoolTicketsData, *dbtypes.PoolTicketsData, *dbtypes.PoolTicketsData, int64, error) { // Attempt to retrieve data for the current block from cache. heightSeen := pgb.Height() // current block seen *by the ChainDB* if heightSeen...
[ "func", "(", "pgb", "*", "ChainDB", ")", "TicketPoolVisualization", "(", "interval", "dbtypes", ".", "TimeBasedGrouping", ")", "(", "*", "dbtypes", ".", "PoolTicketsData", ",", "*", "dbtypes", ".", "PoolTicketsData", ",", "*", "dbtypes", ".", "PoolTicketsData", ...
// TicketPoolVisualization helps block consecutive and duplicate DB queries for // the requested ticket pool chart data. If the data for the given interval is // cached and fresh, it is returned. If the cached data is stale and there are // no queries running to update the cache for the given interval, this launches //...
[ "TicketPoolVisualization", "helps", "block", "consecutive", "and", "duplicate", "DB", "queries", "for", "the", "requested", "ticket", "pool", "chart", "data", ".", "If", "the", "data", "for", "the", "given", "interval", "is", "cached", "and", "fresh", "it", "i...
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/pgblockchain.go#L1559-L1616
train
decred/dcrdata
db/dcrpg/pgblockchain.go
GetTicketInfo
func (pgb *ChainDB) GetTicketInfo(txid string) (*apitypes.TicketInfo, error) { ctx, cancel := context.WithTimeout(pgb.ctx, pgb.queryTimeout) defer cancel() spendStatus, poolStatus, purchaseBlock, lotteryBlock, spendTxid, err := RetrieveTicketInfoByHash(ctx, pgb.db, txid) if err != nil { return nil, pgb.replaceCa...
go
func (pgb *ChainDB) GetTicketInfo(txid string) (*apitypes.TicketInfo, error) { ctx, cancel := context.WithTimeout(pgb.ctx, pgb.queryTimeout) defer cancel() spendStatus, poolStatus, purchaseBlock, lotteryBlock, spendTxid, err := RetrieveTicketInfoByHash(ctx, pgb.db, txid) if err != nil { return nil, pgb.replaceCa...
[ "func", "(", "pgb", "*", "ChainDB", ")", "GetTicketInfo", "(", "txid", "string", ")", "(", "*", "apitypes", ".", "TicketInfo", ",", "error", ")", "{", "ctx", ",", "cancel", ":=", "context", ".", "WithTimeout", "(", "pgb", ".", "ctx", ",", "pgb", ".",...
// GetTicketInfo retrieves information about the pool and spend statuses, the // purchase block, the lottery block, and the spending transaction.
[ "GetTicketInfo", "retrieves", "information", "about", "the", "pool", "and", "spend", "statuses", "the", "purchase", "block", "the", "lottery", "block", "and", "the", "spending", "transaction", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/pgblockchain.go#L1663-L1706
train
decred/dcrdata
db/dcrpg/pgblockchain.go
FreshenAddressCaches
func (pgb *ChainDB) FreshenAddressCaches(lazyProjectFund bool, expireAddresses []string) error { // Clear existing cache entries. //numCleared := pgb.AddressCache.ClearAll() numCleared := pgb.AddressCache.Clear(expireAddresses) log.Debugf("Cleared cache for %d addresses.", numCleared) // Do not initiate project f...
go
func (pgb *ChainDB) FreshenAddressCaches(lazyProjectFund bool, expireAddresses []string) error { // Clear existing cache entries. //numCleared := pgb.AddressCache.ClearAll() numCleared := pgb.AddressCache.Clear(expireAddresses) log.Debugf("Cleared cache for %d addresses.", numCleared) // Do not initiate project f...
[ "func", "(", "pgb", "*", "ChainDB", ")", "FreshenAddressCaches", "(", "lazyProjectFund", "bool", ",", "expireAddresses", "[", "]", "string", ")", "error", "{", "// Clear existing cache entries.", "//numCleared := pgb.AddressCache.ClearAll()", "numCleared", ":=", "pgb", ...
// FreshenAddressCaches resets the address balance cache by purging data for the // addresses listed in expireAddresses, and prefetches the project fund balance // if devPrefetch is enabled and not mid-reorg. The project fund update is run // asynchronously if lazyProjectFund is true.
[ "FreshenAddressCaches", "resets", "the", "address", "balance", "cache", "by", "purging", "data", "for", "the", "addresses", "listed", "in", "expireAddresses", "and", "prefetches", "the", "project", "fund", "balance", "if", "devPrefetch", "is", "enabled", "and", "n...
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/pgblockchain.go#L1725-L1757
train
decred/dcrdata
db/dcrpg/pgblockchain.go
AddressBalance
func (pgb *ChainDB) AddressBalance(address string) (bal *dbtypes.AddressBalance, cacheUpdated bool, err error) { // Check the cache first. bestHash, height := pgb.BestBlock() var validHeight *cache.BlockID bal, validHeight = pgb.AddressCache.Balance(address) if bal != nil && *bestHash == validHeight.Hash { retur...
go
func (pgb *ChainDB) AddressBalance(address string) (bal *dbtypes.AddressBalance, cacheUpdated bool, err error) { // Check the cache first. bestHash, height := pgb.BestBlock() var validHeight *cache.BlockID bal, validHeight = pgb.AddressCache.Balance(address) if bal != nil && *bestHash == validHeight.Hash { retur...
[ "func", "(", "pgb", "*", "ChainDB", ")", "AddressBalance", "(", "address", "string", ")", "(", "bal", "*", "dbtypes", ".", "AddressBalance", ",", "cacheUpdated", "bool", ",", "err", "error", ")", "{", "// Check the cache first.", "bestHash", ",", "height", "...
// AddressBalance attempts to retrieve balance information for a specific // address from cache, and if cache is stale or missing data for the address, a // DB query is used. A successful DB query will freshen the cache.
[ "AddressBalance", "attempts", "to", "retrieve", "balance", "information", "for", "a", "specific", "address", "from", "cache", "and", "if", "cache", "is", "stale", "or", "missing", "data", "for", "the", "address", "a", "DB", "query", "is", "used", ".", "A", ...
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/pgblockchain.go#L1789-L1830
train
decred/dcrdata
db/dcrpg/pgblockchain.go
updateAddressRows
func (pgb *ChainDB) updateAddressRows(address string) (rows []*dbtypes.AddressRow, cacheUpdated bool, err error) { busy, wait, done := pgb.CacheLocks.rows.TryLock(address) if busy { // Just wait until the updater is finished. <-wait err = fmt.Errorf("retry") return } // We will run the DB query, so block o...
go
func (pgb *ChainDB) updateAddressRows(address string) (rows []*dbtypes.AddressRow, cacheUpdated bool, err error) { busy, wait, done := pgb.CacheLocks.rows.TryLock(address) if busy { // Just wait until the updater is finished. <-wait err = fmt.Errorf("retry") return } // We will run the DB query, so block o...
[ "func", "(", "pgb", "*", "ChainDB", ")", "updateAddressRows", "(", "address", "string", ")", "(", "rows", "[", "]", "*", "dbtypes", ".", "AddressRow", ",", "cacheUpdated", "bool", ",", "err", "error", ")", "{", "busy", ",", "wait", ",", "done", ":=", ...
// updateAddressRows updates address rows, or waits for them to update by an // ongoing query. On completion, the cache should be ready, although it must be // checked again.
[ "updateAddressRows", "updates", "address", "rows", "or", "waits", "for", "them", "to", "update", "by", "an", "ongoing", "query", ".", "On", "completion", "the", "cache", "should", "be", "ready", "although", "it", "must", "be", "checked", "again", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/pgblockchain.go#L1835-L1861
train
decred/dcrdata
db/dcrpg/pgblockchain.go
AddressRowsMerged
func (pgb *ChainDB) AddressRowsMerged(address string) ([]dbtypes.AddressRowMerged, error) { // Try the address cache. hash := pgb.BestBlockHash() rowsCompact, validBlock := pgb.AddressCache.Rows(address) cacheCurrent := validBlock != nil && validBlock.Hash == *hash && rowsCompact != nil if cacheCurrent { log.Tra...
go
func (pgb *ChainDB) AddressRowsMerged(address string) ([]dbtypes.AddressRowMerged, error) { // Try the address cache. hash := pgb.BestBlockHash() rowsCompact, validBlock := pgb.AddressCache.Rows(address) cacheCurrent := validBlock != nil && validBlock.Hash == *hash && rowsCompact != nil if cacheCurrent { log.Tra...
[ "func", "(", "pgb", "*", "ChainDB", ")", "AddressRowsMerged", "(", "address", "string", ")", "(", "[", "]", "dbtypes", ".", "AddressRowMerged", ",", "error", ")", "{", "// Try the address cache.", "hash", ":=", "pgb", ".", "BestBlockHash", "(", ")", "\n", ...
// AddressRowsMerged gets the merged address rows either from cache or via DB // query.
[ "AddressRowsMerged", "gets", "the", "merged", "address", "rows", "either", "from", "cache", "or", "via", "DB", "query", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/pgblockchain.go#L1865-L1889
train
decred/dcrdata
db/dcrpg/pgblockchain.go
AddressRowsCompact
func (pgb *ChainDB) AddressRowsCompact(address string) ([]dbtypes.AddressRowCompact, error) { // Try the address cache. hash := pgb.BestBlockHash() rowsCompact, validBlock := pgb.AddressCache.Rows(address) cacheCurrent := validBlock != nil && validBlock.Hash == *hash && rowsCompact != nil if cacheCurrent { log.T...
go
func (pgb *ChainDB) AddressRowsCompact(address string) ([]dbtypes.AddressRowCompact, error) { // Try the address cache. hash := pgb.BestBlockHash() rowsCompact, validBlock := pgb.AddressCache.Rows(address) cacheCurrent := validBlock != nil && validBlock.Hash == *hash && rowsCompact != nil if cacheCurrent { log.T...
[ "func", "(", "pgb", "*", "ChainDB", ")", "AddressRowsCompact", "(", "address", "string", ")", "(", "[", "]", "dbtypes", ".", "AddressRowCompact", ",", "error", ")", "{", "// Try the address cache.", "hash", ":=", "pgb", ".", "BestBlockHash", "(", ")", "\n", ...
// AddressRowsCompact gets non-merged address rows either from cache or via DB // query.
[ "AddressRowsCompact", "gets", "non", "-", "merged", "address", "rows", "either", "from", "cache", "or", "via", "DB", "query", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/pgblockchain.go#L1893-L1917
train
decred/dcrdata
db/dcrpg/pgblockchain.go
retrieveMergedTxnCount
func (pgb *ChainDB) retrieveMergedTxnCount(addr string, txnView dbtypes.AddrTxnViewType) (int, error) { ctx, cancel := context.WithTimeout(pgb.ctx, pgb.queryTimeout) defer cancel() var count int64 var err error switch txnView { case dbtypes.AddrMergedTxnDebit: count, err = CountMergedSpendingTxns(ctx, pgb.db, ...
go
func (pgb *ChainDB) retrieveMergedTxnCount(addr string, txnView dbtypes.AddrTxnViewType) (int, error) { ctx, cancel := context.WithTimeout(pgb.ctx, pgb.queryTimeout) defer cancel() var count int64 var err error switch txnView { case dbtypes.AddrMergedTxnDebit: count, err = CountMergedSpendingTxns(ctx, pgb.db, ...
[ "func", "(", "pgb", "*", "ChainDB", ")", "retrieveMergedTxnCount", "(", "addr", "string", ",", "txnView", "dbtypes", ".", "AddrTxnViewType", ")", "(", "int", ",", "error", ")", "{", "ctx", ",", "cancel", ":=", "context", ".", "WithTimeout", "(", "pgb", "...
// retrieveMergedTxnCount queries the DB for the merged address transaction view // row count.
[ "retrieveMergedTxnCount", "queries", "the", "DB", "for", "the", "merged", "address", "transaction", "view", "row", "count", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/pgblockchain.go#L1921-L1938
train
decred/dcrdata
db/dcrpg/pgblockchain.go
mergedTxnCount
func (pgb *ChainDB) mergedTxnCount(addr string, txnView dbtypes.AddrTxnViewType) (int, error) { // Try the cache first. rows, blockID := pgb.AddressCache.Rows(addr) if blockID == nil { // Query the DB. return pgb.retrieveMergedTxnCount(addr, txnView) } return dbtypes.CountMergedRowsCompact(rows, txnView) }
go
func (pgb *ChainDB) mergedTxnCount(addr string, txnView dbtypes.AddrTxnViewType) (int, error) { // Try the cache first. rows, blockID := pgb.AddressCache.Rows(addr) if blockID == nil { // Query the DB. return pgb.retrieveMergedTxnCount(addr, txnView) } return dbtypes.CountMergedRowsCompact(rows, txnView) }
[ "func", "(", "pgb", "*", "ChainDB", ")", "mergedTxnCount", "(", "addr", "string", ",", "txnView", "dbtypes", ".", "AddrTxnViewType", ")", "(", "int", ",", "error", ")", "{", "// Try the cache first.", "rows", ",", "blockID", ":=", "pgb", ".", "AddressCache",...
// mergedTxnCount checks cache and falls back to retrieveMergedTxnCount.
[ "mergedTxnCount", "checks", "cache", "and", "falls", "back", "to", "retrieveMergedTxnCount", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/pgblockchain.go#L1941-L1950
train
decred/dcrdata
db/dcrpg/pgblockchain.go
nonMergedTxnCount
func (pgb *ChainDB) nonMergedTxnCount(addr string, txnView dbtypes.AddrTxnViewType) (int, error) { bal, _, err := pgb.AddressBalance(addr) if err != nil { return 0, err } var count int64 switch txnView { case dbtypes.AddrTxnAll: count = (bal.NumSpent * 2) + bal.NumUnspent case dbtypes.AddrTxnCredit: count ...
go
func (pgb *ChainDB) nonMergedTxnCount(addr string, txnView dbtypes.AddrTxnViewType) (int, error) { bal, _, err := pgb.AddressBalance(addr) if err != nil { return 0, err } var count int64 switch txnView { case dbtypes.AddrTxnAll: count = (bal.NumSpent * 2) + bal.NumUnspent case dbtypes.AddrTxnCredit: count ...
[ "func", "(", "pgb", "*", "ChainDB", ")", "nonMergedTxnCount", "(", "addr", "string", ",", "txnView", "dbtypes", ".", "AddrTxnViewType", ")", "(", "int", ",", "error", ")", "{", "bal", ",", "_", ",", "err", ":=", "pgb", ".", "AddressBalance", "(", "addr...
// nonMergedTxnCount gets the non-merged address transaction view row count via // AddressBalance, which checks the cache and falls back to a DB query.
[ "nonMergedTxnCount", "gets", "the", "non", "-", "merged", "address", "transaction", "view", "row", "count", "via", "AddressBalance", "which", "checks", "the", "cache", "and", "falls", "back", "to", "a", "DB", "query", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/pgblockchain.go#L1954-L1971
train
decred/dcrdata
db/dcrpg/pgblockchain.go
CountTransactions
func (pgb *ChainDB) CountTransactions(addr string, txnView dbtypes.AddrTxnViewType) (int, error) { merged, err := txnView.IsMerged() if err != nil { return 0, err } countFn := pgb.nonMergedTxnCount if merged { countFn = pgb.mergedTxnCount } count, err := countFn(addr, txnView) if err != nil { return 0, ...
go
func (pgb *ChainDB) CountTransactions(addr string, txnView dbtypes.AddrTxnViewType) (int, error) { merged, err := txnView.IsMerged() if err != nil { return 0, err } countFn := pgb.nonMergedTxnCount if merged { countFn = pgb.mergedTxnCount } count, err := countFn(addr, txnView) if err != nil { return 0, ...
[ "func", "(", "pgb", "*", "ChainDB", ")", "CountTransactions", "(", "addr", "string", ",", "txnView", "dbtypes", ".", "AddrTxnViewType", ")", "(", "int", ",", "error", ")", "{", "merged", ",", "err", ":=", "txnView", ".", "IsMerged", "(", ")", "\n", "if...
// CountTransactions gets the total row count for the given address and address // transaction view.
[ "CountTransactions", "gets", "the", "total", "row", "count", "for", "the", "given", "address", "and", "address", "transaction", "view", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/pgblockchain.go#L1975-L1991
train
decred/dcrdata
db/dcrpg/pgblockchain.go
DbTxByHash
func (pgb *ChainDB) DbTxByHash(txid string) (*dbtypes.Tx, error) { ctx, cancel := context.WithTimeout(pgb.ctx, pgb.queryTimeout) defer cancel() _, dbTx, err := RetrieveDbTxByHash(ctx, pgb.db, txid) return dbTx, pgb.replaceCancelError(err) }
go
func (pgb *ChainDB) DbTxByHash(txid string) (*dbtypes.Tx, error) { ctx, cancel := context.WithTimeout(pgb.ctx, pgb.queryTimeout) defer cancel() _, dbTx, err := RetrieveDbTxByHash(ctx, pgb.db, txid) return dbTx, pgb.replaceCancelError(err) }
[ "func", "(", "pgb", "*", "ChainDB", ")", "DbTxByHash", "(", "txid", "string", ")", "(", "*", "dbtypes", ".", "Tx", ",", "error", ")", "{", "ctx", ",", "cancel", ":=", "context", ".", "WithTimeout", "(", "pgb", ".", "ctx", ",", "pgb", ".", "queryTim...
// DbTxByHash retrieves a row of the transactions table corresponding to the // given transaction hash. Transactions in valid and mainchain blocks are chosen // first.
[ "DbTxByHash", "retrieves", "a", "row", "of", "the", "transactions", "table", "corresponding", "to", "the", "given", "transaction", "hash", ".", "Transactions", "in", "valid", "and", "mainchain", "blocks", "are", "chosen", "first", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/pgblockchain.go#L2314-L2319
train
decred/dcrdata
db/dcrpg/pgblockchain.go
FundingOutpointIndxByVinID
func (pgb *ChainDB) FundingOutpointIndxByVinID(id uint64) (uint32, error) { ctx, cancel := context.WithTimeout(pgb.ctx, pgb.queryTimeout) defer cancel() ind, err := RetrieveFundingOutpointIndxByVinID(ctx, pgb.db, id) return ind, pgb.replaceCancelError(err) }
go
func (pgb *ChainDB) FundingOutpointIndxByVinID(id uint64) (uint32, error) { ctx, cancel := context.WithTimeout(pgb.ctx, pgb.queryTimeout) defer cancel() ind, err := RetrieveFundingOutpointIndxByVinID(ctx, pgb.db, id) return ind, pgb.replaceCancelError(err) }
[ "func", "(", "pgb", "*", "ChainDB", ")", "FundingOutpointIndxByVinID", "(", "id", "uint64", ")", "(", "uint32", ",", "error", ")", "{", "ctx", ",", "cancel", ":=", "context", ".", "WithTimeout", "(", "pgb", ".", "ctx", ",", "pgb", ".", "queryTimeout", ...
// FundingOutpointIndxByVinID retrieves the the transaction output index of the // previous outpoint for a transaction input specified by row ID in the vins // table, which stores previous outpoints for each vin.
[ "FundingOutpointIndxByVinID", "retrieves", "the", "the", "transaction", "output", "index", "of", "the", "previous", "outpoint", "for", "a", "transaction", "input", "specified", "by", "row", "ID", "in", "the", "vins", "table", "which", "stores", "previous", "outpoi...
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/pgblockchain.go#L2324-L2329
train
decred/dcrdata
db/dcrpg/pgblockchain.go
FillAddressTransactions
func (pgb *ChainDB) FillAddressTransactions(addrInfo *dbtypes.AddressInfo) error { if addrInfo == nil { return nil } var numUnconfirmed int64 for i, txn := range addrInfo.Transactions { // Retrieve the most valid, most mainchain, and most recent tx with this // hash. This means it prefers mainchain and vali...
go
func (pgb *ChainDB) FillAddressTransactions(addrInfo *dbtypes.AddressInfo) error { if addrInfo == nil { return nil } var numUnconfirmed int64 for i, txn := range addrInfo.Transactions { // Retrieve the most valid, most mainchain, and most recent tx with this // hash. This means it prefers mainchain and vali...
[ "func", "(", "pgb", "*", "ChainDB", ")", "FillAddressTransactions", "(", "addrInfo", "*", "dbtypes", ".", "AddressInfo", ")", "error", "{", "if", "addrInfo", "==", "nil", "{", "return", "nil", "\n", "}", "\n\n", "var", "numUnconfirmed", "int64", "\n\n", "f...
// FillAddressTransactions is used to fill out the transaction details in an // explorer.AddressInfo generated by dbtypes.ReduceAddressHistory, usually from // the output of AddressHistory. This function also sets the number of // unconfirmed transactions for the current best block in the database.
[ "FillAddressTransactions", "is", "used", "to", "fill", "out", "the", "transaction", "details", "in", "an", "explorer", ".", "AddressInfo", "generated", "by", "dbtypes", ".", "ReduceAddressHistory", "usually", "from", "the", "output", "of", "AddressHistory", ".", "...
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/pgblockchain.go#L2335-L2393
train
decred/dcrdata
db/dcrpg/pgblockchain.go
AddressTransactionDetails
func (pgb *ChainDB) AddressTransactionDetails(addr string, count, skip int64, txnType dbtypes.AddrTxnViewType) (*apitypes.Address, error) { // Fetch address history for given transaction range and type addrData, _, err := pgb.addressInfo(addr, count, skip, txnType) if err != nil { return nil, err } // No transa...
go
func (pgb *ChainDB) AddressTransactionDetails(addr string, count, skip int64, txnType dbtypes.AddrTxnViewType) (*apitypes.Address, error) { // Fetch address history for given transaction range and type addrData, _, err := pgb.addressInfo(addr, count, skip, txnType) if err != nil { return nil, err } // No transa...
[ "func", "(", "pgb", "*", "ChainDB", ")", "AddressTransactionDetails", "(", "addr", "string", ",", "count", ",", "skip", "int64", ",", "txnType", "dbtypes", ".", "AddrTxnViewType", ")", "(", "*", "apitypes", ".", "Address", ",", "error", ")", "{", "// Fetch...
// AddressTransactionDetails returns an apitypes.Address with at most the last // count transactions of type txnType in which the address was involved, // starting after skip transactions. This does NOT include unconfirmed // transactions.
[ "AddressTransactionDetails", "returns", "an", "apitypes", ".", "Address", "with", "at", "most", "the", "last", "count", "transactions", "of", "type", "txnType", "in", "which", "the", "address", "was", "involved", "starting", "after", "skip", "transactions", ".", ...
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/pgblockchain.go#L2610-L2643
train
decred/dcrdata
db/dcrpg/pgblockchain.go
ChainInfo
func (pgb *ChainDB) ChainInfo() *dbtypes.BlockChainData { pgb.deployments.mtx.RLock() defer pgb.deployments.mtx.RUnlock() return pgb.deployments.chainInfo }
go
func (pgb *ChainDB) ChainInfo() *dbtypes.BlockChainData { pgb.deployments.mtx.RLock() defer pgb.deployments.mtx.RUnlock() return pgb.deployments.chainInfo }
[ "func", "(", "pgb", "*", "ChainDB", ")", "ChainInfo", "(", ")", "*", "dbtypes", ".", "BlockChainData", "{", "pgb", ".", "deployments", ".", "mtx", ".", "RLock", "(", ")", "\n", "defer", "pgb", ".", "deployments", ".", "mtx", ".", "RUnlock", "(", ")",...
// ChainInfo guarantees thread-safe access of the deployment data.
[ "ChainInfo", "guarantees", "thread", "-", "safe", "access", "of", "the", "deployment", "data", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/pgblockchain.go#L2746-L2750
train