Commit Graph

11 Commits

Author SHA1 Message Date
tersec e00fea1f6e
fix deprecation warnings from results; deprecate shims/io module; rm deprecated shims/os module (#223) 2024-06-27 11:48:32 +00:00
Jacek Sieka 28743363ff
keyed_queue: avoid copies, lookups (#220)
This change avoids many superfluous data copies and lookups by
exploiting `withValue` thus performing only one lookup with the same key
(instead of hasKey + actual lookup).

We also avoid several copies of the value which often is copied even
though only the next/prev pointers from the item are needed, for examle
during shifting and lru-appending.
2024-06-11 08:43:41 +02:00
Jordan Hrycaj 104132fd02
Update LRU directives (#217)
why:
  Clarify pre-conditions needed for `lruAppend()` to work properly. In a
  nutshell, it needs to be used in concert with `lruFetch()` or
  `lruUpdate()`.
2024-04-22 16:10:23 +00:00
tersec 326ef09a46
remove dead code under Nim 1.6+ (#206) 2023-07-31 21:07:48 +00:00
jangko faabd40c30
reduce compiler warnings 2023-02-14 21:35:54 +07:00
Miran d37e77a72b
make it more Nim 1.4+ compatible (#131)
* make it more 1.6-compatible

* these changes are from 1.4 forward
2022-07-26 17:52:59 +00:00
Jordan Hrycaj 4cab7b0879
Added `IntervalSet`, sets of non-adjacent intervals (#121)
* Added `IntervalSet`, sets of non-adjacent intervals

Relocated from nimbus-eth1 snap sync development

* Fix local import directive

* Fix --styleCheck complaints

* Attempt to get around CI problem by varying items

details:
  Vary all_tests exec list
  Hide useless globalness of `noisy` constant in non-debugging mode
2022-06-20 15:04:47 +01:00
Jordan Hrycaj b3ea2c6b46
Normalise `KeyError` exception message (#119) 2022-06-16 16:19:53 +01:00
Jordan Hrycaj 779ba052c8
Refactor lruFetch() item rotation (#112)
* Re-route KeyError exceptions as Defect for all except the `[]` function

why:
  Access via key is verified, error is returned via Result[]

* Refactor lruFetch() item rotation

why:
  Previously, the item was deleted and re-inserted in the table although
  for rotation, only the queue links need to be updated.

* Delete some KeyError annotations

why:
  Was overlooked earlier

* More KeyError fixes
2022-05-19 18:51:47 +01:00
Zahary Karadjov bb705bf17b
Stop mixing Result and Exceptions in some of the KeyedQueue APIs 2022-01-23 21:18:03 +02:00
Jordan Hrycaj b002c1fad0
New data structures - SortedSet and KeyedQueue
See the modules' documentation for more details
2021-11-04 13:17:50 +02:00