e3: agg generalize PutIdx method (#1014)

This commit is contained in:
Alex Sharov 2023-06-06 11:29:29 +07:00 committed by GitHub
parent 8f2e5802dd
commit cf4bdbdf26
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1291,20 +1291,19 @@ func (a *AggregatorV3) AddCodePrev(addr []byte, prev []byte) error {
return a.code.AddPrevValue(addr, nil, prev) return a.code.AddPrevValue(addr, nil, prev)
} }
func (a *AggregatorV3) AddTraceFrom(addr []byte) error { func (a *AggregatorV3) PutIdx(idx kv.InvertedIdx, key []byte) error {
return a.tracesFrom.Add(addr) switch idx {
case kv.TracesFromIdx:
return a.tracesFrom.Add(key)
case kv.TracesToIdx:
return a.tracesTo.Add(key)
case kv.LogAddressIdx:
return a.logAddrs.Add(key)
case kv.LogTopicIndex:
return a.logTopics.Add(key)
default:
panic(idx)
} }
func (a *AggregatorV3) AddTraceTo(addr []byte) error {
return a.tracesTo.Add(addr)
}
func (a *AggregatorV3) AddLogAddr(addr []byte) error {
return a.logAddrs.Add(addr)
}
func (a *AggregatorV3) AddLogTopic(topic []byte) error {
return a.logTopics.Add(topic)
} }
// DisableReadAhead - usage: `defer d.EnableReadAhead().DisableReadAhead()`. Please don't use this funcs without `defer` to avoid leak. // DisableReadAhead - usage: `defer d.EnableReadAhead().DisableReadAhead()`. Please don't use this funcs without `defer` to avoid leak.