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 <[email protected]>
(cherry picked from commit 01ea03a)

# Conflicts:
#	go.mod
#	go.sum
#	vendor/modules.txt
  • Loading branch information
james-munson authored and mergify[bot] committed Sep 18, 2024
1 parent 6557b6f commit 6fc115c
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 143 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ 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
github.com/longhorn/backupstore v0.0.0-20240823072635-7afd6aa10d3e
github.com/longhorn/go-common-libs v0.0.0-20240821134112-907f57efd48f
Expand All @@ -27,6 +26,7 @@ require (
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/RoaringBitmap/roaring v1.9.4 // indirect
github.com/aws/aws-sdk-go v1.55.5 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/bits-and-blooms/bitset v1.12.0 // indirect
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.

0 comments on commit 6fc115c

Please sign in to comment.