id
int32
0
167k
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
19,700
decred/dcrdata
exchanges/exchanges.go
NewPoloniex
func NewPoloniex(client *http.Client, channels *BotChannels) (poloniex Exchange, err error) { reqs := newRequests() reqs.price, err = http.NewRequest(http.MethodGet, PoloniexURLs.Price, nil) if err != nil { return } reqs.depth, err = http.NewRequest(http.MethodGet, PoloniexURLs.Depth, nil) if err != nil { re...
go
func NewPoloniex(client *http.Client, channels *BotChannels) (poloniex Exchange, err error) { reqs := newRequests() reqs.price, err = http.NewRequest(http.MethodGet, PoloniexURLs.Price, nil) if err != nil { return } reqs.depth, err = http.NewRequest(http.MethodGet, PoloniexURLs.Depth, nil) if err != nil { re...
[ "func", "NewPoloniex", "(", "client", "*", "http", ".", "Client", ",", "channels", "*", "BotChannels", ")", "(", "poloniex", "Exchange", ",", "err", "error", ")", "{", "reqs", ":=", "newRequests", "(", ")", "\n", "reqs", ".", "price", ",", "err", "=", ...
// NewPoloniex constructs a PoloniexExchange.
[ "NewPoloniex", "constructs", "a", "PoloniexExchange", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/exchanges/exchanges.go#L1799-L1832
19,701
decred/dcrdata
exchanges/exchanges.go
processWsOrderbook
func (poloniex *PoloniexExchange) processWsOrderbook(sequenceID int64, responseList []interface{}) { subList, ok := responseList[0].([]interface{}) if !ok { poloniex.setWsFail(fmt.Errorf("Failed to parse 0th element of poloniex response array")) return } if len(subList) < 2 { poloniex.setWsFail(fmt.Errorf("Un...
go
func (poloniex *PoloniexExchange) processWsOrderbook(sequenceID int64, responseList []interface{}) { subList, ok := responseList[0].([]interface{}) if !ok { poloniex.setWsFail(fmt.Errorf("Failed to parse 0th element of poloniex response array")) return } if len(subList) < 2 { poloniex.setWsFail(fmt.Errorf("Un...
[ "func", "(", "poloniex", "*", "PoloniexExchange", ")", "processWsOrderbook", "(", "sequenceID", "int64", ",", "responseList", "[", "]", "interface", "{", "}", ")", "{", "subList", ",", "ok", ":=", "responseList", "[", "0", "]", ".", "(", "[", "]", "inter...
// This initial websocket message is a full orderbook.
[ "This", "initial", "websocket", "message", "is", "a", "full", "orderbook", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/exchanges/exchanges.go#L1994-L2044
19,702
decred/dcrdata
exchanges/exchanges.go
mergePoloniexDepthUpdates
func mergePoloniexDepthUpdates(target, source poloniexOrders) { for bin, pt := range source { if pt.volume == 0 { delete(source, bin) delete(target, bin) continue } target[bin] = pt } }
go
func mergePoloniexDepthUpdates(target, source poloniexOrders) { for bin, pt := range source { if pt.volume == 0 { delete(source, bin) delete(target, bin) continue } target[bin] = pt } }
[ "func", "mergePoloniexDepthUpdates", "(", "target", ",", "source", "poloniexOrders", ")", "{", "for", "bin", ",", "pt", ":=", "range", "source", "{", "if", "pt", ".", "volume", "==", "0", "{", "delete", "(", "source", ",", "bin", ")", "\n", "delete", "...
// A helper for merging a source map into a target map. Poloniex order in the // source map with volume 0 will trigger a deletion from the target map.
[ "A", "helper", "for", "merging", "a", "source", "map", "into", "a", "target", "map", ".", "Poloniex", "order", "in", "the", "source", "map", "with", "volume", "0", "will", "trigger", "a", "deletion", "from", "the", "target", "map", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/exchanges/exchanges.go#L2048-L2057
19,703
decred/dcrdata
exchanges/exchanges.go
accumulateOrders
func (poloniex *PoloniexExchange) accumulateOrders(sequenceID int64, asks, buys poloniexOrders) { poloniex.orderMtx.Lock() defer poloniex.orderMtx.Unlock() poloniex.orderSeq++ if sequenceID != poloniex.orderSeq { poloniex.setWsFail(fmt.Errorf("poloniex sequence id failure. expected %d, received %d", poloniex.orde...
go
func (poloniex *PoloniexExchange) accumulateOrders(sequenceID int64, asks, buys poloniexOrders) { poloniex.orderMtx.Lock() defer poloniex.orderMtx.Unlock() poloniex.orderSeq++ if sequenceID != poloniex.orderSeq { poloniex.setWsFail(fmt.Errorf("poloniex sequence id failure. expected %d, received %d", poloniex.orde...
[ "func", "(", "poloniex", "*", "PoloniexExchange", ")", "accumulateOrders", "(", "sequenceID", "int64", ",", "asks", ",", "buys", "poloniexOrders", ")", "{", "poloniex", ".", "orderMtx", ".", "Lock", "(", ")", "\n", "defer", "poloniex", ".", "orderMtx", ".", ...
// Merge order updates under a write lock.
[ "Merge", "order", "updates", "under", "a", "write", "lock", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/exchanges/exchanges.go#L2060-L2070
19,704
decred/dcrdata
exchanges/exchanges.go
firstCode
func firstCode(responseList []interface{}) string { firstElement, ok := responseList[0].([]interface{}) if !ok { log.Errorf("parse failure in poloniex websocket message") return "" } if len(firstElement) < 1 { log.Errorf("unexpected number of parameters in poloniex websocket message") return "" } updateTy...
go
func firstCode(responseList []interface{}) string { firstElement, ok := responseList[0].([]interface{}) if !ok { log.Errorf("parse failure in poloniex websocket message") return "" } if len(firstElement) < 1 { log.Errorf("unexpected number of parameters in poloniex websocket message") return "" } updateTy...
[ "func", "firstCode", "(", "responseList", "[", "]", "interface", "{", "}", ")", "string", "{", "firstElement", ",", "ok", ":=", "responseList", "[", "0", "]", ".", "(", "[", "]", "interface", "{", "}", ")", "\n", "if", "!", "ok", "{", "log", ".", ...
// Poloniex has a string code in the result array indicating what type of // message it is.
[ "Poloniex", "has", "a", "string", "code", "in", "the", "result", "array", "indicating", "what", "type", "of", "message", "it", "is", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/exchanges/exchanges.go#L2084-L2100
19,705
decred/dcrdata
exchanges/exchanges.go
processPoloniexOrderbookUpdate
func processPoloniexOrderbookUpdate(updateParams []interface{}) (*poloniexOrder, int, error) { floatDir, ok := updateParams[1].(float64) if !ok { return nil, -1, fmt.Errorf("failed to type convert poloniex orderbook update direction") } direction := int(floatDir) priceStr, ok := updateParams[2].(string) if !ok ...
go
func processPoloniexOrderbookUpdate(updateParams []interface{}) (*poloniexOrder, int, error) { floatDir, ok := updateParams[1].(float64) if !ok { return nil, -1, fmt.Errorf("failed to type convert poloniex orderbook update direction") } direction := int(floatDir) priceStr, ok := updateParams[2].(string) if !ok ...
[ "func", "processPoloniexOrderbookUpdate", "(", "updateParams", "[", "]", "interface", "{", "}", ")", "(", "*", "poloniexOrder", ",", "int", ",", "error", ")", "{", "floatDir", ",", "ok", ":=", "updateParams", "[", "1", "]", ".", "(", "float64", ")", "\n"...
// For Poloniex message "o", an update to the orderbook.
[ "For", "Poloniex", "message", "o", "an", "update", "to", "the", "orderbook", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/exchanges/exchanges.go#L2103-L2129
19,706
decred/dcrdata
exchanges/exchanges.go
processTrade
func (poloniex *PoloniexExchange) processTrade(tradeParams []interface{}) (*poloniexOrder, int, error) { if len(tradeParams) != 6 { return nil, -1, fmt.Errorf("Not enough parameters in poloniex trade notification. given: %d", len(tradeParams)) } floatDir, ok := tradeParams[2].(float64) if !ok { return nil, -1, ...
go
func (poloniex *PoloniexExchange) processTrade(tradeParams []interface{}) (*poloniexOrder, int, error) { if len(tradeParams) != 6 { return nil, -1, fmt.Errorf("Not enough parameters in poloniex trade notification. given: %d", len(tradeParams)) } floatDir, ok := tradeParams[2].(float64) if !ok { return nil, -1, ...
[ "func", "(", "poloniex", "*", "PoloniexExchange", ")", "processTrade", "(", "tradeParams", "[", "]", "interface", "{", "}", ")", "(", "*", "poloniexOrder", ",", "int", ",", "error", ")", "{", "if", "len", "(", "tradeParams", ")", "!=", "6", "{", "retur...
// For Poloniex message "t", a trade. This seems to be used rarely and // sporadically, but it is used. For the BTC_DCR endpoint, almost all updates // are of the "o" type, an orderbook update. The docs are unclear about whether a trade updates the // order book, but testing seems to indicate that a "t" message is for ...
[ "For", "Poloniex", "message", "t", "a", "trade", ".", "This", "seems", "to", "be", "used", "rarely", "and", "sporadically", "but", "it", "is", "used", ".", "For", "the", "BTC_DCR", "endpoint", "almost", "all", "updates", "are", "of", "the", "o", "type", ...
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/exchanges/exchanges.go#L2136-L2166
19,707
decred/dcrdata
exchanges/exchanges.go
poloniexBinKeys
func poloniexBinKeys(book poloniexOrders) []int64 { keys := make([]int64, 0, len(book)) for k := range book { keys = append(keys, k) } return keys }
go
func poloniexBinKeys(book poloniexOrders) []int64 { keys := make([]int64, 0, len(book)) for k := range book { keys = append(keys, k) } return keys }
[ "func", "poloniexBinKeys", "(", "book", "poloniexOrders", ")", "[", "]", "int64", "{", "keys", ":=", "make", "(", "[", "]", "int64", ",", "0", ",", "len", "(", "book", ")", ")", "\n", "for", "k", ":=", "range", "book", "{", "keys", "=", "append", ...
// Pull out the int64 bin keys from the map.
[ "Pull", "out", "the", "int64", "bin", "keys", "from", "the", "map", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/exchanges/exchanges.go#L2280-L2286
19,708
decred/dcrdata
exchanges/exchanges.go
wsDepths
func (poloniex *PoloniexExchange) wsDepths() *DepthData { poloniex.orderMtx.RLock() defer poloniex.orderMtx.RUnlock() askKeys := poloniexBinKeys(poloniex.asks) sort.Slice(askKeys, func(i, j int) bool { return askKeys[i] < askKeys[j] }) buyKeys := poloniexBinKeys(poloniex.buys) sort.Slice(buyKeys, func(i, j int...
go
func (poloniex *PoloniexExchange) wsDepths() *DepthData { poloniex.orderMtx.RLock() defer poloniex.orderMtx.RUnlock() askKeys := poloniexBinKeys(poloniex.asks) sort.Slice(askKeys, func(i, j int) bool { return askKeys[i] < askKeys[j] }) buyKeys := poloniexBinKeys(poloniex.buys) sort.Slice(buyKeys, func(i, j int...
[ "func", "(", "poloniex", "*", "PoloniexExchange", ")", "wsDepths", "(", ")", "*", "DepthData", "{", "poloniex", ".", "orderMtx", ".", "RLock", "(", ")", "\n", "defer", "poloniex", ".", "orderMtx", ".", "RUnlock", "(", ")", "\n", "askKeys", ":=", "polonie...
// Convert the intermediate orderbook to a DepthData.
[ "Convert", "the", "intermediate", "orderbook", "to", "a", "DepthData", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/exchanges/exchanges.go#L2289-L2321
19,709
decred/dcrdata
exchanges/exchanges.go
connectWs
func (poloniex *PoloniexExchange) connectWs() { poloniex.connectWebsocket(poloniex.processWsMessage, &socketConfig{ address: PoloniexURLs.Websocket, }) poloniex.wsSend(poloniexOrderbookSubscription) }
go
func (poloniex *PoloniexExchange) connectWs() { poloniex.connectWebsocket(poloniex.processWsMessage, &socketConfig{ address: PoloniexURLs.Websocket, }) poloniex.wsSend(poloniexOrderbookSubscription) }
[ "func", "(", "poloniex", "*", "PoloniexExchange", ")", "connectWs", "(", ")", "{", "poloniex", ".", "connectWebsocket", "(", "poloniex", ".", "processWsMessage", ",", "&", "socketConfig", "{", "address", ":", "PoloniexURLs", ".", "Websocket", ",", "}", ")", ...
// Create a websocket connection and send the orderbook subscription.
[ "Create", "a", "websocket", "connection", "and", "send", "the", "orderbook", "subscription", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/exchanges/exchanges.go#L2324-L2329
19,710
decred/dcrdata
db/cache/charts.go
ParseZoom
func ParseZoom(zoom string) ZoomLevel { switch ZoomLevel(zoom) { case BlockZoom: return BlockZoom case WindowZoom: return WindowZoom } return DefaultZoomLevel }
go
func ParseZoom(zoom string) ZoomLevel { switch ZoomLevel(zoom) { case BlockZoom: return BlockZoom case WindowZoom: return WindowZoom } return DefaultZoomLevel }
[ "func", "ParseZoom", "(", "zoom", "string", ")", "ZoomLevel", "{", "switch", "ZoomLevel", "(", "zoom", ")", "{", "case", "BlockZoom", ":", "return", "BlockZoom", "\n", "case", "WindowZoom", ":", "return", "WindowZoom", "\n", "}", "\n", "return", "DefaultZoom...
// ParseZoom will return the matching zoom level, else the default zoom.
[ "ParseZoom", "will", "return", "the", "matching", "zoom", "level", "else", "the", "default", "zoom", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/cache/charts.go#L52-L60
19,711
decred/dcrdata
db/cache/charts.go
Snip
func (set *zoomSet) Snip(length int) { set.Height = set.Height.snip(length) set.Time = set.Time.snip(length) set.PoolSize = set.PoolSize.snip(length) set.PoolValue = set.PoolValue.snip(length) set.BlockSize = set.BlockSize.snip(length) set.TxCount = set.TxCount.snip(length) set.NewAtoms = set.NewAtoms.snip(lengt...
go
func (set *zoomSet) Snip(length int) { set.Height = set.Height.snip(length) set.Time = set.Time.snip(length) set.PoolSize = set.PoolSize.snip(length) set.PoolValue = set.PoolValue.snip(length) set.BlockSize = set.BlockSize.snip(length) set.TxCount = set.TxCount.snip(length) set.NewAtoms = set.NewAtoms.snip(lengt...
[ "func", "(", "set", "*", "zoomSet", ")", "Snip", "(", "length", "int", ")", "{", "set", ".", "Height", "=", "set", ".", "Height", ".", "snip", "(", "length", ")", "\n", "set", ".", "Time", "=", "set", ".", "Time", ".", "snip", "(", "length", ")...
// Snip truncates the zoomSet to a provided length.
[ "Snip", "truncates", "the", "zoomSet", "to", "a", "provided", "length", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/cache/charts.go#L213-L223
19,712
decred/dcrdata
db/cache/charts.go
newBlockSet
func newBlockSet(size int) *zoomSet { return &zoomSet{ Time: newChartUints(size), PoolSize: newChartUints(size), PoolValue: newChartFloats(size), BlockSize: newChartUints(size), TxCount: newChartUints(size), NewAtoms: newChartUints(size), Chainwork: newChartUints(size), Fees: newChartUint...
go
func newBlockSet(size int) *zoomSet { return &zoomSet{ Time: newChartUints(size), PoolSize: newChartUints(size), PoolValue: newChartFloats(size), BlockSize: newChartUints(size), TxCount: newChartUints(size), NewAtoms: newChartUints(size), Chainwork: newChartUints(size), Fees: newChartUint...
[ "func", "newBlockSet", "(", "size", "int", ")", "*", "zoomSet", "{", "return", "&", "zoomSet", "{", "Time", ":", "newChartUints", "(", "size", ")", ",", "PoolSize", ":", "newChartUints", "(", "size", ")", ",", "PoolValue", ":", "newChartFloats", "(", "si...
// Constructor for a sized zoomSet for blocks, which has has no Height slice // since the height is implicit for block-binned data.
[ "Constructor", "for", "a", "sized", "zoomSet", "for", "blocks", "which", "has", "has", "no", "Height", "slice", "since", "the", "height", "is", "implicit", "for", "block", "-", "binned", "data", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/cache/charts.go#L227-L238
19,713
decred/dcrdata
db/cache/charts.go
newDaySet
func newDaySet(size int) *zoomSet { set := newBlockSet(size) set.Height = newChartUints(size) return set }
go
func newDaySet(size int) *zoomSet { set := newBlockSet(size) set.Height = newChartUints(size) return set }
[ "func", "newDaySet", "(", "size", "int", ")", "*", "zoomSet", "{", "set", ":=", "newBlockSet", "(", "size", ")", "\n", "set", ".", "Height", "=", "newChartUints", "(", "size", ")", "\n", "return", "set", "\n", "}" ]
// Constructor for a sized zoomSet for day-binned data.
[ "Constructor", "for", "a", "sized", "zoomSet", "for", "day", "-", "binned", "data", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/cache/charts.go#L241-L245
19,714
decred/dcrdata
db/cache/charts.go
Snip
func (set *windowSet) Snip(length int) { set.Time = set.Time.snip(length) set.PowDiff = set.PowDiff.snip(length) set.TicketPrice = set.TicketPrice.snip(length) }
go
func (set *windowSet) Snip(length int) { set.Time = set.Time.snip(length) set.PowDiff = set.PowDiff.snip(length) set.TicketPrice = set.TicketPrice.snip(length) }
[ "func", "(", "set", "*", "windowSet", ")", "Snip", "(", "length", "int", ")", "{", "set", ".", "Time", "=", "set", ".", "Time", ".", "snip", "(", "length", ")", "\n", "set", ".", "PowDiff", "=", "set", ".", "PowDiff", ".", "snip", "(", "length", ...
// Snip truncates the windowSet to a provided length.
[ "Snip", "truncates", "the", "windowSet", "to", "a", "provided", "length", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/cache/charts.go#L257-L261
19,715
decred/dcrdata
db/cache/charts.go
newWindowSet
func newWindowSet(size int) *windowSet { return &windowSet{ Time: newChartUints(size), PowDiff: newChartFloats(size), TicketPrice: newChartUints(size), } }
go
func newWindowSet(size int) *windowSet { return &windowSet{ Time: newChartUints(size), PowDiff: newChartFloats(size), TicketPrice: newChartUints(size), } }
[ "func", "newWindowSet", "(", "size", "int", ")", "*", "windowSet", "{", "return", "&", "windowSet", "{", "Time", ":", "newChartUints", "(", "size", ")", ",", "PowDiff", ":", "newChartFloats", "(", "size", ")", ",", "TicketPrice", ":", "newChartUints", "(",...
// Constructor for a sized windowSet.
[ "Constructor", "for", "a", "sized", "windowSet", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/cache/charts.go#L264-L270
19,716
decred/dcrdata
db/cache/charts.go
ValidateLengths
func ValidateLengths(lens ...lengther) (int, error) { lenLen := len(lens) if lenLen == 0 { return 0, nil } firstLen := lens[0].Length() shortest := firstLen for i, l := range lens[1:lenLen] { dLen := l.Length() if dLen < firstLen { log.Warnf("charts.ValidateLengths: dataset at index %d has mismatched len...
go
func ValidateLengths(lens ...lengther) (int, error) { lenLen := len(lens) if lenLen == 0 { return 0, nil } firstLen := lens[0].Length() shortest := firstLen for i, l := range lens[1:lenLen] { dLen := l.Length() if dLen < firstLen { log.Warnf("charts.ValidateLengths: dataset at index %d has mismatched len...
[ "func", "ValidateLengths", "(", "lens", "...", "lengther", ")", "(", "int", ",", "error", ")", "{", "lenLen", ":=", "len", "(", "lens", ")", "\n", "if", "lenLen", "==", "0", "{", "return", "0", ",", "nil", "\n", "}", "\n", "firstLen", ":=", "lens",...
// Check that the length of all arguments is equal.
[ "Check", "that", "the", "length", "of", "all", "arguments", "is", "equal", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/cache/charts.go#L331-L351
19,717
decred/dcrdata
db/cache/charts.go
midnight
func midnight(t uint64) (mid uint64) { if t > 0 { mid = t - t%aDay } return }
go
func midnight(t uint64) (mid uint64) { if t > 0 { mid = t - t%aDay } return }
[ "func", "midnight", "(", "t", "uint64", ")", "(", "mid", "uint64", ")", "{", "if", "t", ">", "0", "{", "mid", "=", "t", "-", "t", "%", "aDay", "\n", "}", "\n", "return", "\n", "}" ]
// Reduce the timestamp to the previous midnight.
[ "Reduce", "the", "timestamp", "to", "the", "previous", "midnight", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/cache/charts.go#L354-L359
19,718
decred/dcrdata
db/cache/charts.go
ReorgHandler
func (charts *ChartData) ReorgHandler(wg *sync.WaitGroup, c chan *txhelpers.ReorgData) { defer func() { wg.Done() }() for { select { case data, ok := <-c: if !ok { return } commonAncestorHeight := uint64(data.NewChainHeight) - uint64(len(data.NewChain)) charts.mtx.Lock() defer charts.mtx.Unl...
go
func (charts *ChartData) ReorgHandler(wg *sync.WaitGroup, c chan *txhelpers.ReorgData) { defer func() { wg.Done() }() for { select { case data, ok := <-c: if !ok { return } commonAncestorHeight := uint64(data.NewChainHeight) - uint64(len(data.NewChain)) charts.mtx.Lock() defer charts.mtx.Unl...
[ "func", "(", "charts", "*", "ChartData", ")", "ReorgHandler", "(", "wg", "*", "sync", ".", "WaitGroup", ",", "c", "chan", "*", "txhelpers", ".", "ReorgData", ")", "{", "defer", "func", "(", ")", "{", "wg", ".", "Done", "(", ")", "\n", "}", "(", "...
// ReorgHandler handles the charts cache data reorganization.
[ "ReorgHandler", "handles", "the", "charts", "cache", "data", "reorganization", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/cache/charts.go#L458-L486
19,719
decred/dcrdata
db/cache/charts.go
Load
func (charts *ChartData) Load(cacheDumpPath string) { t := time.Now() if err := charts.readCacheFile(cacheDumpPath); err != nil { log.Debugf("Cache dump data loading failed: %v", err) } // Bring the charts up to date. charts.Update() log.Debugf("Completed the initial chart load in %d s", time.Since(t).Second...
go
func (charts *ChartData) Load(cacheDumpPath string) { t := time.Now() if err := charts.readCacheFile(cacheDumpPath); err != nil { log.Debugf("Cache dump data loading failed: %v", err) } // Bring the charts up to date. charts.Update() log.Debugf("Completed the initial chart load in %d s", time.Since(t).Second...
[ "func", "(", "charts", "*", "ChartData", ")", "Load", "(", "cacheDumpPath", "string", ")", "{", "t", ":=", "time", ".", "Now", "(", ")", "\n\n", "if", "err", ":=", "charts", ".", "readCacheFile", "(", "cacheDumpPath", ")", ";", "err", "!=", "nil", "{...
// Load loads chart data from the gob file at the specified path and performs an // update.
[ "Load", "loads", "chart", "data", "from", "the", "gob", "file", "at", "the", "specified", "path", "and", "performs", "an", "update", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/cache/charts.go#L569-L580
19,720
decred/dcrdata
db/cache/charts.go
Dump
func (charts *ChartData) Dump(dumpPath string) { err := charts.writeCacheFile(dumpPath) if err != nil { log.Errorf("ChartData.writeCacheFile failed: %v", err) } else { log.Debug("Dumping the charts cache data was successful") } }
go
func (charts *ChartData) Dump(dumpPath string) { err := charts.writeCacheFile(dumpPath) if err != nil { log.Errorf("ChartData.writeCacheFile failed: %v", err) } else { log.Debug("Dumping the charts cache data was successful") } }
[ "func", "(", "charts", "*", "ChartData", ")", "Dump", "(", "dumpPath", "string", ")", "{", "err", ":=", "charts", ".", "writeCacheFile", "(", "dumpPath", ")", "\n", "if", "err", "!=", "nil", "{", "log", ".", "Errorf", "(", "\"", "\"", ",", "err", "...
// Dump dumps a ChartGobject to a gob file at the given path.
[ "Dump", "dumps", "a", "ChartGobject", "to", "a", "gob", "file", "at", "the", "given", "path", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/cache/charts.go#L583-L590
19,721
decred/dcrdata
db/cache/charts.go
FeesTip
func (charts *ChartData) FeesTip() int32 { charts.mtx.RLock() defer charts.mtx.RUnlock() return int32(len(charts.Blocks.Fees)) - 1 }
go
func (charts *ChartData) FeesTip() int32 { charts.mtx.RLock() defer charts.mtx.RUnlock() return int32(len(charts.Blocks.Fees)) - 1 }
[ "func", "(", "charts", "*", "ChartData", ")", "FeesTip", "(", ")", "int32", "{", "charts", ".", "mtx", ".", "RLock", "(", ")", "\n", "defer", "charts", ".", "mtx", ".", "RUnlock", "(", ")", "\n", "return", "int32", "(", "len", "(", "charts", ".", ...
// FeesTip is the height of the Fees data.
[ "FeesTip", "is", "the", "height", "of", "the", "Fees", "data", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/cache/charts.go#L649-L653
19,722
decred/dcrdata
db/cache/charts.go
NewAtomsTip
func (charts *ChartData) NewAtomsTip() int32 { charts.mtx.RLock() defer charts.mtx.RUnlock() return int32(len(charts.Blocks.NewAtoms)) - 1 }
go
func (charts *ChartData) NewAtomsTip() int32 { charts.mtx.RLock() defer charts.mtx.RUnlock() return int32(len(charts.Blocks.NewAtoms)) - 1 }
[ "func", "(", "charts", "*", "ChartData", ")", "NewAtomsTip", "(", ")", "int32", "{", "charts", ".", "mtx", ".", "RLock", "(", ")", "\n", "defer", "charts", ".", "mtx", ".", "RUnlock", "(", ")", "\n", "return", "int32", "(", "len", "(", "charts", "....
// NewAtomsTip is the height of the NewAtoms data.
[ "NewAtomsTip", "is", "the", "height", "of", "the", "NewAtoms", "data", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/cache/charts.go#L656-L660
19,723
decred/dcrdata
db/cache/charts.go
TicketPriceTip
func (charts *ChartData) TicketPriceTip() int32 { charts.mtx.RLock() defer charts.mtx.RUnlock() return int32(len(charts.Windows.TicketPrice))*charts.DiffInterval - 1 }
go
func (charts *ChartData) TicketPriceTip() int32 { charts.mtx.RLock() defer charts.mtx.RUnlock() return int32(len(charts.Windows.TicketPrice))*charts.DiffInterval - 1 }
[ "func", "(", "charts", "*", "ChartData", ")", "TicketPriceTip", "(", ")", "int32", "{", "charts", ".", "mtx", ".", "RLock", "(", ")", "\n", "defer", "charts", ".", "mtx", ".", "RUnlock", "(", ")", "\n", "return", "int32", "(", "len", "(", "charts", ...
// TicketPriceTip is the height of the TicketPrice data.
[ "TicketPriceTip", "is", "the", "height", "of", "the", "TicketPrice", "data", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/cache/charts.go#L663-L667
19,724
decred/dcrdata
db/cache/charts.go
PoolSizeTip
func (charts *ChartData) PoolSizeTip() int32 { charts.mtx.RLock() defer charts.mtx.RUnlock() return int32(len(charts.Blocks.PoolSize)) - 1 }
go
func (charts *ChartData) PoolSizeTip() int32 { charts.mtx.RLock() defer charts.mtx.RUnlock() return int32(len(charts.Blocks.PoolSize)) - 1 }
[ "func", "(", "charts", "*", "ChartData", ")", "PoolSizeTip", "(", ")", "int32", "{", "charts", ".", "mtx", ".", "RLock", "(", ")", "\n", "defer", "charts", ".", "mtx", ".", "RUnlock", "(", ")", "\n", "return", "int32", "(", "len", "(", "charts", "....
// PoolSizeTip is the height of the PoolSize data.
[ "PoolSizeTip", "is", "the", "height", "of", "the", "PoolSize", "data", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/cache/charts.go#L670-L674
19,725
decred/dcrdata
db/cache/charts.go
NewChartData
func NewChartData(height uint32, genesis time.Time, chainParams *chaincfg.Params, ctx context.Context) *ChartData { // Start datasets at 25% larger than height. This matches golangs default // capacity size increase for slice lengths > 1024 // https://github.com/golang/go/blob/87e48c5afdcf5e01bb2b7f51b7643e8901f4b7f...
go
func NewChartData(height uint32, genesis time.Time, chainParams *chaincfg.Params, ctx context.Context) *ChartData { // Start datasets at 25% larger than height. This matches golangs default // capacity size increase for slice lengths > 1024 // https://github.com/golang/go/blob/87e48c5afdcf5e01bb2b7f51b7643e8901f4b7f...
[ "func", "NewChartData", "(", "height", "uint32", ",", "genesis", "time", ".", "Time", ",", "chainParams", "*", "chaincfg", ".", "Params", ",", "ctx", "context", ".", "Context", ")", "*", "ChartData", "{", "// Start datasets at 25% larger than height. This matches go...
// NewChartData constructs a new ChartData.
[ "NewChartData", "constructs", "a", "new", "ChartData", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/cache/charts.go#L712-L729
19,726
decred/dcrdata
db/cache/charts.go
getCache
func (charts *ChartData) getCache(chartID string, zoom ZoomLevel) (data *cachedChart, found bool, cacheID uint64) { // Ignore zero length since bestHeight would just be set to zero anyway. ck := cacheKey(chartID, zoom) charts.cacheMtx.RLock() defer charts.cacheMtx.RUnlock() cacheID = charts.cacheID(zoom) data, fo...
go
func (charts *ChartData) getCache(chartID string, zoom ZoomLevel) (data *cachedChart, found bool, cacheID uint64) { // Ignore zero length since bestHeight would just be set to zero anyway. ck := cacheKey(chartID, zoom) charts.cacheMtx.RLock() defer charts.cacheMtx.RUnlock() cacheID = charts.cacheID(zoom) data, fo...
[ "func", "(", "charts", "*", "ChartData", ")", "getCache", "(", "chartID", "string", ",", "zoom", "ZoomLevel", ")", "(", "data", "*", "cachedChart", ",", "found", "bool", ",", "cacheID", "uint64", ")", "{", "// Ignore zero length since bestHeight would just be set ...
// Grab the cached data, if it exists. The cacheID is returned as a convenience.
[ "Grab", "the", "cached", "data", "if", "it", "exists", ".", "The", "cacheID", "is", "returned", "as", "a", "convenience", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/cache/charts.go#L751-L759
19,727
decred/dcrdata
db/cache/charts.go
cacheChart
func (charts *ChartData) cacheChart(chartID string, zoom ZoomLevel, data []byte) { ck := cacheKey(chartID, zoom) charts.cacheMtx.Lock() defer charts.cacheMtx.Unlock() // Using the current best cacheID. This leaves open the small possibility that // the cacheID is wrong, if the cacheID has been updated between the ...
go
func (charts *ChartData) cacheChart(chartID string, zoom ZoomLevel, data []byte) { ck := cacheKey(chartID, zoom) charts.cacheMtx.Lock() defer charts.cacheMtx.Unlock() // Using the current best cacheID. This leaves open the small possibility that // the cacheID is wrong, if the cacheID has been updated between the ...
[ "func", "(", "charts", "*", "ChartData", ")", "cacheChart", "(", "chartID", "string", ",", "zoom", "ZoomLevel", ",", "data", "[", "]", "byte", ")", "{", "ck", ":=", "cacheKey", "(", "chartID", ",", "zoom", ")", "\n", "charts", ".", "cacheMtx", ".", "...
// Store the chart associated with the provided type and ZoomLevel.
[ "Store", "the", "chart", "associated", "with", "the", "provided", "type", "and", "ZoomLevel", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/cache/charts.go#L762-L773
19,728
decred/dcrdata
db/cache/charts.go
Chart
func (charts *ChartData) Chart(chartID, zoomString string) ([]byte, error) { zoom := ParseZoom(zoomString) cache, found, cacheID := charts.getCache(chartID, zoom) if found && cache.cacheID == cacheID { return cache.data, nil } maker, hasMaker := chartMakers[chartID] if !hasMaker { return nil, UnknownChartErr ...
go
func (charts *ChartData) Chart(chartID, zoomString string) ([]byte, error) { zoom := ParseZoom(zoomString) cache, found, cacheID := charts.getCache(chartID, zoom) if found && cache.cacheID == cacheID { return cache.data, nil } maker, hasMaker := chartMakers[chartID] if !hasMaker { return nil, UnknownChartErr ...
[ "func", "(", "charts", "*", "ChartData", ")", "Chart", "(", "chartID", ",", "zoomString", "string", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "zoom", ":=", "ParseZoom", "(", "zoomString", ")", "\n", "cache", ",", "found", ",", "cacheID", ":...
// Chart will return a JSON-encoded chartResponse of the provided type // and ZoomLevel.
[ "Chart", "will", "return", "a", "JSON", "-", "encoded", "chartResponse", "of", "the", "provided", "type", "and", "ZoomLevel", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/cache/charts.go#L796-L816
19,729
decred/dcrdata
db/cache/charts.go
encode
func (charts *ChartData) encode(sets ...lengther) ([]byte, error) { if len(sets) == 0 { return nil, fmt.Errorf("encode called without arguments") } smaller := sets[0].Length() for _, x := range sets { l := x.Length() if l < smaller { smaller = l } } response := make(chartResponse) for i := range sets ...
go
func (charts *ChartData) encode(sets ...lengther) ([]byte, error) { if len(sets) == 0 { return nil, fmt.Errorf("encode called without arguments") } smaller := sets[0].Length() for _, x := range sets { l := x.Length() if l < smaller { smaller = l } } response := make(chartResponse) for i := range sets ...
[ "func", "(", "charts", "*", "ChartData", ")", "encode", "(", "sets", "...", "lengther", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "if", "len", "(", "sets", ")", "==", "0", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\...
// Encode the slices. The set lengths are truncated to the smallest of the // arguments.
[ "Encode", "the", "slices", ".", "The", "set", "lengths", "are", "truncated", "to", "the", "smallest", "of", "the", "arguments", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/cache/charts.go#L823-L846
19,730
decred/dcrdata
db/cache/charts.go
accumulate
func accumulate(data ChartUints) ChartUints { d := make(ChartUints, 0, len(data)) var accumulator uint64 for _, v := range data { accumulator += v d = append(d, accumulator) } return d }
go
func accumulate(data ChartUints) ChartUints { d := make(ChartUints, 0, len(data)) var accumulator uint64 for _, v := range data { accumulator += v d = append(d, accumulator) } return d }
[ "func", "accumulate", "(", "data", "ChartUints", ")", "ChartUints", "{", "d", ":=", "make", "(", "ChartUints", ",", "0", ",", "len", "(", "data", ")", ")", "\n", "var", "accumulator", "uint64", "\n", "for", "_", ",", "v", ":=", "range", "data", "{", ...
// Each point is translated to the sum of all points before and itself.
[ "Each", "point", "is", "translated", "to", "the", "sum", "of", "all", "points", "before", "and", "itself", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/cache/charts.go#L849-L857
19,731
decred/dcrdata
db/cache/charts.go
btw
func btw(data ChartUints) ChartUints { d := make(ChartUints, 0, len(data)) dataLen := len(data) if dataLen == 0 { return d } d = append(d, 0) last := data[0] for _, v := range data[1:] { d = append(d, v-last) last = v } return d }
go
func btw(data ChartUints) ChartUints { d := make(ChartUints, 0, len(data)) dataLen := len(data) if dataLen == 0 { return d } d = append(d, 0) last := data[0] for _, v := range data[1:] { d = append(d, v-last) last = v } return d }
[ "func", "btw", "(", "data", "ChartUints", ")", "ChartUints", "{", "d", ":=", "make", "(", "ChartUints", ",", "0", ",", "len", "(", "data", ")", ")", "\n", "dataLen", ":=", "len", "(", "data", ")", "\n", "if", "dataLen", "==", "0", "{", "return", ...
// Translate the uints to a slice of the differences between each. The provided // data is assumed to be monotonically increasing. The first element is always // 0 to keep the data length unchanged.
[ "Translate", "the", "uints", "to", "a", "slice", "of", "the", "differences", "between", "each", ".", "The", "provided", "data", "is", "assumed", "to", "be", "monotonically", "increasing", ".", "The", "first", "element", "is", "always", "0", "to", "keep", "...
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/cache/charts.go#L862-L875
19,732
decred/dcrdata
db/cache/charts.go
hashrate
func hashrate(time, chainwork ChartUints) (ChartUints, ChartUints) { hrLen := len(chainwork) - HashrateAvgLength if hrLen <= 0 { return newChartUints(0), newChartUints(0) } t := make(ChartUints, 0, hrLen) y := make(ChartUints, 0, hrLen) var rotator [HashrateAvgLength]uint64 for i, work := range chainwork { i...
go
func hashrate(time, chainwork ChartUints) (ChartUints, ChartUints) { hrLen := len(chainwork) - HashrateAvgLength if hrLen <= 0 { return newChartUints(0), newChartUints(0) } t := make(ChartUints, 0, hrLen) y := make(ChartUints, 0, hrLen) var rotator [HashrateAvgLength]uint64 for i, work := range chainwork { i...
[ "func", "hashrate", "(", "time", ",", "chainwork", "ChartUints", ")", "(", "ChartUints", ",", "ChartUints", ")", "{", "hrLen", ":=", "len", "(", "chainwork", ")", "-", "HashrateAvgLength", "\n", "if", "hrLen", "<=", "0", "{", "return", "newChartUints", "("...
// hashrate converts the provided chainwork data to hashrate data. Since // hashrates are averaged over HashrateAvgLength blocks, the returned slice // is HashrateAvgLength shorter than the provided chainwork. A time slice is // required as well, and a truncated time slice with the same length as the // hashrate slice ...
[ "hashrate", "converts", "the", "provided", "chainwork", "data", "to", "hashrate", "data", ".", "Since", "hashrates", "are", "averaged", "over", "HashrateAvgLength", "blocks", "the", "returned", "slice", "is", "HashrateAvgLength", "shorter", "than", "the", "provided"...
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/cache/charts.go#L932-L953
19,733
decred/dcrdata
db/dcrpg/internal/addrstmts.go
formatGroupingQuery
func formatGroupingQuery(mainQuery, group, column string) string { if group == "all" { return fmt.Sprintf(mainQuery, column) } subQuery := fmt.Sprintf("date_trunc('%s', %s)", group, column) return fmt.Sprintf(mainQuery, subQuery) }
go
func formatGroupingQuery(mainQuery, group, column string) string { if group == "all" { return fmt.Sprintf(mainQuery, column) } subQuery := fmt.Sprintf("date_trunc('%s', %s)", group, column) return fmt.Sprintf(mainQuery, subQuery) }
[ "func", "formatGroupingQuery", "(", "mainQuery", ",", "group", ",", "column", "string", ")", "string", "{", "if", "group", "==", "\"", "\"", "{", "return", "fmt", ".", "Sprintf", "(", "mainQuery", ",", "column", ")", "\n", "}", "\n", "subQuery", ":=", ...
// Since date_trunc function doesn't have an option to group by "all" grouping, // formatGroupingQuery removes the date_trunc from the sql query as its not applicable.
[ "Since", "date_trunc", "function", "doesn", "t", "have", "an", "option", "to", "group", "by", "all", "grouping", "formatGroupingQuery", "removes", "the", "date_trunc", "from", "the", "sql", "query", "as", "its", "not", "applicable", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/internal/addrstmts.go#L380-L386
19,734
decred/dcrdata
db/cache/addresscache.go
NewBlockID
func NewBlockID(hash *chainhash.Hash, height int64) *BlockID { return &BlockID{ Hash: *hash, Height: height, } }
go
func NewBlockID(hash *chainhash.Hash, height int64) *BlockID { return &BlockID{ Hash: *hash, Height: height, } }
[ "func", "NewBlockID", "(", "hash", "*", "chainhash", ".", "Hash", ",", "height", "int64", ")", "*", "BlockID", "{", "return", "&", "BlockID", "{", "Hash", ":", "*", "hash", ",", "Height", ":", "height", ",", "}", "\n", "}" ]
// NewBlockID constructs a new BlockID.
[ "NewBlockID", "constructs", "a", "new", "BlockID", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/cache/addresscache.go#L398-L403
19,735
decred/dcrdata
db/cache/addresscache.go
BlockHash
func (d *AddressCacheItem) BlockHash() chainhash.Hash { d.mtx.RLock() defer d.mtx.RUnlock() return d.hash }
go
func (d *AddressCacheItem) BlockHash() chainhash.Hash { d.mtx.RLock() defer d.mtx.RUnlock() return d.hash }
[ "func", "(", "d", "*", "AddressCacheItem", ")", "BlockHash", "(", ")", "chainhash", ".", "Hash", "{", "d", ".", "mtx", ".", "RLock", "(", ")", "\n", "defer", "d", ".", "mtx", ".", "RUnlock", "(", ")", "\n", "return", "d", ".", "hash", "\n", "}" ]
// BlockHash is a thread-safe accessor for the block hash.
[ "BlockHash", "is", "a", "thread", "-", "safe", "accessor", "for", "the", "block", "hash", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/cache/addresscache.go#L411-L415
19,736
decred/dcrdata
db/cache/addresscache.go
BlockHeight
func (d *AddressCacheItem) BlockHeight() int64 { d.mtx.RLock() defer d.mtx.RUnlock() return d.height }
go
func (d *AddressCacheItem) BlockHeight() int64 { d.mtx.RLock() defer d.mtx.RUnlock() return d.height }
[ "func", "(", "d", "*", "AddressCacheItem", ")", "BlockHeight", "(", ")", "int64", "{", "d", ".", "mtx", ".", "RLock", "(", ")", "\n", "defer", "d", ".", "mtx", ".", "RUnlock", "(", ")", "\n", "return", "d", ".", "height", "\n", "}" ]
// BlockHeight is a thread-safe accessor for the block height.
[ "BlockHeight", "is", "a", "thread", "-", "safe", "accessor", "for", "the", "block", "height", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/cache/addresscache.go#L418-L422
19,737
decred/dcrdata
db/cache/addresscache.go
HistoryChart
func (d *AddressCacheItem) HistoryChart(addrChart dbtypes.HistoryChart, chartGrouping dbtypes.TimeBasedGrouping) (*dbtypes.ChartsData, *BlockID) { d.mtx.RLock() defer d.mtx.RUnlock() if int(chartGrouping) >= dbtypes.NumIntervals { log.Errorf("Invalid chart grouping: %v", chartGrouping) return nil, nil } var ...
go
func (d *AddressCacheItem) HistoryChart(addrChart dbtypes.HistoryChart, chartGrouping dbtypes.TimeBasedGrouping) (*dbtypes.ChartsData, *BlockID) { d.mtx.RLock() defer d.mtx.RUnlock() if int(chartGrouping) >= dbtypes.NumIntervals { log.Errorf("Invalid chart grouping: %v", chartGrouping) return nil, nil } var ...
[ "func", "(", "d", "*", "AddressCacheItem", ")", "HistoryChart", "(", "addrChart", "dbtypes", ".", "HistoryChart", ",", "chartGrouping", "dbtypes", ".", "TimeBasedGrouping", ")", "(", "*", "dbtypes", ".", "ChartsData", ",", "*", "BlockID", ")", "{", "d", ".",...
// HistoryChart is a thread-safe accessor for the TxHistory.
[ "HistoryChart", "is", "a", "thread", "-", "safe", "accessor", "for", "the", "TxHistory", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/cache/addresscache.go#L445-L466
19,738
decred/dcrdata
db/cache/addresscache.go
setBlock
func (d *AddressCacheItem) setBlock(block BlockID) { if block.Hash == d.hash { return } d.hash = block.Hash d.height = block.Height d.utxos = nil d.history.Clear() d.balance = nil d.rows = nil }
go
func (d *AddressCacheItem) setBlock(block BlockID) { if block.Hash == d.hash { return } d.hash = block.Hash d.height = block.Height d.utxos = nil d.history.Clear() d.balance = nil d.rows = nil }
[ "func", "(", "d", "*", "AddressCacheItem", ")", "setBlock", "(", "block", "BlockID", ")", "{", "if", "block", ".", "Hash", "==", "d", ".", "hash", "{", "return", "\n", "}", "\n", "d", ".", "hash", "=", "block", ".", "Hash", "\n", "d", ".", "heigh...
// setBlock ensures that the AddressCacheItem pertains to the given BlockID, // clearing any cached data if the previously set block is not equal to the // given block.
[ "setBlock", "ensures", "that", "the", "AddressCacheItem", "pertains", "to", "the", "given", "BlockID", "clearing", "any", "cached", "data", "if", "the", "previously", "set", "block", "is", "not", "equal", "to", "the", "given", "block", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/cache/addresscache.go#L551-L561
19,739
decred/dcrdata
db/cache/addresscache.go
SetRows
func (d *AddressCacheItem) SetRows(block BlockID, rows []dbtypes.AddressRowCompact) { d.mtx.Lock() defer d.mtx.Unlock() d.setBlock(block) d.rows = rows }
go
func (d *AddressCacheItem) SetRows(block BlockID, rows []dbtypes.AddressRowCompact) { d.mtx.Lock() defer d.mtx.Unlock() d.setBlock(block) d.rows = rows }
[ "func", "(", "d", "*", "AddressCacheItem", ")", "SetRows", "(", "block", "BlockID", ",", "rows", "[", "]", "dbtypes", ".", "AddressRowCompact", ")", "{", "d", ".", "mtx", ".", "Lock", "(", ")", "\n", "defer", "d", ".", "mtx", ".", "Unlock", "(", ")...
// SetRows updates the cache item for the given non-merged AddressRow slice // valid at the given BlockID.
[ "SetRows", "updates", "the", "cache", "item", "for", "the", "given", "non", "-", "merged", "AddressRow", "slice", "valid", "at", "the", "given", "BlockID", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/cache/addresscache.go#L565-L570
19,740
decred/dcrdata
db/cache/addresscache.go
SetUTXOs
func (d *AddressCacheItem) SetUTXOs(block BlockID, utxos []apitypes.AddressTxnOutput) { d.mtx.Lock() defer d.mtx.Unlock() d.setBlock(block) d.utxos = utxos }
go
func (d *AddressCacheItem) SetUTXOs(block BlockID, utxos []apitypes.AddressTxnOutput) { d.mtx.Lock() defer d.mtx.Unlock() d.setBlock(block) d.utxos = utxos }
[ "func", "(", "d", "*", "AddressCacheItem", ")", "SetUTXOs", "(", "block", "BlockID", ",", "utxos", "[", "]", "apitypes", ".", "AddressTxnOutput", ")", "{", "d", ".", "mtx", ".", "Lock", "(", ")", "\n", "defer", "d", ".", "mtx", ".", "Unlock", "(", ...
// SetUTXOs updates the cache item for the given AddressTxnOutput slice valid at // the given BlockID.
[ "SetUTXOs", "updates", "the", "cache", "item", "for", "the", "given", "AddressTxnOutput", "slice", "valid", "at", "the", "given", "BlockID", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/cache/addresscache.go#L574-L579
19,741
decred/dcrdata
db/cache/addresscache.go
SetBalance
func (d *AddressCacheItem) SetBalance(block BlockID, balance *dbtypes.AddressBalance) { d.mtx.Lock() defer d.mtx.Unlock() d.setBlock(block) d.balance = balance }
go
func (d *AddressCacheItem) SetBalance(block BlockID, balance *dbtypes.AddressBalance) { d.mtx.Lock() defer d.mtx.Unlock() d.setBlock(block) d.balance = balance }
[ "func", "(", "d", "*", "AddressCacheItem", ")", "SetBalance", "(", "block", "BlockID", ",", "balance", "*", "dbtypes", ".", "AddressBalance", ")", "{", "d", ".", "mtx", ".", "Lock", "(", ")", "\n", "defer", "d", ".", "mtx", ".", "Unlock", "(", ")", ...
// SetBalance updates the cache item for the given AddressBalance valid at the // given BlockID.
[ "SetBalance", "updates", "the", "cache", "item", "for", "the", "given", "AddressBalance", "valid", "at", "the", "given", "BlockID", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/cache/addresscache.go#L583-L588
19,742
decred/dcrdata
db/cache/addresscache.go
NewAddressCache
func NewAddressCache(rowCapacity int) *AddressCache { if rowCapacity < 0 { rowCapacity = 0 } ac := &AddressCache{ a: make(map[string]*AddressCacheItem), cap: rowCapacity, capAddr: addressCapacity, } defer func() { go ac.Reporter() }() return ac }
go
func NewAddressCache(rowCapacity int) *AddressCache { if rowCapacity < 0 { rowCapacity = 0 } ac := &AddressCache{ a: make(map[string]*AddressCacheItem), cap: rowCapacity, capAddr: addressCapacity, } defer func() { go ac.Reporter() }() return ac }
[ "func", "NewAddressCache", "(", "rowCapacity", "int", ")", "*", "AddressCache", "{", "if", "rowCapacity", "<", "0", "{", "rowCapacity", "=", "0", "\n", "}", "\n", "ac", ":=", "&", "AddressCache", "{", "a", ":", "make", "(", "map", "[", "string", "]", ...
// NewAddressCache constructs an AddressCache with capacity for the specified // number of address rows.
[ "NewAddressCache", "constructs", "an", "AddressCache", "with", "capacity", "for", "the", "specified", "number", "of", "address", "rows", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/cache/addresscache.go#L693-L704
19,743
decred/dcrdata
db/cache/addresscache.go
Reporter
func (ac *AddressCache) Reporter() { var lastBH, lastBM, lastRH, lastRM, lastUH, lastUM, lastHH, lastHM int ticker := time.NewTicker(4 * time.Second) for range ticker.C { balHits, balMisses := ac.BalanceStats() rowHits, rowMisses := ac.RowStats() utxoHits, utxoMisses := ac.UtxoStats() histHits, histMisses :=...
go
func (ac *AddressCache) Reporter() { var lastBH, lastBM, lastRH, lastRM, lastUH, lastUM, lastHH, lastHM int ticker := time.NewTicker(4 * time.Second) for range ticker.C { balHits, balMisses := ac.BalanceStats() rowHits, rowMisses := ac.RowStats() utxoHits, utxoMisses := ac.UtxoStats() histHits, histMisses :=...
[ "func", "(", "ac", "*", "AddressCache", ")", "Reporter", "(", ")", "{", "var", "lastBH", ",", "lastBM", ",", "lastRH", ",", "lastRM", ",", "lastUH", ",", "lastUM", ",", "lastHH", ",", "lastHM", "int", "\n", "ticker", ":=", "time", ".", "NewTicker", "...
// Reporter prints the number of cached addresses, rows, and utxos, as well as a // table of cache hits and misses.
[ "Reporter", "prints", "the", "number", "of", "cached", "addresses", "rows", "and", "utxos", "as", "well", "as", "a", "table", "of", "cache", "hits", "and", "misses", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/cache/addresscache.go#L728-L758
19,744
decred/dcrdata
db/cache/addresscache.go
addressCacheItem
func (ac *AddressCache) addressCacheItem(addr string) *AddressCacheItem { ac.mtx.RLock() defer ac.mtx.RUnlock() return ac.a[addr] }
go
func (ac *AddressCache) addressCacheItem(addr string) *AddressCacheItem { ac.mtx.RLock() defer ac.mtx.RUnlock() return ac.a[addr] }
[ "func", "(", "ac", "*", "AddressCache", ")", "addressCacheItem", "(", "addr", "string", ")", "*", "AddressCacheItem", "{", "ac", ".", "mtx", ".", "RLock", "(", ")", "\n", "defer", "ac", ".", "mtx", ".", "RUnlock", "(", ")", "\n", "return", "ac", ".",...
// addressCacheItem safely accesses any AddressCacheItem for the given address.
[ "addressCacheItem", "safely", "accesses", "any", "AddressCacheItem", "for", "the", "given", "address", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/cache/addresscache.go#L761-L765
19,745
decred/dcrdata
db/cache/addresscache.go
ClearAll
func (ac *AddressCache) ClearAll() (numCleared int) { ac.mtx.Lock() defer ac.mtx.Unlock() numCleared = len(ac.a) ac.a = make(map[string]*AddressCacheItem) return }
go
func (ac *AddressCache) ClearAll() (numCleared int) { ac.mtx.Lock() defer ac.mtx.Unlock() numCleared = len(ac.a) ac.a = make(map[string]*AddressCacheItem) return }
[ "func", "(", "ac", "*", "AddressCache", ")", "ClearAll", "(", ")", "(", "numCleared", "int", ")", "{", "ac", ".", "mtx", ".", "Lock", "(", ")", "\n", "defer", "ac", ".", "mtx", ".", "Unlock", "(", ")", "\n", "numCleared", "=", "len", "(", "ac", ...
// ClearAll resets AddressCache, purging all cached data.
[ "ClearAll", "resets", "AddressCache", "purging", "all", "cached", "data", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/cache/addresscache.go#L768-L774
19,746
decred/dcrdata
db/cache/addresscache.go
Clear
func (ac *AddressCache) Clear(addrs []string) (numCleared int) { if addrs == nil { return ac.ClearAll() } if len(addrs) == 0 { return } ac.mtx.Lock() defer ac.mtx.Unlock() for i := range addrs { delete(ac.a, addrs[i]) numCleared++ } return }
go
func (ac *AddressCache) Clear(addrs []string) (numCleared int) { if addrs == nil { return ac.ClearAll() } if len(addrs) == 0 { return } ac.mtx.Lock() defer ac.mtx.Unlock() for i := range addrs { delete(ac.a, addrs[i]) numCleared++ } return }
[ "func", "(", "ac", "*", "AddressCache", ")", "Clear", "(", "addrs", "[", "]", "string", ")", "(", "numCleared", "int", ")", "{", "if", "addrs", "==", "nil", "{", "return", "ac", ".", "ClearAll", "(", ")", "\n", "}", "\n", "if", "len", "(", "addrs...
// Clear purging cached data for the given addresses. If addrs is nil, all data // are cleared. If addresses is non-nil empty slice, no data are cleard.
[ "Clear", "purging", "cached", "data", "for", "the", "given", "addresses", ".", "If", "addrs", "is", "nil", "all", "data", "are", "cleared", ".", "If", "addresses", "is", "non", "-", "nil", "empty", "slice", "no", "data", "are", "cleard", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/cache/addresscache.go#L778-L792
19,747
decred/dcrdata
db/cache/addresscache.go
Balance
func (ac *AddressCache) Balance(addr string) (*dbtypes.AddressBalance, *BlockID) { aci := ac.addressCacheItem(addr) if aci == nil { ac.cacheMetrics.BalanceMiss() return nil, nil } ac.cacheMetrics.BalanceHit() return aci.Balance() }
go
func (ac *AddressCache) Balance(addr string) (*dbtypes.AddressBalance, *BlockID) { aci := ac.addressCacheItem(addr) if aci == nil { ac.cacheMetrics.BalanceMiss() return nil, nil } ac.cacheMetrics.BalanceHit() return aci.Balance() }
[ "func", "(", "ac", "*", "AddressCache", ")", "Balance", "(", "addr", "string", ")", "(", "*", "dbtypes", ".", "AddressBalance", ",", "*", "BlockID", ")", "{", "aci", ":=", "ac", ".", "addressCacheItem", "(", "addr", ")", "\n", "if", "aci", "==", "nil...
// Balance attempts to retrieve an AddressBalance for the given address. The // BlockID for the block at which the cached data is valid is also returned. In // the event of a cache miss, both returned pointers will be nil.
[ "Balance", "attempts", "to", "retrieve", "an", "AddressBalance", "for", "the", "given", "address", ".", "The", "BlockID", "for", "the", "block", "at", "which", "the", "cached", "data", "is", "valid", "is", "also", "returned", ".", "In", "the", "event", "of...
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/cache/addresscache.go#L797-L805
19,748
decred/dcrdata
db/cache/addresscache.go
HistoryChart
func (ac *AddressCache) HistoryChart(addr string, addrChart dbtypes.HistoryChart, chartGrouping dbtypes.TimeBasedGrouping) (*dbtypes.ChartsData, *BlockID) { aci := ac.addressCacheItem(addr) if aci == nil { ac.cacheMetrics.HistoryMiss() return nil, nil } cd, blockID := aci.HistoryChart(addrChart, chartGrouping...
go
func (ac *AddressCache) HistoryChart(addr string, addrChart dbtypes.HistoryChart, chartGrouping dbtypes.TimeBasedGrouping) (*dbtypes.ChartsData, *BlockID) { aci := ac.addressCacheItem(addr) if aci == nil { ac.cacheMetrics.HistoryMiss() return nil, nil } cd, blockID := aci.HistoryChart(addrChart, chartGrouping...
[ "func", "(", "ac", "*", "AddressCache", ")", "HistoryChart", "(", "addr", "string", ",", "addrChart", "dbtypes", ".", "HistoryChart", ",", "chartGrouping", "dbtypes", ".", "TimeBasedGrouping", ")", "(", "*", "dbtypes", ".", "ChartsData", ",", "*", "BlockID", ...
// HistoryChart attempts to retrieve ChartsData for the given address, chart // type, and grouping inverval. The BlockID for the block at which the cached // data is valid is also returned. In the event of a cache miss, both returned // pointers will be nil.
[ "HistoryChart", "attempts", "to", "retrieve", "ChartsData", "for", "the", "given", "address", "chart", "type", "and", "grouping", "inverval", ".", "The", "BlockID", "for", "the", "block", "at", "which", "the", "cached", "data", "is", "valid", "is", "also", "...
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/cache/addresscache.go#L824-L840
19,749
decred/dcrdata
db/cache/addresscache.go
Length
func (ac *AddressCache) Length() (numAddrs, numTxns, numUTXOs int) { ac.mtx.RLock() defer ac.mtx.RUnlock() return ac.length() }
go
func (ac *AddressCache) Length() (numAddrs, numTxns, numUTXOs int) { ac.mtx.RLock() defer ac.mtx.RUnlock() return ac.length() }
[ "func", "(", "ac", "*", "AddressCache", ")", "Length", "(", ")", "(", "numAddrs", ",", "numTxns", ",", "numUTXOs", "int", ")", "{", "ac", ".", "mtx", ".", "RLock", "(", ")", "\n", "defer", "ac", ".", "mtx", ".", "RUnlock", "(", ")", "\n", "return...
// Length returns the total number of address rows and UTXOs stored in cache.
[ "Length", "returns", "the", "total", "number", "of", "address", "rows", "and", "UTXOs", "stored", "in", "cache", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/cache/addresscache.go#L948-L952
19,750
decred/dcrdata
db/cache/addresscache.go
NumAddresses
func (ac *AddressCache) NumAddresses() int { ac.mtx.RLock() defer ac.mtx.RUnlock() return len(ac.a) }
go
func (ac *AddressCache) NumAddresses() int { ac.mtx.RLock() defer ac.mtx.RUnlock() return len(ac.a) }
[ "func", "(", "ac", "*", "AddressCache", ")", "NumAddresses", "(", ")", "int", "{", "ac", ".", "mtx", ".", "RLock", "(", ")", "\n", "defer", "ac", ".", "mtx", ".", "RUnlock", "(", ")", "\n", "return", "len", "(", "ac", ".", "a", ")", "\n", "}" ]
// NumAddresses returns the total number of addresses in the cache.
[ "NumAddresses", "returns", "the", "total", "number", "of", "addresses", "in", "the", "cache", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/cache/addresscache.go#L955-L959
19,751
decred/dcrdata
db/cache/addresscache.go
StoreRows
func (ac *AddressCache) StoreRows(addr string, rows []*dbtypes.AddressRow, block *BlockID) bool { if block == nil || ac.cap < 1 || ac.capAddr < 1 { return false } rowsCompact := []dbtypes.AddressRowCompact{} if rows != nil { rowsCompact = dbtypes.CompactRows(rows) } // respect cache capacity return ac.Stor...
go
func (ac *AddressCache) StoreRows(addr string, rows []*dbtypes.AddressRow, block *BlockID) bool { if block == nil || ac.cap < 1 || ac.capAddr < 1 { return false } rowsCompact := []dbtypes.AddressRowCompact{} if rows != nil { rowsCompact = dbtypes.CompactRows(rows) } // respect cache capacity return ac.Stor...
[ "func", "(", "ac", "*", "AddressCache", ")", "StoreRows", "(", "addr", "string", ",", "rows", "[", "]", "*", "dbtypes", ".", "AddressRow", ",", "block", "*", "BlockID", ")", "bool", "{", "if", "block", "==", "nil", "||", "ac", ".", "cap", "<", "1",...
// StoreRows stores the non-merged AddressRow slice for the given address in // cache. The current best block data is required to determine cache freshness.
[ "StoreRows", "stores", "the", "non", "-", "merged", "AddressRow", "slice", "for", "the", "given", "address", "in", "cache", ".", "The", "current", "best", "block", "data", "is", "required", "to", "determine", "cache", "freshness", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/cache/addresscache.go#L1071-L1083
19,752
decred/dcrdata
db/cache/addresscache.go
StoreHistoryChart
func (ac *AddressCache) StoreHistoryChart(addr string, addrChart dbtypes.HistoryChart, chartGrouping dbtypes.TimeBasedGrouping, cd *dbtypes.ChartsData, block *BlockID) bool { if block == nil || ac.cap < 1 || ac.capAddr < 1 { return false } if int(chartGrouping) >= dbtypes.NumIntervals { log.Errorf("Invalid cha...
go
func (ac *AddressCache) StoreHistoryChart(addr string, addrChart dbtypes.HistoryChart, chartGrouping dbtypes.TimeBasedGrouping, cd *dbtypes.ChartsData, block *BlockID) bool { if block == nil || ac.cap < 1 || ac.capAddr < 1 { return false } if int(chartGrouping) >= dbtypes.NumIntervals { log.Errorf("Invalid cha...
[ "func", "(", "ac", "*", "AddressCache", ")", "StoreHistoryChart", "(", "addr", "string", ",", "addrChart", "dbtypes", ".", "HistoryChart", ",", "chartGrouping", "dbtypes", ".", "TimeBasedGrouping", ",", "cd", "*", "dbtypes", ".", "ChartsData", ",", "block", "*...
// StoreHistoryChart stores the charts data for the given address in cache. The // current best block data is required to determine cache freshness.
[ "StoreHistoryChart", "stores", "the", "charts", "data", "for", "the", "given", "address", "in", "cache", ".", "The", "current", "best", "block", "data", "is", "required", "to", "determine", "cache", "freshness", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/cache/addresscache.go#L1087-L1130
19,753
decred/dcrdata
db/cache/addresscache.go
StoreRowsCompact
func (ac *AddressCache) StoreRowsCompact(addr string, rows []dbtypes.AddressRowCompact, block *BlockID) bool { if block == nil || ac.cap < 1 || ac.capAddr < 1 { return false } ac.mtx.Lock() defer ac.mtx.Unlock() if rows == nil { rows = []dbtypes.AddressRowCompact{} } // respect cache capacity return ac.s...
go
func (ac *AddressCache) StoreRowsCompact(addr string, rows []dbtypes.AddressRowCompact, block *BlockID) bool { if block == nil || ac.cap < 1 || ac.capAddr < 1 { return false } ac.mtx.Lock() defer ac.mtx.Unlock() if rows == nil { rows = []dbtypes.AddressRowCompact{} } // respect cache capacity return ac.s...
[ "func", "(", "ac", "*", "AddressCache", ")", "StoreRowsCompact", "(", "addr", "string", ",", "rows", "[", "]", "dbtypes", ".", "AddressRowCompact", ",", "block", "*", "BlockID", ")", "bool", "{", "if", "block", "==", "nil", "||", "ac", ".", "cap", "<",...
// StoreRowsCompact stores the non-merged AddressRow slice for the given address // in cache. The current best block data is required to determine cache // freshness.
[ "StoreRowsCompact", "stores", "the", "non", "-", "merged", "AddressRow", "slice", "for", "the", "given", "address", "in", "cache", ".", "The", "current", "best", "block", "data", "is", "required", "to", "determine", "cache", "freshness", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/cache/addresscache.go#L1135-L1149
19,754
decred/dcrdata
db/cache/addresscache.go
StoreBalance
func (ac *AddressCache) StoreBalance(addr string, balance *dbtypes.AddressBalance, block *BlockID) bool { if ac.cap < 1 || ac.capAddr < 1 { return false } ac.mtx.Lock() defer ac.mtx.Unlock() aci := ac.a[addr] if block != nil && balance == nil { balance = &dbtypes.AddressBalance{ Address: addr, } } i...
go
func (ac *AddressCache) StoreBalance(addr string, balance *dbtypes.AddressBalance, block *BlockID) bool { if ac.cap < 1 || ac.capAddr < 1 { return false } ac.mtx.Lock() defer ac.mtx.Unlock() aci := ac.a[addr] if block != nil && balance == nil { balance = &dbtypes.AddressBalance{ Address: addr, } } i...
[ "func", "(", "ac", "*", "AddressCache", ")", "StoreBalance", "(", "addr", "string", ",", "balance", "*", "dbtypes", ".", "AddressBalance", ",", "block", "*", "BlockID", ")", "bool", "{", "if", "ac", ".", "cap", "<", "1", "||", "ac", ".", "capAddr", "...
// StoreBalance stores the AddressBalance for the given address in cache. The // current best block data is required to determine cache freshness.
[ "StoreBalance", "stores", "the", "AddressBalance", "for", "the", "given", "address", "in", "cache", ".", "The", "current", "best", "block", "data", "is", "required", "to", "determine", "cache", "freshness", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/cache/addresscache.go#L1153-L1181
19,755
decred/dcrdata
db/cache/addresscache.go
StoreUTXOs
func (ac *AddressCache) StoreUTXOs(addr string, utxos []apitypes.AddressTxnOutput, block *BlockID) bool { if ac.cap < 1 || ac.capAddr < 1 { return false } // Only allow storing maxUTXOsPerAddr. if len(utxos) > maxUTXOsPerAddr && addr != ac.ProjectAddress { return false } ac.mtx.Lock() defer ac.mtx.Unlock()...
go
func (ac *AddressCache) StoreUTXOs(addr string, utxos []apitypes.AddressTxnOutput, block *BlockID) bool { if ac.cap < 1 || ac.capAddr < 1 { return false } // Only allow storing maxUTXOsPerAddr. if len(utxos) > maxUTXOsPerAddr && addr != ac.ProjectAddress { return false } ac.mtx.Lock() defer ac.mtx.Unlock()...
[ "func", "(", "ac", "*", "AddressCache", ")", "StoreUTXOs", "(", "addr", "string", ",", "utxos", "[", "]", "apitypes", ".", "AddressTxnOutput", ",", "block", "*", "BlockID", ")", "bool", "{", "if", "ac", ".", "cap", "<", "1", "||", "ac", ".", "capAddr...
// StoreUTXOs stores the AddressTxnOutput slice for the given address in cache. // The current best block data is required to determine cache freshness.
[ "StoreUTXOs", "stores", "the", "AddressTxnOutput", "slice", "for", "the", "given", "address", "in", "cache", ".", "The", "current", "best", "block", "data", "is", "required", "to", "determine", "cache", "freshness", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/cache/addresscache.go#L1185-L1216
19,756
decred/dcrdata
api/insight/converter.go
TxConverter
func (iapi *InsightApi) TxConverter(txs []*dcrjson.TxRawResult) ([]apitypes.InsightTx, error) { return iapi.DcrToInsightTxns(txs, false, false, false) }
go
func (iapi *InsightApi) TxConverter(txs []*dcrjson.TxRawResult) ([]apitypes.InsightTx, error) { return iapi.DcrToInsightTxns(txs, false, false, false) }
[ "func", "(", "iapi", "*", "InsightApi", ")", "TxConverter", "(", "txs", "[", "]", "*", "dcrjson", ".", "TxRawResult", ")", "(", "[", "]", "apitypes", ".", "InsightTx", ",", "error", ")", "{", "return", "iapi", ".", "DcrToInsightTxns", "(", "txs", ",", ...
// TxConverter converts dcrd-tx to insight tx
[ "TxConverter", "converts", "dcrd", "-", "tx", "to", "insight", "tx" ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/api/insight/converter.go#L15-L17
19,757
decred/dcrdata
api/insight/converter.go
DcrToInsightBlock
func (iapi *InsightApi) DcrToInsightBlock(inBlocks []*dcrjson.GetBlockVerboseResult) ([]*apitypes.InsightBlockResult, error) { RewardAtBlock := func(blocknum int64, voters uint16) float64 { subsidyCache := blockchain.NewSubsidyCache(0, iapi.params) work := blockchain.CalcBlockWorkSubsidy(subsidyCache, blocknum, vo...
go
func (iapi *InsightApi) DcrToInsightBlock(inBlocks []*dcrjson.GetBlockVerboseResult) ([]*apitypes.InsightBlockResult, error) { RewardAtBlock := func(blocknum int64, voters uint16) float64 { subsidyCache := blockchain.NewSubsidyCache(0, iapi.params) work := blockchain.CalcBlockWorkSubsidy(subsidyCache, blocknum, vo...
[ "func", "(", "iapi", "*", "InsightApi", ")", "DcrToInsightBlock", "(", "inBlocks", "[", "]", "*", "dcrjson", ".", "GetBlockVerboseResult", ")", "(", "[", "]", "*", "apitypes", ".", "InsightBlockResult", ",", "error", ")", "{", "RewardAtBlock", ":=", "func", ...
// DcrToInsightBlock converts a dcrjson.GetBlockVerboseResult to Insight block.
[ "DcrToInsightBlock", "converts", "a", "dcrjson", ".", "GetBlockVerboseResult", "to", "Insight", "block", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/api/insight/converter.go#L143-L174
19,758
decred/dcrdata
notification/ntfnchans.go
MakeNtfnChans
func MakeNtfnChans() { // If we're monitoring for blocks OR collecting block data, these channels // are necessary to handle new block notifications. Otherwise, leave them // as nil so that both a send (below) blocks and a receive (in // blockConnectedHandler) block. default case makes non-blocking below. // quit ...
go
func MakeNtfnChans() { // If we're monitoring for blocks OR collecting block data, these channels // are necessary to handle new block notifications. Otherwise, leave them // as nil so that both a send (below) blocks and a receive (in // blockConnectedHandler) block. default case makes non-blocking below. // quit ...
[ "func", "MakeNtfnChans", "(", ")", "{", "// If we're monitoring for blocks OR collecting block data, these channels", "// are necessary to handle new block notifications. Otherwise, leave them", "// as nil so that both a send (below) blocks and a receive (in", "// blockConnectedHandler) block. defau...
// MakeNtfnChans create notification channels based on config
[ "MakeNtfnChans", "create", "notification", "channels", "based", "on", "config" ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/notification/ntfnchans.go#L52-L91
19,759
decred/dcrdata
notification/ntfnchans.go
CloseNtfnChans
func CloseNtfnChans() { if NtfnChans.ConnectChan != nil { close(NtfnChans.ConnectChan) } if NtfnChans.ConnectChanWiredDB != nil { close(NtfnChans.ConnectChanWiredDB) } if NtfnChans.ConnectChanStakeDB != nil { close(NtfnChans.ConnectChanStakeDB) } if NtfnChans.ConnectChanDcrpgDB != nil { close(NtfnChans.C...
go
func CloseNtfnChans() { if NtfnChans.ConnectChan != nil { close(NtfnChans.ConnectChan) } if NtfnChans.ConnectChanWiredDB != nil { close(NtfnChans.ConnectChanWiredDB) } if NtfnChans.ConnectChanStakeDB != nil { close(NtfnChans.ConnectChanStakeDB) } if NtfnChans.ConnectChanDcrpgDB != nil { close(NtfnChans.C...
[ "func", "CloseNtfnChans", "(", ")", "{", "if", "NtfnChans", ".", "ConnectChan", "!=", "nil", "{", "close", "(", "NtfnChans", ".", "ConnectChan", ")", "\n", "}", "\n", "if", "NtfnChans", ".", "ConnectChanWiredDB", "!=", "nil", "{", "close", "(", "NtfnChans"...
// CloseNtfnChans close all notification channels
[ "CloseNtfnChans", "close", "all", "notification", "channels" ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/notification/ntfnchans.go#L94-L149
19,760
decred/dcrdata
db/dcrpg/upgrades_legacy.go
String
func (v CompatibilityAction) String() string { actions := map[CompatibilityAction]string{ compatRebuild: "rebuild", compatUpgrade: "upgrade", compatReindex: "reindex", compatOK: "ok", } if actionStr, ok := actions[v]; ok { return actionStr } return "unknown" }
go
func (v CompatibilityAction) String() string { actions := map[CompatibilityAction]string{ compatRebuild: "rebuild", compatUpgrade: "upgrade", compatReindex: "reindex", compatOK: "ok", } if actionStr, ok := actions[v]; ok { return actionStr } return "unknown" }
[ "func", "(", "v", "CompatibilityAction", ")", "String", "(", ")", "string", "{", "actions", ":=", "map", "[", "CompatibilityAction", "]", "string", "{", "compatRebuild", ":", "\"", "\"", ",", "compatUpgrade", ":", "\"", "\"", ",", "compatReindex", ":", "\"...
// String implements Stringer for CompatibilityAction.
[ "String", "implements", "Stringer", "for", "CompatibilityAction", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/upgrades_legacy.go#L93-L104
19,761
decred/dcrdata
db/dcrpg/upgrades_legacy.go
NewTableVersion
func NewTableVersion(major, minor, patch uint32) TableVersion { return TableVersion{major, minor, patch} }
go
func NewTableVersion(major, minor, patch uint32) TableVersion { return TableVersion{major, minor, patch} }
[ "func", "NewTableVersion", "(", "major", ",", "minor", ",", "patch", "uint32", ")", "TableVersion", "{", "return", "TableVersion", "{", "major", ",", "minor", ",", "patch", "}", "\n", "}" ]
// NewTableVersion returns a new TableVersion with the version major.minor.patch
[ "NewTableVersion", "returns", "a", "new", "TableVersion", "with", "the", "version", "major", ".", "minor", ".", "patch" ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/upgrades_legacy.go#L107-L109
19,762
decred/dcrdata
db/dcrpg/upgrades_legacy.go
CreateTablesLegacy
func CreateTablesLegacy(db *sql.DB) error { var err error for tableName, createCommand := range createLegacyTableStatements { var exists bool exists, err = TableExists(db, tableName) if err != nil { return err } tableVersion, ok := requiredVersions[tableName] if !ok { return fmt.Errorf("no version ...
go
func CreateTablesLegacy(db *sql.DB) error { var err error for tableName, createCommand := range createLegacyTableStatements { var exists bool exists, err = TableExists(db, tableName) if err != nil { return err } tableVersion, ok := requiredVersions[tableName] if !ok { return fmt.Errorf("no version ...
[ "func", "CreateTablesLegacy", "(", "db", "*", "sql", ".", "DB", ")", "error", "{", "var", "err", "error", "\n", "for", "tableName", ",", "createCommand", ":=", "range", "createLegacyTableStatements", "{", "var", "exists", "bool", "\n", "exists", ",", "err", ...
// CreateTablesLegacy creates all tables required by dcrdata if they do not // already exist.
[ "CreateTablesLegacy", "creates", "all", "tables", "required", "by", "dcrdata", "if", "they", "do", "not", "already", "exist", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/upgrades_legacy.go#L142-L173
19,763
decred/dcrdata
db/dcrpg/upgrades_legacy.go
TableUpgradesRequired
func TableUpgradesRequired(versions map[string]TableVersion) []TableUpgrade { var tableUpgrades []TableUpgrade for t := range createLegacyTableStatements { var ok bool var req, act TableVersion if req, ok = requiredVersions[t]; !ok { log.Errorf("required version unknown for table %s", t) tableUpgrades = a...
go
func TableUpgradesRequired(versions map[string]TableVersion) []TableUpgrade { var tableUpgrades []TableUpgrade for t := range createLegacyTableStatements { var ok bool var req, act TableVersion if req, ok = requiredVersions[t]; !ok { log.Errorf("required version unknown for table %s", t) tableUpgrades = a...
[ "func", "TableUpgradesRequired", "(", "versions", "map", "[", "string", "]", "TableVersion", ")", "[", "]", "TableUpgrade", "{", "var", "tableUpgrades", "[", "]", "TableUpgrade", "\n", "for", "t", ":=", "range", "createLegacyTableStatements", "{", "var", "ok", ...
// TableUpgradesRequired builds a list of table upgrade information for each // of the supported auxiliary db tables. The upgrade information includes the // table name, its current & required table versions and the action to be taken // after comparing the current & required versions.
[ "TableUpgradesRequired", "builds", "a", "list", "of", "table", "upgrade", "information", "for", "each", "of", "the", "supported", "auxiliary", "db", "tables", ".", "The", "upgrade", "information", "includes", "the", "table", "name", "its", "current", "&", "requi...
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/upgrades_legacy.go#L215-L246
19,764
decred/dcrdata
db/dcrpg/upgrades_legacy.go
TableVersions
func TableVersions(db *sql.DB) map[string]TableVersion { versions := map[string]TableVersion{} for tableName := range createLegacyTableStatements { // Retrieve the table description. var desc string err := db.QueryRow(`select obj_description($1::regclass);`, tableName).Scan(&desc) if err != nil { log.Error...
go
func TableVersions(db *sql.DB) map[string]TableVersion { versions := map[string]TableVersion{} for tableName := range createLegacyTableStatements { // Retrieve the table description. var desc string err := db.QueryRow(`select obj_description($1::regclass);`, tableName).Scan(&desc) if err != nil { log.Error...
[ "func", "TableVersions", "(", "db", "*", "sql", ".", "DB", ")", "map", "[", "string", "]", "TableVersion", "{", "versions", ":=", "map", "[", "string", "]", "TableVersion", "{", "}", "\n", "for", "tableName", ":=", "range", "createLegacyTableStatements", "...
// TableVersions retrieve and maps the tables names in the auxiliary db to their // current table versions.
[ "TableVersions", "retrieve", "and", "maps", "the", "tables", "names", "in", "the", "auxiliary", "db", "to", "their", "current", "table", "versions", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/upgrades_legacy.go#L250-L272
19,765
decred/dcrdata
db/dcrpg/upgrades_legacy.go
VersionCheck
func (pgb *ChainDB) VersionCheck(client BlockGetter) error { vers := TableVersions(pgb.db) for tab, ver := range vers { log.Debugf("Table %s: v%s", tab, ver) } var needsUpgrade []TableUpgrade tableUpgrades := TableUpgradesRequired(vers) for _, val := range tableUpgrades { switch val.UpgradeType { case com...
go
func (pgb *ChainDB) VersionCheck(client BlockGetter) error { vers := TableVersions(pgb.db) for tab, ver := range vers { log.Debugf("Table %s: v%s", tab, ver) } var needsUpgrade []TableUpgrade tableUpgrades := TableUpgradesRequired(vers) for _, val := range tableUpgrades { switch val.UpgradeType { case com...
[ "func", "(", "pgb", "*", "ChainDB", ")", "VersionCheck", "(", "client", "BlockGetter", ")", "error", "{", "vers", ":=", "TableVersions", "(", "pgb", ".", "db", ")", "\n", "for", "tab", ",", "ver", ":=", "range", "vers", "{", "log", ".", "Debugf", "("...
// VersionCheck checks the current version of all known tables and notifies when // an upgrade is required. If there is no automatic upgrade supported, an error // is returned when any table is not of the correct version. An RPC client is // passed to implement the supported upgrades if need be.
[ "VersionCheck", "checks", "the", "current", "version", "of", "all", "known", "tables", "and", "notifies", "when", "an", "upgrade", "is", "required", ".", "If", "there", "is", "no", "automatic", "upgrade", "supported", "an", "error", "is", "returned", "when", ...
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/upgrades_legacy.go#L328-L364
19,766
decred/dcrdata
db/dcrpg/upgrades_legacy.go
initiatePgUpgrade
func (pgb *ChainDB) initiatePgUpgrade(client BlockGetter, theseUpgrades []TableUpgradeType) (bool, error) { for it := range theseUpgrades { upgradeSuccess, err := pgb.handleUpgrades(client, theseUpgrades[it].upgradeType) if err != nil || !upgradeSuccess { return false, fmt.Errorf("failed to upgrade %s table to ...
go
func (pgb *ChainDB) initiatePgUpgrade(client BlockGetter, theseUpgrades []TableUpgradeType) (bool, error) { for it := range theseUpgrades { upgradeSuccess, err := pgb.handleUpgrades(client, theseUpgrades[it].upgradeType) if err != nil || !upgradeSuccess { return false, fmt.Errorf("failed to upgrade %s table to ...
[ "func", "(", "pgb", "*", "ChainDB", ")", "initiatePgUpgrade", "(", "client", "BlockGetter", ",", "theseUpgrades", "[", "]", "TableUpgradeType", ")", "(", "bool", ",", "error", ")", "{", "for", "it", ":=", "range", "theseUpgrades", "{", "upgradeSuccess", ",",...
// initiatePgUpgrade starts the specific auxiliary database.
[ "initiatePgUpgrade", "starts", "the", "specific", "auxiliary", "database", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/upgrades_legacy.go#L724-L738
19,767
decred/dcrdata
db/dcrpg/upgrades_legacy.go
dropBlockTimeIndexes
func (pgb *ChainDB) dropBlockTimeIndexes() { log.Info("Dropping block time indexes") err := DeindexBlockTimeOnTableAddress(pgb.db) if err != nil { log.Warnf("DeindexBlockTimeOnTableAddress failed: error: %v", err) } }
go
func (pgb *ChainDB) dropBlockTimeIndexes() { log.Info("Dropping block time indexes") err := DeindexBlockTimeOnTableAddress(pgb.db) if err != nil { log.Warnf("DeindexBlockTimeOnTableAddress failed: error: %v", err) } }
[ "func", "(", "pgb", "*", "ChainDB", ")", "dropBlockTimeIndexes", "(", ")", "{", "log", ".", "Info", "(", "\"", "\"", ")", "\n", "err", ":=", "DeindexBlockTimeOnTableAddress", "(", "pgb", ".", "db", ")", "\n", "if", "err", "!=", "nil", "{", "log", "."...
// dropBlockTimeIndexes drops all indexes that are likely to slow down the db // upgrade.
[ "dropBlockTimeIndexes", "drops", "all", "indexes", "that", "are", "likely", "to", "slow", "down", "the", "db", "upgrade", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/upgrades_legacy.go#L1097-L1103
19,768
decred/dcrdata
db/dcrpg/upgrades_legacy.go
createBlockTimeIndexes
func (pgb *ChainDB) createBlockTimeIndexes() { log.Info("Creating the dropped block time indexes") err := IndexBlockTimeOnTableAddress(pgb.db) if err != nil { log.Warnf("IndexBlockTimeOnTableAddress failed: error: %v", err) } }
go
func (pgb *ChainDB) createBlockTimeIndexes() { log.Info("Creating the dropped block time indexes") err := IndexBlockTimeOnTableAddress(pgb.db) if err != nil { log.Warnf("IndexBlockTimeOnTableAddress failed: error: %v", err) } }
[ "func", "(", "pgb", "*", "ChainDB", ")", "createBlockTimeIndexes", "(", ")", "{", "log", ".", "Info", "(", "\"", "\"", ")", "\n", "err", ":=", "IndexBlockTimeOnTableAddress", "(", "pgb", ".", "db", ")", "\n", "if", "err", "!=", "nil", "{", "log", "."...
// CreateBlockTimeIndexes creates back all the dropped indexes.
[ "CreateBlockTimeIndexes", "creates", "back", "all", "the", "dropped", "indexes", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/upgrades_legacy.go#L1106-L1112
19,769
decred/dcrdata
db/dcrpg/upgrades_legacy.go
updateAllVotesMainchain
func updateAllVotesMainchain(db *sql.DB) (rowsUpdated int64, err error) { return sqlExec(db, internal.UpdateVotesMainchainAll, "failed to update votes and mainchain status") }
go
func updateAllVotesMainchain(db *sql.DB) (rowsUpdated int64, err error) { return sqlExec(db, internal.UpdateVotesMainchainAll, "failed to update votes and mainchain status") }
[ "func", "updateAllVotesMainchain", "(", "db", "*", "sql", ".", "DB", ")", "(", "rowsUpdated", "int64", ",", "err", "error", ")", "{", "return", "sqlExec", "(", "db", ",", "internal", ".", "UpdateVotesMainchainAll", ",", "\"", "\"", ")", "\n", "}" ]
// updateAllVotesMainchain sets is_mainchain for all votes according to their // containing block.
[ "updateAllVotesMainchain", "sets", "is_mainchain", "for", "all", "votes", "according", "to", "their", "containing", "block", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/upgrades_legacy.go#L1360-L1363
19,770
decred/dcrdata
db/dcrpg/upgrades_legacy.go
updateAllTicketsMainchain
func updateAllTicketsMainchain(db *sql.DB) (rowsUpdated int64, err error) { return sqlExec(db, internal.UpdateTicketsMainchainAll, "failed to update tickets and mainchain status") }
go
func updateAllTicketsMainchain(db *sql.DB) (rowsUpdated int64, err error) { return sqlExec(db, internal.UpdateTicketsMainchainAll, "failed to update tickets and mainchain status") }
[ "func", "updateAllTicketsMainchain", "(", "db", "*", "sql", ".", "DB", ")", "(", "rowsUpdated", "int64", ",", "err", "error", ")", "{", "return", "sqlExec", "(", "db", ",", "internal", ".", "UpdateTicketsMainchainAll", ",", "\"", "\"", ")", "\n", "}" ]
// updateAllTicketsMainchain sets is_mainchain for all tickets according to // their containing block.
[ "updateAllTicketsMainchain", "sets", "is_mainchain", "for", "all", "tickets", "according", "to", "their", "containing", "block", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/upgrades_legacy.go#L1367-L1370
19,771
decred/dcrdata
db/dcrpg/upgrades_legacy.go
updateAllTxnsValidMainchain
func updateAllTxnsValidMainchain(db *sql.DB) (rowsUpdated int64, err error) { rowsUpdated, err = sqlExec(db, internal.UpdateRegularTxnsValidAll, "failed to update regular transactions' validity status") if err != nil { return } return sqlExec(db, internal.UpdateTxnsMainchainAll, "failed to update all transact...
go
func updateAllTxnsValidMainchain(db *sql.DB) (rowsUpdated int64, err error) { rowsUpdated, err = sqlExec(db, internal.UpdateRegularTxnsValidAll, "failed to update regular transactions' validity status") if err != nil { return } return sqlExec(db, internal.UpdateTxnsMainchainAll, "failed to update all transact...
[ "func", "updateAllTxnsValidMainchain", "(", "db", "*", "sql", ".", "DB", ")", "(", "rowsUpdated", "int64", ",", "err", "error", ")", "{", "rowsUpdated", ",", "err", "=", "sqlExec", "(", "db", ",", "internal", ".", "UpdateRegularTxnsValidAll", ",", "\"", "\...
// updateAllTxnsValidMainchain sets is_mainchain and is_valid for all // transactions according to their containing block.
[ "updateAllTxnsValidMainchain", "sets", "is_mainchain", "and", "is_valid", "for", "all", "transactions", "according", "to", "their", "containing", "block", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/upgrades_legacy.go#L1374-L1382
19,772
decred/dcrdata
db/dcrpg/upgrades_legacy.go
updateAllAddressesValidMainchain
func updateAllAddressesValidMainchain(db *sql.DB) (rowsUpdated int64, err error) { return sqlExec(db, internal.UpdateValidMainchainFromTransactions, "failed to update addresses rows valid_mainchain status") }
go
func updateAllAddressesValidMainchain(db *sql.DB) (rowsUpdated int64, err error) { return sqlExec(db, internal.UpdateValidMainchainFromTransactions, "failed to update addresses rows valid_mainchain status") }
[ "func", "updateAllAddressesValidMainchain", "(", "db", "*", "sql", ".", "DB", ")", "(", "rowsUpdated", "int64", ",", "err", "error", ")", "{", "return", "sqlExec", "(", "db", ",", "internal", ".", "UpdateValidMainchainFromTransactions", ",", "\"", "\"", ")", ...
// updateAllAddressesValidMainchain sets valid_mainchain for all addresses table // rows according to their corresponding transaction.
[ "updateAllAddressesValidMainchain", "sets", "valid_mainchain", "for", "all", "addresses", "table", "rows", "according", "to", "their", "corresponding", "transaction", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/upgrades_legacy.go#L1386-L1389
19,773
decred/dcrdata
db/dcrpg/upgrades_legacy.go
updateAddressesValidMainchainPatch
func updateAddressesValidMainchainPatch(db *sql.DB) (rowsUpdated int64, err error) { return sqlExec(db, internal.UpdateAddressesGloballyInvalid, "failed to update addresses rows valid_mainchain status") }
go
func updateAddressesValidMainchainPatch(db *sql.DB) (rowsUpdated int64, err error) { return sqlExec(db, internal.UpdateAddressesGloballyInvalid, "failed to update addresses rows valid_mainchain status") }
[ "func", "updateAddressesValidMainchainPatch", "(", "db", "*", "sql", ".", "DB", ")", "(", "rowsUpdated", "int64", ",", "err", "error", ")", "{", "return", "sqlExec", "(", "db", ",", "internal", ".", "UpdateAddressesGloballyInvalid", ",", "\"", "\"", ")", "\n...
// updateAddressesValidMainchainPatch selectively sets valid_mainchain for // addresses table rows that are set incorrectly according to their // corresponding transaction.
[ "updateAddressesValidMainchainPatch", "selectively", "sets", "valid_mainchain", "for", "addresses", "table", "rows", "that", "are", "set", "incorrectly", "according", "to", "their", "corresponding", "transaction", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/upgrades_legacy.go#L1394-L1397
19,774
decred/dcrdata
db/dcrpg/upgrades_legacy.go
updateAddressesMatchingTxHashPatch
func updateAddressesMatchingTxHashPatch(db *sql.DB) (rowsUpdated int64, err error) { return sqlExec(db, internal.UpdateAddressesFundingMatchingHash, "failed to update addresses rows matching_tx_hash") }
go
func updateAddressesMatchingTxHashPatch(db *sql.DB) (rowsUpdated int64, err error) { return sqlExec(db, internal.UpdateAddressesFundingMatchingHash, "failed to update addresses rows matching_tx_hash") }
[ "func", "updateAddressesMatchingTxHashPatch", "(", "db", "*", "sql", ".", "DB", ")", "(", "rowsUpdated", "int64", ",", "err", "error", ")", "{", "return", "sqlExec", "(", "db", ",", "internal", ".", "UpdateAddressesFundingMatchingHash", ",", "\"", "\"", ")", ...
// updateAddressesMatchingTxHashPatch selectively sets matching_tx_hash for // addresses table rows that are set incorrectly according to their // corresponding transaction.
[ "updateAddressesMatchingTxHashPatch", "selectively", "sets", "matching_tx_hash", "for", "addresses", "table", "rows", "that", "are", "set", "incorrectly", "according", "to", "their", "corresponding", "transaction", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/upgrades_legacy.go#L1402-L1405
19,775
decred/dcrdata
db/dcrpg/upgrades_legacy.go
handleBlocksTableMainchainUpgrade
func (pgb *ChainDB) handleBlocksTableMainchainUpgrade(bestBlock string) (int64, error) { // Start at best block, upgrade, and move to previous block. Stop after // genesis, which previous block hash is the zero hash. var blocksUpdated int64 previousHash, thisBlockHash := bestBlock, bestBlock for !bytes.Equal(zeroH...
go
func (pgb *ChainDB) handleBlocksTableMainchainUpgrade(bestBlock string) (int64, error) { // Start at best block, upgrade, and move to previous block. Stop after // genesis, which previous block hash is the zero hash. var blocksUpdated int64 previousHash, thisBlockHash := bestBlock, bestBlock for !bytes.Equal(zeroH...
[ "func", "(", "pgb", "*", "ChainDB", ")", "handleBlocksTableMainchainUpgrade", "(", "bestBlock", "string", ")", "(", "int64", ",", "error", ")", "{", "// Start at best block, upgrade, and move to previous block. Stop after", "// genesis, which previous block hash is the zero hash....
// handleBlocksTableMainchainUpgrade sets is_mainchain=true for all blocks in // the main chain, starting with the best block and working back to genesis.
[ "handleBlocksTableMainchainUpgrade", "sets", "is_mainchain", "=", "true", "for", "all", "blocks", "in", "the", "main", "chain", "starting", "with", "the", "best", "block", "and", "working", "back", "to", "genesis", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/upgrades_legacy.go#L1409-L1438
19,776
decred/dcrdata
db/dcrpg/upgrades_legacy.go
handlevinsTableCoinSupplyUpgrade
func (pgb *ChainDB) handlevinsTableCoinSupplyUpgrade(msgBlock *wire.MsgBlock) (int64, error) { var isValid bool var rowsUpdated int64 var err = pgb.db.QueryRow(`SELECT is_valid, is_mainchain FROM blocks WHERE hash = $1 ;`, msgBlock.BlockHash().String()).Scan(&isValid) if err != nil { return 0, err } // isMa...
go
func (pgb *ChainDB) handlevinsTableCoinSupplyUpgrade(msgBlock *wire.MsgBlock) (int64, error) { var isValid bool var rowsUpdated int64 var err = pgb.db.QueryRow(`SELECT is_valid, is_mainchain FROM blocks WHERE hash = $1 ;`, msgBlock.BlockHash().String()).Scan(&isValid) if err != nil { return 0, err } // isMa...
[ "func", "(", "pgb", "*", "ChainDB", ")", "handlevinsTableCoinSupplyUpgrade", "(", "msgBlock", "*", "wire", ".", "MsgBlock", ")", "(", "int64", ",", "error", ")", "{", "var", "isValid", "bool", "\n", "var", "rowsUpdated", "int64", "\n\n", "var", "err", "=",...
// handlevinsTableCoinSupplyUpgrade implements the upgrade to the new newly added columns // in the vins table. The new columns are mainly used for the coin supply chart. // If all the new columns are not added, quit the db upgrade.
[ "handlevinsTableCoinSupplyUpgrade", "implements", "the", "upgrade", "to", "the", "new", "newly", "added", "columns", "in", "the", "vins", "table", ".", "The", "new", "columns", "are", "mainly", "used", "for", "the", "coin", "supply", "chart", ".", "If", "all",...
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/upgrades_legacy.go#L1450-L1485
19,777
decred/dcrdata
db/dcrpg/upgrades_legacy.go
handleAgendasTableUpgrade
func (pgb *ChainDB) handleAgendasTableUpgrade(msgBlock *wire.MsgBlock) (int64, error) { // neither isValid or isMainchain are important dbTxns, _, _ := dbtypes.ExtractBlockTransactions(msgBlock, wire.TxTreeStake, pgb.chainParams, true, false) var rowsUpdated int64 for i, tx := range dbTxns { if tx.TxType != in...
go
func (pgb *ChainDB) handleAgendasTableUpgrade(msgBlock *wire.MsgBlock) (int64, error) { // neither isValid or isMainchain are important dbTxns, _, _ := dbtypes.ExtractBlockTransactions(msgBlock, wire.TxTreeStake, pgb.chainParams, true, false) var rowsUpdated int64 for i, tx := range dbTxns { if tx.TxType != in...
[ "func", "(", "pgb", "*", "ChainDB", ")", "handleAgendasTableUpgrade", "(", "msgBlock", "*", "wire", ".", "MsgBlock", ")", "(", "int64", ",", "error", ")", "{", "// neither isValid or isMainchain are important", "dbTxns", ",", "_", ",", "_", ":=", "dbtypes", "....
// handleAgendasTableUpgrade implements the upgrade to the newly added agenda table.
[ "handleAgendasTableUpgrade", "implements", "the", "upgrade", "to", "the", "newly", "added", "agenda", "table", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/upgrades_legacy.go#L1488-L1531
19,778
decred/dcrdata
db/dcrpg/upgrades_legacy.go
handleAgendaAndAgendaVotesTablesUpgrade
func (pgb *ChainDB) handleAgendaAndAgendaVotesTablesUpgrade(msgBlock *wire.MsgBlock) (int64, error) { // neither isValid or isMainchain are important dbTxns, _, _ := dbtypes.ExtractBlockTransactions(msgBlock, wire.TxTreeStake, pgb.chainParams, true, false) var rowsUpdated int64 query := `UPDATE votes SET block_t...
go
func (pgb *ChainDB) handleAgendaAndAgendaVotesTablesUpgrade(msgBlock *wire.MsgBlock) (int64, error) { // neither isValid or isMainchain are important dbTxns, _, _ := dbtypes.ExtractBlockTransactions(msgBlock, wire.TxTreeStake, pgb.chainParams, true, false) var rowsUpdated int64 query := `UPDATE votes SET block_t...
[ "func", "(", "pgb", "*", "ChainDB", ")", "handleAgendaAndAgendaVotesTablesUpgrade", "(", "msgBlock", "*", "wire", ".", "MsgBlock", ")", "(", "int64", ",", "error", ")", "{", "// neither isValid or isMainchain are important", "dbTxns", ",", "_", ",", "_", ":=", "...
// handleAgendaAndAgendaVotesTableUpgrade restructures the agendas table, creates // a new agenda_votes table and adds a new block time column to votes table.
[ "handleAgendaAndAgendaVotesTableUpgrade", "restructures", "the", "agendas", "table", "creates", "a", "new", "agenda_votes", "table", "and", "adds", "a", "new", "block", "time", "column", "to", "votes", "table", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/upgrades_legacy.go#L1535-L1590
19,779
decred/dcrdata
db/dcrpg/upgrades_legacy.go
haveEmptyAgendasTable
func haveEmptyAgendasTable(db *sql.DB) (bool, error) { var isExists int var err = db.QueryRow(`SELECT COUNT(*) FROM agendas;`).Scan(&isExists) if err != nil { return false, err } if isExists != 0 { return false, nil } return true, nil }
go
func haveEmptyAgendasTable(db *sql.DB) (bool, error) { var isExists int var err = db.QueryRow(`SELECT COUNT(*) FROM agendas;`).Scan(&isExists) if err != nil { return false, err } if isExists != 0 { return false, nil } return true, nil }
[ "func", "haveEmptyAgendasTable", "(", "db", "*", "sql", ".", "DB", ")", "(", "bool", ",", "error", ")", "{", "var", "isExists", "int", "\n", "var", "err", "=", "db", ".", "QueryRow", "(", "`SELECT COUNT(*) FROM agendas;`", ")", ".", "Scan", "(", "&", "...
// haveEmptyAgendasTable checks if the agendas table is empty. If the agenda // table exists bool false is returned otherwise bool true is returned. // If the table is not empty then this upgrade doesn't proceed.
[ "haveEmptyAgendasTable", "checks", "if", "the", "agendas", "table", "is", "empty", ".", "If", "the", "agenda", "table", "exists", "bool", "false", "is", "returned", "otherwise", "bool", "true", "is", "returned", ".", "If", "the", "table", "is", "not", "empty...
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/upgrades_legacy.go#L1595-L1607
19,780
decred/dcrdata
db/dcrpg/upgrades_legacy.go
versionAllTables
func versionAllTables(db *sql.DB, version TableVersion) error { for tableName := range createLegacyTableStatements { _, err := db.Exec(fmt.Sprintf(`COMMENT ON TABLE %s IS 'v%s';`, tableName, version)) if err != nil { return err } log.Infof("Modified the %v table version to %v", tableName, version) } r...
go
func versionAllTables(db *sql.DB, version TableVersion) error { for tableName := range createLegacyTableStatements { _, err := db.Exec(fmt.Sprintf(`COMMENT ON TABLE %s IS 'v%s';`, tableName, version)) if err != nil { return err } log.Infof("Modified the %v table version to %v", tableName, version) } r...
[ "func", "versionAllTables", "(", "db", "*", "sql", ".", "DB", ",", "version", "TableVersion", ")", "error", "{", "for", "tableName", ":=", "range", "createLegacyTableStatements", "{", "_", ",", "err", ":=", "db", ".", "Exec", "(", "fmt", ".", "Sprintf", ...
// versionAllTables comments the tables with the upgraded table version.
[ "versionAllTables", "comments", "the", "tables", "with", "the", "upgraded", "table", "version", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/upgrades_legacy.go#L1865-L1876
19,781
decred/dcrdata
db/dcrpg/upgrades_legacy.go
verifyChainWork
func verifyChainWork(client BlockGetter, db *sql.DB) (int64, error) { // Count rows with missing chainWork. var count int64 countRow := db.QueryRow(`SELECT COUNT(hash) FROM blocks WHERE chainwork = '0';`) err := countRow.Scan(&count) if err != nil { log.Error("Failed to count null chainwork columns: %v", err) ...
go
func verifyChainWork(client BlockGetter, db *sql.DB) (int64, error) { // Count rows with missing chainWork. var count int64 countRow := db.QueryRow(`SELECT COUNT(hash) FROM blocks WHERE chainwork = '0';`) err := countRow.Scan(&count) if err != nil { log.Error("Failed to count null chainwork columns: %v", err) ...
[ "func", "verifyChainWork", "(", "client", "BlockGetter", ",", "db", "*", "sql", ".", "DB", ")", "(", "int64", ",", "error", ")", "{", "// Count rows with missing chainWork.", "var", "count", "int64", "\n", "countRow", ":=", "db", ".", "QueryRow", "(", "`SELE...
// verifyChainWork fetches and inserts missing chainwork values. // This addresses a table update done at DB version 3.7.0.
[ "verifyChainWork", "fetches", "and", "inserts", "missing", "chainwork", "values", ".", "This", "addresses", "a", "table", "update", "done", "at", "DB", "version", "3", ".", "7", ".", "0", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/upgrades_legacy.go#L1880-L1959
19,782
decred/dcrdata
gov/politeia/types/types.go
VotesStatuses
func VotesStatuses() map[VoteStatusType]string { m := make(map[VoteStatusType]string) for k, val := range ShorterDesc { if k == piapi.PropVoteStatusInvalid || k == piapi.PropVoteStatusDoesntExist { continue } m[VoteStatusType(k)] = val } return m }
go
func VotesStatuses() map[VoteStatusType]string { m := make(map[VoteStatusType]string) for k, val := range ShorterDesc { if k == piapi.PropVoteStatusInvalid || k == piapi.PropVoteStatusDoesntExist { continue } m[VoteStatusType(k)] = val } return m }
[ "func", "VotesStatuses", "(", ")", "map", "[", "VoteStatusType", "]", "string", "{", "m", ":=", "make", "(", "map", "[", "VoteStatusType", "]", "string", ")", "\n", "for", "k", ",", "val", ":=", "range", "ShorterDesc", "{", "if", "k", "==", "piapi", ...
// VotesStatuses returns the ShorterDesc map contents exclusive of Invalid and // Doesn't exist statuses.
[ "VotesStatuses", "returns", "the", "ShorterDesc", "map", "contents", "exclusive", "of", "Invalid", "and", "Doesn", "t", "exist", "statuses", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/gov/politeia/types/types.go#L181-L191
19,783
decred/dcrdata
gov/politeia/types/types.go
IsEqual
func (a *ProposalInfo) IsEqual(b *ProposalInfo) bool { if a.CensorshipRecord != b.CensorshipRecord || a.Name != b.Name || a.State != b.State || a.NumComments != b.NumComments || a.StatusChangeMsg != b.StatusChangeMsg || a.Status != b.Status || a.Timestamp != b.Timestamp || a.Token != b.Token || a.CensoredDate !=...
go
func (a *ProposalInfo) IsEqual(b *ProposalInfo) bool { if a.CensorshipRecord != b.CensorshipRecord || a.Name != b.Name || a.State != b.State || a.NumComments != b.NumComments || a.StatusChangeMsg != b.StatusChangeMsg || a.Status != b.Status || a.Timestamp != b.Timestamp || a.Token != b.Token || a.CensoredDate !=...
[ "func", "(", "a", "*", "ProposalInfo", ")", "IsEqual", "(", "b", "*", "ProposalInfo", ")", "bool", "{", "if", "a", ".", "CensorshipRecord", "!=", "b", ".", "CensorshipRecord", "||", "a", ".", "Name", "!=", "b", ".", "Name", "||", "a", ".", "State", ...
// IsEqual compares CensorshipRecord, Name, State, NumComments, StatusChangeMsg, // Timestamp, CensoredDate, AbandonedDate, PublishedDate, Token, VoteStatus, // TotalVotes and count of VoteResults between the two ProposalsInfo structs passed.
[ "IsEqual", "compares", "CensorshipRecord", "Name", "State", "NumComments", "StatusChangeMsg", "Timestamp", "CensoredDate", "AbandonedDate", "PublishedDate", "Token", "VoteStatus", "TotalVotes", "and", "count", "of", "VoteResults", "between", "the", "two", "ProposalsInfo", ...
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/gov/politeia/types/types.go#L196-L206
19,784
decred/dcrdata
main.go
FileServer
func FileServer(r chi.Router, pathRoot, fsRoot string, cacheControlMaxAge int64) { if strings.ContainsAny(pathRoot, "{}*") { panic("FileServer does not permit URL parameters.") } // Define a http.HandlerFunc to serve files but not directory indexes. hf := func(w http.ResponseWriter, r *http.Request) { // Ensur...
go
func FileServer(r chi.Router, pathRoot, fsRoot string, cacheControlMaxAge int64) { if strings.ContainsAny(pathRoot, "{}*") { panic("FileServer does not permit URL parameters.") } // Define a http.HandlerFunc to serve files but not directory indexes. hf := func(w http.ResponseWriter, r *http.Request) { // Ensur...
[ "func", "FileServer", "(", "r", "chi", ".", "Router", ",", "pathRoot", ",", "fsRoot", "string", ",", "cacheControlMaxAge", "int64", ")", "{", "if", "strings", ".", "ContainsAny", "(", "pathRoot", ",", "\"", "\"", ")", "{", "panic", "(", "\"", "\"", ")"...
// FileServer conveniently sets up a http.FileServer handler to serve static // files from path on the file system. Directory listings are denied, as are URL // paths containing "..".
[ "FileServer", "conveniently", "sets", "up", "a", "http", ".", "FileServer", "handler", "to", "serve", "static", "files", "from", "path", "on", "the", "file", "system", ".", "Directory", "listings", "are", "denied", "as", "are", "URL", "paths", "containing", ...
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/main.go#L1350-L1404
19,785
decred/dcrdata
api/insight/apimiddleware.go
StatusInfoCtx
func (iapi *InsightApi) StatusInfoCtx(next http.Handler) http.Handler { return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { ctx := m.StatusInfoCtx(r, iapi.BlockData.ChainDB) next.ServeHTTP(w, r.WithContext(ctx)) }) }
go
func (iapi *InsightApi) StatusInfoCtx(next http.Handler) http.Handler { return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { ctx := m.StatusInfoCtx(r, iapi.BlockData.ChainDB) next.ServeHTTP(w, r.WithContext(ctx)) }) }
[ "func", "(", "iapi", "*", "InsightApi", ")", "StatusInfoCtx", "(", "next", "http", ".", "Handler", ")", "http", ".", "Handler", "{", "return", "http", ".", "HandlerFunc", "(", "func", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "http", ".",...
// StatusInfoCtx is a middleware that embeds into the request context the data // for the "?q=x" URL query, where x is "getInfo" or "getDifficulty" or // "getBestBlockHash" or "getLastBlockHash".
[ "StatusInfoCtx", "is", "a", "middleware", "that", "embeds", "into", "the", "request", "context", "the", "data", "for", "the", "?q", "=", "x", "URL", "query", "where", "x", "is", "getInfo", "or", "getDifficulty", "or", "getBestBlockHash", "or", "getLastBlockHas...
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/api/insight/apimiddleware.go#L46-L52
19,786
decred/dcrdata
api/insight/apimiddleware.go
ValidatePostCtx
func (iapi *InsightApi) ValidatePostCtx(next http.Handler) http.Handler { return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { contentLengthString := r.Header.Get("Content-Length") contentLength, err := strconv.Atoi(contentLengthString) if err != nil { writeInsightError(w, "Content-Length He...
go
func (iapi *InsightApi) ValidatePostCtx(next http.Handler) http.Handler { return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { contentLengthString := r.Header.Get("Content-Length") contentLength, err := strconv.Atoi(contentLengthString) if err != nil { writeInsightError(w, "Content-Length He...
[ "func", "(", "iapi", "*", "InsightApi", ")", "ValidatePostCtx", "(", "next", "http", ".", "Handler", ")", "http", ".", "Handler", "{", "return", "http", ".", "HandlerFunc", "(", "func", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "http", "....
// ValidatePostCtx will confirm Post content length is valid.
[ "ValidatePostCtx", "will", "confirm", "Post", "content", "length", "is", "valid", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/api/insight/apimiddleware.go#L148-L166
19,787
decred/dcrdata
api/insight/apimiddleware.go
PostAddrsTxsCtx
func PostAddrsTxsCtx(next http.Handler) http.Handler { return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { var req apitypes.InsightMultiAddrsTx var from, to, noAsm, noScriptSig, noSpent int64 body, err := ioutil.ReadAll(r.Body) r.Body.Close() if err != nil { writeInsightError(w, fmt.Sp...
go
func PostAddrsTxsCtx(next http.Handler) http.Handler { return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { var req apitypes.InsightMultiAddrsTx var from, to, noAsm, noScriptSig, noSpent int64 body, err := ioutil.ReadAll(r.Body) r.Body.Close() if err != nil { writeInsightError(w, fmt.Sp...
[ "func", "PostAddrsTxsCtx", "(", "next", "http", ".", "Handler", ")", "http", ".", "Handler", "{", "return", "http", ".", "HandlerFunc", "(", "func", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "http", ".", "Request", ")", "{", "var", "req",...
// PostAddrsTxsCtx middleware processes parameters given in the POST request // body for an addrs endpoint.
[ "PostAddrsTxsCtx", "middleware", "processes", "parameters", "given", "in", "the", "POST", "request", "body", "for", "an", "addrs", "endpoint", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/api/insight/apimiddleware.go#L170-L223
19,788
decred/dcrdata
api/insight/apimiddleware.go
PostAddrsUtxoCtx
func PostAddrsUtxoCtx(next http.Handler) http.Handler { return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { req := apitypes.InsightAddr{} body, err := ioutil.ReadAll(r.Body) r.Body.Close() if err != nil { writeInsightError(w, fmt.Sprintf("error reading JSON message: %v", err)) return ...
go
func PostAddrsUtxoCtx(next http.Handler) http.Handler { return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { req := apitypes.InsightAddr{} body, err := ioutil.ReadAll(r.Body) r.Body.Close() if err != nil { writeInsightError(w, fmt.Sprintf("error reading JSON message: %v", err)) return ...
[ "func", "PostAddrsUtxoCtx", "(", "next", "http", ".", "Handler", ")", "http", ".", "Handler", "{", "return", "http", ".", "HandlerFunc", "(", "func", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "http", ".", "Request", ")", "{", "req", ":=",...
// PostAddrsUtxoCtx middleware processes parameters given in the POST request // body for an addrs utxo endpoint.
[ "PostAddrsUtxoCtx", "middleware", "processes", "parameters", "given", "in", "the", "POST", "request", "body", "for", "an", "addrs", "utxo", "endpoint", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/api/insight/apimiddleware.go#L227-L248
19,789
decred/dcrdata
api/insight/apimiddleware.go
GetAddressCommandCtx
func GetAddressCommandCtx(r *http.Request) (string, bool) { command, ok := r.Context().Value(ctxAddrCmd).(string) if !ok { return "", false } return command, true }
go
func GetAddressCommandCtx(r *http.Request) (string, bool) { command, ok := r.Context().Value(ctxAddrCmd).(string) if !ok { return "", false } return command, true }
[ "func", "GetAddressCommandCtx", "(", "r", "*", "http", ".", "Request", ")", "(", "string", ",", "bool", ")", "{", "command", ",", "ok", ":=", "r", ".", "Context", "(", ")", ".", "Value", "(", "ctxAddrCmd", ")", ".", "(", "string", ")", "\n", "if", ...
// GetAddressCommandCtx retrieves the ctxAddrCmd data from the request context. // If not set the return value is "" and false.
[ "GetAddressCommandCtx", "retrieves", "the", "ctxAddrCmd", "data", "from", "the", "request", "context", ".", "If", "not", "set", "the", "return", "value", "is", "and", "false", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/api/insight/apimiddleware.go#L262-L268
19,790
decred/dcrdata
api/insight/apimiddleware.go
GetLimitCtx
func GetLimitCtx(r *http.Request) int { limit, ok := r.Context().Value(m.CtxLimit).(string) if !ok { return 0 } intValue, err := strconv.Atoi(limit) if err != nil { return 0 } return intValue }
go
func GetLimitCtx(r *http.Request) int { limit, ok := r.Context().Value(m.CtxLimit).(string) if !ok { return 0 } intValue, err := strconv.Atoi(limit) if err != nil { return 0 } return intValue }
[ "func", "GetLimitCtx", "(", "r", "*", "http", ".", "Request", ")", "int", "{", "limit", ",", "ok", ":=", "r", ".", "Context", "(", ")", ".", "Value", "(", "m", ".", "CtxLimit", ")", ".", "(", "string", ")", "\n", "if", "!", "ok", "{", "return",...
// GetLimitCtx retrieves the ctxLimit data from the request context. If not set, // the return value is 0 which is interpreted as no limit.
[ "GetLimitCtx", "retrieves", "the", "ctxLimit", "data", "from", "the", "request", "context", ".", "If", "not", "set", "the", "return", "value", "is", "0", "which", "is", "interpreted", "as", "no", "limit", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/api/insight/apimiddleware.go#L286-L296
19,791
decred/dcrdata
api/insight/apimiddleware.go
GetNbBlocksCtx
func GetNbBlocksCtx(r *http.Request) int { nbBlocks, ok := r.Context().Value(ctxNbBlocks).(int) if !ok { return 0 } return nbBlocks }
go
func GetNbBlocksCtx(r *http.Request) int { nbBlocks, ok := r.Context().Value(ctxNbBlocks).(int) if !ok { return 0 } return nbBlocks }
[ "func", "GetNbBlocksCtx", "(", "r", "*", "http", ".", "Request", ")", "int", "{", "nbBlocks", ",", "ok", ":=", "r", ".", "Context", "(", ")", ".", "Value", "(", "ctxNbBlocks", ")", ".", "(", "int", ")", "\n", "if", "!", "ok", "{", "return", "0", ...
// GetNbBlocksCtx retrieves the ctxNbBlocks data from the request context. If not // set, the return value is 0.
[ "GetNbBlocksCtx", "retrieves", "the", "ctxNbBlocks", "data", "from", "the", "request", "context", ".", "If", "not", "set", "the", "return", "value", "is", "0", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/api/insight/apimiddleware.go#L322-L328
19,792
decred/dcrdata
api/insight/apimiddleware.go
NbBlocksCtx
func NbBlocksCtx(next http.Handler) http.Handler { return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { ctx := r.Context() nbBlocks := r.FormValue("nbBlocks") nbBlocksint, err := strconv.Atoi(nbBlocks) if err == nil { ctx = context.WithValue(r.Context(), ctxNbBlocks, nbBlocksint) } nex...
go
func NbBlocksCtx(next http.Handler) http.Handler { return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { ctx := r.Context() nbBlocks := r.FormValue("nbBlocks") nbBlocksint, err := strconv.Atoi(nbBlocks) if err == nil { ctx = context.WithValue(r.Context(), ctxNbBlocks, nbBlocksint) } nex...
[ "func", "NbBlocksCtx", "(", "next", "http", ".", "Handler", ")", "http", ".", "Handler", "{", "return", "http", ".", "HandlerFunc", "(", "func", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "http", ".", "Request", ")", "{", "ctx", ":=", "r...
// NbBlocksCtx will parse the query parameters for nbBlocks.
[ "NbBlocksCtx", "will", "parse", "the", "query", "parameters", "for", "nbBlocks", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/api/insight/apimiddleware.go#L331-L341
19,793
decred/dcrdata
mempool/monitor.go
NewMempoolMonitor
func NewMempoolMonitor(ctx context.Context, collector *MempoolDataCollector, savers []MempoolDataSaver, params *chaincfg.Params, wg *sync.WaitGroup, newTxInChan <-chan *dcrjson.TxRawResult, signalOuts []chan<- pstypes.HubMessage, initialStore bool) (*MempoolMonitor, error) { // Make the skeleton MempoolMonitor. p...
go
func NewMempoolMonitor(ctx context.Context, collector *MempoolDataCollector, savers []MempoolDataSaver, params *chaincfg.Params, wg *sync.WaitGroup, newTxInChan <-chan *dcrjson.TxRawResult, signalOuts []chan<- pstypes.HubMessage, initialStore bool) (*MempoolMonitor, error) { // Make the skeleton MempoolMonitor. p...
[ "func", "NewMempoolMonitor", "(", "ctx", "context", ".", "Context", ",", "collector", "*", "MempoolDataCollector", ",", "savers", "[", "]", "MempoolDataSaver", ",", "params", "*", "chaincfg", ".", "Params", ",", "wg", "*", "sync", ".", "WaitGroup", ",", "new...
// NewMempoolMonitor creates a new MempoolMonitor. The MempoolMonitor receives // notifications of new transactions on newTxInChan, and of new blocks on the // same channel using a nil transaction message. Once TxHandler is started, the // MempoolMonitor will process incoming transactions, and forward new ones on // vi...
[ "NewMempoolMonitor", "creates", "a", "new", "MempoolMonitor", ".", "The", "MempoolMonitor", "receives", "notifications", "of", "new", "transactions", "on", "newTxInChan", "and", "of", "new", "blocks", "on", "the", "same", "channel", "using", "a", "nil", "transacti...
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/mempool/monitor.go#L72-L93
19,794
decred/dcrdata
mempool/monitor.go
LastBlockHash
func (p *MempoolMonitor) LastBlockHash() chainhash.Hash { p.mtx.RLock() defer p.mtx.RUnlock() return p.lastBlock.Hash }
go
func (p *MempoolMonitor) LastBlockHash() chainhash.Hash { p.mtx.RLock() defer p.mtx.RUnlock() return p.lastBlock.Hash }
[ "func", "(", "p", "*", "MempoolMonitor", ")", "LastBlockHash", "(", ")", "chainhash", ".", "Hash", "{", "p", ".", "mtx", ".", "RLock", "(", ")", "\n", "defer", "p", ".", "mtx", ".", "RUnlock", "(", ")", "\n", "return", "p", ".", "lastBlock", ".", ...
// LastBlockHash returns the hash of the most recently stored block.
[ "LastBlockHash", "returns", "the", "hash", "of", "the", "most", "recently", "stored", "block", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/mempool/monitor.go#L96-L100
19,795
decred/dcrdata
mempool/monitor.go
LastBlockHeight
func (p *MempoolMonitor) LastBlockHeight() int64 { p.mtx.RLock() defer p.mtx.RUnlock() return p.lastBlock.Height }
go
func (p *MempoolMonitor) LastBlockHeight() int64 { p.mtx.RLock() defer p.mtx.RUnlock() return p.lastBlock.Height }
[ "func", "(", "p", "*", "MempoolMonitor", ")", "LastBlockHeight", "(", ")", "int64", "{", "p", ".", "mtx", ".", "RLock", "(", ")", "\n", "defer", "p", ".", "mtx", ".", "RUnlock", "(", ")", "\n", "return", "p", ".", "lastBlock", ".", "Height", "\n", ...
// LastBlockHeight returns the height of the most recently stored block.
[ "LastBlockHeight", "returns", "the", "height", "of", "the", "most", "recently", "stored", "block", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/mempool/monitor.go#L103-L107
19,796
decred/dcrdata
mempool/monitor.go
LastBlockTime
func (p *MempoolMonitor) LastBlockTime() int64 { p.mtx.RLock() defer p.mtx.RUnlock() return p.lastBlock.Time }
go
func (p *MempoolMonitor) LastBlockTime() int64 { p.mtx.RLock() defer p.mtx.RUnlock() return p.lastBlock.Time }
[ "func", "(", "p", "*", "MempoolMonitor", ")", "LastBlockTime", "(", ")", "int64", "{", "p", ".", "mtx", ".", "RLock", "(", ")", "\n", "defer", "p", ".", "mtx", ".", "RUnlock", "(", ")", "\n", "return", "p", ".", "lastBlock", ".", "Time", "\n", "}...
// LastBlockTime returns the time of the most recently stored block.
[ "LastBlockTime", "returns", "the", "time", "of", "the", "most", "recently", "stored", "block", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/mempool/monitor.go#L110-L114
19,797
decred/dcrdata
mempool/monitor.go
Refresh
func (p *MempoolMonitor) Refresh() (*StakeData, []exptypes.MempoolTx, *exptypes.MempoolInfo, error) { // Collect mempool data (currently ticket fees) log.Trace("Gathering new mempool data.") stakeData, txs, addrOuts, txnsStore, err := p.collector.Collect() if err != nil { log.Errorf("mempool data collection faile...
go
func (p *MempoolMonitor) Refresh() (*StakeData, []exptypes.MempoolTx, *exptypes.MempoolInfo, error) { // Collect mempool data (currently ticket fees) log.Trace("Gathering new mempool data.") stakeData, txs, addrOuts, txnsStore, err := p.collector.Collect() if err != nil { log.Errorf("mempool data collection faile...
[ "func", "(", "p", "*", "MempoolMonitor", ")", "Refresh", "(", ")", "(", "*", "StakeData", ",", "[", "]", "exptypes", ".", "MempoolTx", ",", "*", "exptypes", ".", "MempoolInfo", ",", "error", ")", "{", "// Collect mempool data (currently ticket fees)", "log", ...
// Refresh collects mempool data, resets counters ticket counters and the timer, // but does not dispatch the MempoolDataSavers.
[ "Refresh", "collects", "mempool", "data", "resets", "counters", "ticket", "counters", "and", "the", "timer", "but", "does", "not", "dispatch", "the", "MempoolDataSavers", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/mempool/monitor.go#L368-L412
19,798
decred/dcrdata
mempool/monitor.go
CollectAndStore
func (p *MempoolMonitor) CollectAndStore() error { log.Trace("Gathering new mempool data.") stakeData, txs, inv, err := p.Refresh() if err != nil { log.Errorf("mempool data collection failed: %v", err.Error()) // stakeData is nil when err != nil return err } // Store mempool stakeData with each registered s...
go
func (p *MempoolMonitor) CollectAndStore() error { log.Trace("Gathering new mempool data.") stakeData, txs, inv, err := p.Refresh() if err != nil { log.Errorf("mempool data collection failed: %v", err.Error()) // stakeData is nil when err != nil return err } // Store mempool stakeData with each registered s...
[ "func", "(", "p", "*", "MempoolMonitor", ")", "CollectAndStore", "(", ")", "error", "{", "log", ".", "Trace", "(", "\"", "\"", ")", "\n", "stakeData", ",", "txs", ",", "inv", ",", "err", ":=", "p", ".", "Refresh", "(", ")", "\n", "if", "err", "!=...
// CollectAndStore collects mempool data, resets counters ticket counters and // the timer, and dispatches the storers.
[ "CollectAndStore", "collects", "mempool", "data", "resets", "counters", "ticket", "counters", "and", "the", "timer", "and", "dispatches", "the", "storers", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/mempool/monitor.go#L416-L437
19,799
decred/dcrdata
explorer/types/explorertypes.go
BlocksToTicketMaturity
func (t *TxInfo) BlocksToTicketMaturity() (blocks int64) { if t.Type != "Ticket" { return } if t.Mature == "True" { return } return t.TicketInfo.TicketMaturity + 1 - t.Confirmations }
go
func (t *TxInfo) BlocksToTicketMaturity() (blocks int64) { if t.Type != "Ticket" { return } if t.Mature == "True" { return } return t.TicketInfo.TicketMaturity + 1 - t.Confirmations }
[ "func", "(", "t", "*", "TxInfo", ")", "BlocksToTicketMaturity", "(", ")", "(", "blocks", "int64", ")", "{", "if", "t", ".", "Type", "!=", "\"", "\"", "{", "return", "\n", "}", "\n", "if", "t", ".", "Mature", "==", "\"", "\"", "{", "return", "\n",...
// BlocksToTicketMaturity will return 0 if this isn't an immature ticket.
[ "BlocksToTicketMaturity", "will", "return", "0", "if", "this", "isn", "t", "an", "immature", "ticket", "." ]
02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6
https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/explorer/types/explorertypes.go#L227-L235