Commit graph

7 commits

Author SHA1 Message Date
Cory Snider
564a13285f libnetwork/bitmap: improve documentation
Clarify that the argument to New is an exclusive upper bound.

Correct the documentation for SetAnyInRange: the end argument is
inclusive rather than exclusive.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2023-07-05 16:10:32 -04:00
Sebastiaan van Stijn
defa8ba7b4
ibnetwork/bitmap: format code with gofumpt
Formatting the code with https://github.com/mvdan/gofumpt

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-06-29 00:31:47 +02:00
Cory Snider
dea3f2b417 Migrate away from things deprecated in Go 1.20
"math/rand".Seed
  - Migrate to using local RNG instances.

"archive/tar".TypeRegA
  - The deprecated constant tar.TypeRegA is the same value as
    tar.TypeReg and so is not needed at all.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2023-02-15 12:30:32 -05:00
Cory Snider
6f08fe20e9 libnetwork/bit{seq,map}: delete CheckConsistency()
That method was only referenced by ipam.Allocator, but as it no longer
stores any state persistently there is no possibility for it to load an
inconsistent bit-sequence from Docker 1.9.x.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2023-01-27 11:47:43 -05:00
Cory Snider
143c092187 libnetwork/bitmap: optimize binary serialization
The byte-slice temporary is fully overwritten on each loop iteration so
it can be safely reused to reduce GC pressure.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2023-01-20 13:57:44 -05:00
Cory Snider
c4d7294b5c libnetwork/bitmap: remove datastore concerns
There is a solid bit-vector datatype hidden inside bitseq.Handle, but
it's obscured by all the intrusive datastore and KVObject nonsense.
It can be used without a datastore, but the datastore baggage limits its
utility inside and outside libnetwork. Extract the datatype goodness
into its own package which depends only on the standard library so it
can be used in more situations.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2023-01-20 13:42:40 -05:00
Cory Snider
ad03a09451 libnetwork/bitmap: dup from package bitseq
...in preparation for separating the bit-sequence datatype from the
datastore persistence (KVObject) concerns. The new package's contents
are identical to those of package libnetwork/bitseq to assist in
reviewing the changes made on each side of the split.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2023-01-20 13:33:22 -05:00