plugeth/common
Felix Lange 9e6a1c3834
common/mclock: add Alarm (#26333)
Alarm is a timer utility that simplifies code where a timer needs to be rescheduled over
and over. Doing this can be tricky with time.Timer or time.AfterFunc because the channel
requires draining in some cases.

Alarm is optimized for use cases where items are tracked in a heap according to their expiry
time, and a goroutine with a for/select loop wants to be woken up whenever the next item expires.
In this application, the timer needs to be rescheduled when an item is added or removed
from the heap. Using a timer naively, these updates will always require synchronization
with the global runtime timer datastructure to update the timer using Reset. Alarm avoids
this by tracking the next expiry time and only modifies the timer if it would need to fire earlier
than already scheduled.

As an example use, I have converted p2p.dialScheduler to use Alarm instead of AfterFunc.
2023-01-03 12:10:48 +01:00
..
bitutil common,crypto: move fuzzers out of core (#22029) 2020-12-23 17:44:45 +01:00
compiler common/compiler: json unmarshalling error checks (#25449) 2022-08-01 13:47:21 +02:00
fdlimit fix: linter warning (#25192) 2022-06-29 10:54:57 +02:00
hexutil build: upgrade to go 1.19 (#25726) 2022-09-10 13:25:40 +02:00
lru all: remove remaining uses of untyped golang-lru (#26194) 2022-11-17 11:15:28 +01:00
math common/math, tests/fuzzers: use big.Int clone (#26006) 2022-10-18 15:42:16 +02:00
mclock common/mclock: add Alarm (#26333) 2023-01-03 12:10:48 +01:00
prque build: upgrade to go 1.19 (#25726) 2022-09-10 13:25:40 +02:00
big.go core, vm, common: define constantinople fork + shift (#16045) 2018-02-23 12:32:57 +02:00
bytes_test.go all: simplify and fix database iteration with prefix/start (#20808) 2020-04-15 14:08:53 +03:00
bytes.go internal/ethapi: add db operations to api (#24739) 2022-04-27 08:37:48 +02:00
debug.go common: rename unused function with typo (#23025) 2021-06-10 10:53:23 +03:00
format.go common: improve pretty duration regex (#25073) 2022-06-14 14:08:43 +02:00
path.go common: improve documentation comments (#16701) 2018-05-29 12:42:21 +02:00
size_test.go common: increase StorageSize test coverage (#25188) 2022-06-29 12:13:00 +02:00
size.go core, cmd, vendor: fixes and database inspection tool (#15) 2019-05-16 10:39:34 +03:00
test_utils.go all: replace uses of ioutil with io and os (#24869) 2022-05-16 11:59:35 +02:00
types_test.go all: add whitespace linter (#25312) 2022-07-25 13:14:03 +03:00
types.go common/types: add Address.Big (#26132) 2022-11-08 12:14:11 +01:00