Skip to content

Commit

Permalink
feat(bitmap): use enhanced bitmap from go-common-libs
Browse files Browse the repository at this point in the history
Signed-off-by: James Munson <james.munson@suse.com>
(cherry picked from commit 01ea03a)

# Conflicts:
#	go.mod
#	go.sum
#	vendor/modules.txt
  • Loading branch information
james-munson authored and mergify[bot] committed Sep 16, 2024
1 parent 6557b6f commit 4f84442
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 143 deletions.
17 changes: 16 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,20 @@ module github.com/longhorn/longhorn-instance-manager
go 1.22.2

require (
github.com/RoaringBitmap/roaring v1.9.4
github.com/google/uuid v1.6.0
<<<<<<< HEAD
github.com/longhorn/backupstore v0.0.0-20240823072635-7afd6aa10d3e
github.com/longhorn/go-common-libs v0.0.0-20240821134112-907f57efd48f
github.com/longhorn/go-spdk-helper v0.0.0-20240820144231-33c0873802ff
github.com/longhorn/longhorn-engine v1.7.1-rc2
github.com/longhorn/longhorn-spdk-engine v0.0.0-20240821075759-df0d2ae1b9bb
=======
github.com/longhorn/backupstore v0.0.0-20240811043357-5c2b7879457f
github.com/longhorn/go-common-libs v0.0.0-20240820144159-94447d3f68d8
github.com/longhorn/go-spdk-helper v0.0.0-20240811121608-9383fa59dd7c
github.com/longhorn/longhorn-engine v1.7.0-rc3
github.com/longhorn/longhorn-spdk-engine v0.0.0-20240815033436-41791a2d0239
>>>>>>> 01ea03a4 (feat(bitmap): use enhanced bitmap from go-common-libs)
github.com/longhorn/types v0.0.0-20240725040629-473d671316c4
github.com/pkg/errors v0.9.1
github.com/sirupsen/logrus v1.9.3
Expand All @@ -24,10 +31,18 @@ require (

require (
github.com/0xPolygon/polygon-edge v1.3.3 // indirect
<<<<<<< HEAD
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.14.0 // indirect
github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 // indirect
github.com/Azure/azure-sdk-for-go/sdk/storage/azblob v1.4.0 // indirect
github.com/aws/aws-sdk-go v1.55.5 // indirect
=======
github.com/Azure/azure-sdk-for-go/sdk/azcore v0.21.1 // indirect
github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.3 // indirect
github.com/Azure/azure-sdk-for-go/sdk/storage/azblob v0.3.0 // indirect
github.com/RoaringBitmap/roaring v1.9.4 // indirect
github.com/aws/aws-sdk-go v1.52.2 // indirect
>>>>>>> 01ea03a4 (feat(bitmap): use enhanced bitmap from go-common-libs)
github.com/beorn7/perks v1.0.1 // indirect
github.com/bits-and-blooms/bitset v1.12.0 // indirect
github.com/c9s/goprocinfo v0.0.0-20210130143923-c95fcf8c64a8 // indirect
Expand Down
15 changes: 15 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
<<<<<<< HEAD
github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc=
github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw=
github.com/longhorn/backupstore v0.0.0-20240823072635-7afd6aa10d3e h1:Kvt/BqiHKaOlTPSM2HFz0VupuQM0laln67rMIDCRYxQ=
Expand All @@ -117,6 +118,20 @@ github.com/longhorn/longhorn-engine v1.7.1-rc2 h1:Hbcuyu8ae0qFKhoF4p1uJaQAKGeJ2Y
github.com/longhorn/longhorn-engine v1.7.1-rc2/go.mod h1:E1ec7ub7SNGvASDtiFHL1dXX4bhEQiroBixD2GGeRbQ=
github.com/longhorn/longhorn-spdk-engine v0.0.0-20240821075759-df0d2ae1b9bb h1:Bon92kq45spPKp1JZEQrlDm+DJI37z56D64cL+/64Po=
github.com/longhorn/longhorn-spdk-engine v0.0.0-20240821075759-df0d2ae1b9bb/go.mod h1:j6SIrhGW6mFc18MjzXfTHkAZA0ms4k/oL3piCYNlZPo=
=======
github.com/longhorn/backupstore v0.0.0-20240811043357-5c2b7879457f h1:VBXKJ+BJoqhz+PGmHxDl6h+aWX9X9N3KQm1cxz4fv/w=
github.com/longhorn/backupstore v0.0.0-20240811043357-5c2b7879457f/go.mod h1:U02ktOpAMSejR4vUztX2zt/78btYsUICDH5AipTddu4=
github.com/longhorn/go-common-libs v0.0.0-20240820144159-94447d3f68d8 h1:VPVCEhOugxbmMi1dVtkV5h52DS/I891SEPAZHqUYsc0=
github.com/longhorn/go-common-libs v0.0.0-20240820144159-94447d3f68d8/go.mod h1:Qv34svr/msf6XoUwnrltNBTwMhQljbHEhb5ZKWiRdxo=
github.com/longhorn/go-iscsi-helper v0.0.0-20240727052644-d2442a50e906 h1:1FoEoyIQRtKAKv3O8MJ1nczly3+WMzbFbjT3pmakpWw=
github.com/longhorn/go-iscsi-helper v0.0.0-20240727052644-d2442a50e906/go.mod h1:/VLElLs6+hjmkY7VQn92W8MO56HVvLJUSNBQitOB0fY=
github.com/longhorn/go-spdk-helper v0.0.0-20240811121608-9383fa59dd7c h1:ztjrkxi7KcZPZBexnSKBZ2fX75JIU+iXibXeq8qpeg4=
github.com/longhorn/go-spdk-helper v0.0.0-20240811121608-9383fa59dd7c/go.mod h1:BrtXoVnIZ97+uZ+cMcaICc5KnuJkh8j3+G1NjKxh+8Q=
github.com/longhorn/longhorn-engine v1.7.0-rc3 h1:YTt++OeSrEOlifz++8VAOH/aJ4lGShD2TaJP1ZaQ3Uw=
github.com/longhorn/longhorn-engine v1.7.0-rc3/go.mod h1:2Hq/3QzW4fF2yUg+kauiAT3ps5WCKLMkrwXW2Wyfj9o=
github.com/longhorn/longhorn-spdk-engine v0.0.0-20240815033436-41791a2d0239 h1:1bHRQ6MYz4z3ul614ZGFjcT9EdeIUtUYKBi/Qjg5dHc=
github.com/longhorn/longhorn-spdk-engine v0.0.0-20240815033436-41791a2d0239/go.mod h1:4X7OQr01G10WSxq0ETEFxS/gQvgcE3YUEIU3MZujTcc=
>>>>>>> 01ea03a4 (feat(bitmap): use enhanced bitmap from go-common-libs)
github.com/longhorn/nsfilelock v0.0.0-20200723175406-fa7c83ad0003 h1:Jw9uANsGcHTxp6HcC++/vN17LfeuDmozHI2j6DoZf5E=
github.com/longhorn/nsfilelock v0.0.0-20200723175406-fa7c83ad0003/go.mod h1:0CLeXlf59Lg6C0kjLSDf47ft73Dh37CwymYRKWwAn04=
github.com/longhorn/sparse-tools v0.0.0-20240729132735-18b207e459ff h1:gmdQDbnaGJ/zmrK+QJzSys8mH679os6i7vW/pOpRn1U=
Expand Down
10 changes: 8 additions & 2 deletions pkg/process/process_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
"google.golang.org/protobuf/types/known/emptypb"
"k8s.io/mount-utils"

lhBitmap "github.com/longhorn/go-common-libs/bitmap"
lhKubernetes "github.com/longhorn/go-common-libs/kubernetes"
lhLonghorn "github.com/longhorn/go-common-libs/longhorn"

Expand Down Expand Up @@ -52,7 +53,7 @@ type Manager struct {
processes map[string]*Process
processUpdateCh chan *Process

availablePorts *util.Bitmap
availablePorts *lhBitmap.Bitmap

logsDir string

Expand All @@ -65,6 +66,11 @@ func NewManager(ctx context.Context, portRange string, logsDir string) (*Manager
if err != nil {
return nil, err
}
bitmap, err := lhBitmap.NewBitmap(start, end)
if err != nil {
return nil, err
}

pm := &Manager{
ctx: ctx,
portRangeMin: start,
Expand All @@ -76,7 +82,7 @@ func NewManager(ctx context.Context, portRange string, logsDir string) (*Manager
lock: &sync.RWMutex{},
processes: map[string]*Process{},
processUpdateCh: make(chan *Process),
availablePorts: util.NewBitmap(start, end),
availablePorts: bitmap,

logsDir: logsDir,

Expand Down
86 changes: 0 additions & 86 deletions pkg/util/bitmap.go

This file was deleted.

54 changes: 0 additions & 54 deletions pkg/util/bitmap_test.go

This file was deleted.

4 changes: 4 additions & 0 deletions vendor/modules.txt
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,11 @@ github.com/longhorn/backupstore/s3
github.com/longhorn/backupstore/types
github.com/longhorn/backupstore/util
github.com/longhorn/backupstore/vfs
<<<<<<< HEAD
# github.com/longhorn/go-common-libs v0.0.0-20240821134112-907f57efd48f
=======
# github.com/longhorn/go-common-libs v0.0.0-20240820144159-94447d3f68d8
>>>>>>> 01ea03a4 (feat(bitmap): use enhanced bitmap from go-common-libs)
## explicit; go 1.22.0
github.com/longhorn/go-common-libs/backup
github.com/longhorn/go-common-libs/bitmap
Expand Down

0 comments on commit 4f84442

Please sign in to comment.