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>
  • Loading branch information
james-munson committed Aug 13, 2024
1 parent cbb9775 commit 5bb27b6
Show file tree
Hide file tree
Showing 68 changed files with 625 additions and 103 deletions.
6 changes: 4 additions & 2 deletions 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-20240720163059-56c90cd23634
github.com/longhorn/go-common-libs v0.0.0-20240726063909-5c0987bc30d8
Expand All @@ -27,6 +26,7 @@ require (
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
github.com/beorn7/perks v1.0.1 // indirect
github.com/bits-and-blooms/bitset v1.12.0 // indirect
Expand Down Expand Up @@ -79,7 +79,7 @@ require (
github.com/yusufpapurcu/wmi v1.2.4 // indirect
go.uber.org/multierr v1.11.0 // indirect
golang.org/x/oauth2 v0.20.0 // indirect
golang.org/x/sys v0.22.0 // indirect
golang.org/x/sys v0.24.0 // indirect
golang.org/x/term v0.22.0 // indirect
golang.org/x/text v0.16.0 // indirect
golang.org/x/time v0.5.0 // indirect
Expand All @@ -97,3 +97,5 @@ require (
sigs.k8s.io/structured-merge-diff/v4 v4.4.1 // indirect
sigs.k8s.io/yaml v1.3.0 // indirect
)

replace github.com/longhorn/go-common-libs => github.com/james-munson/go-common-libs v0.0.0-20240813190205-990d64742982
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/gorilla/handlers v1.5.2 h1:cLTUSsNkgcwhgRqvCNmdbRWG0A3N4F+M2nWKdScwyEE=
github.com/gorilla/handlers v1.5.2/go.mod h1:dX+xVpaxdSw+q0Qek8SSsl3dfMk3jNddUkMzo0GtH0w=
github.com/james-munson/go-common-libs v0.0.0-20240813190205-990d64742982 h1:Atry3h81tzPqQ7QrAaZs0Vb1utC4NMySmMhWNjk5JH8=
github.com/james-munson/go-common-libs v0.0.0-20240813190205-990d64742982/go.mod h1:3Zh77/RpSqyq/IgqVU9YNENC2pCvQhG4+izPEvhWP7o=
github.com/jmespath/go-jmespath v0.4.0 h1:BEgLn5cpjn8UN1mAw4NjwDrS35OdebyEtFe+9YPoQUg=
github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo=
github.com/jmespath/go-jmespath/internal/testify v1.5.1 h1:shLQSRRSCCPj3f2gpwzGwWFoC7ycTf1rcQZHOlsJ6N8=
Expand All @@ -93,8 +95,6 @@ github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
github.com/longhorn/backupstore v0.0.0-20240720163059-56c90cd23634 h1:gfrFl0YwZSfyiaLdg7TFKSHtBgMJclDGDtBjUhGe0ik=
github.com/longhorn/backupstore v0.0.0-20240720163059-56c90cd23634/go.mod h1:7L/qcMq6IK3S/VU52AtmeKCnOK9Tz1XmMilzo2ILEm8=
github.com/longhorn/go-common-libs v0.0.0-20240726063909-5c0987bc30d8 h1:aD1kw/MEXqdwv2Dn3RXRIvHOTyTkKKH0EYoDaZPGKM4=
github.com/longhorn/go-common-libs v0.0.0-20240726063909-5c0987bc30d8/go.mod h1:o01gaAiKE5NCd8+5i6csJSU4ELlW0Yn8GQ9U7pbXG9w=
github.com/longhorn/go-iscsi-helper v0.0.0-20240706152726-9dbb9c7bdf30 h1:tTHysoIMIUt53dRqLtIo7AH0RRMr2P5Jy8DAMxDISO8=
github.com/longhorn/go-iscsi-helper v0.0.0-20240706152726-9dbb9c7bdf30/go.mod h1:Y4SlLQTYuOOMWlJNdFhTkM3MsXTmY/jkWj8jbuU7kOE=
github.com/longhorn/go-spdk-helper v0.0.0-20240726083118-6a324e959796 h1:7d15ldH6VXJ2q7tu8Lq8RpyJeIyMs5mlDv1BRwCc7Mw=
Expand Down Expand Up @@ -228,8 +228,8 @@ golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.22.0 h1:RI27ohtqKCnwULzJLqkv897zojh5/DwS/ENaMzUOaWI=
golang.org/x/sys v0.22.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.24.0 h1:Twjiwq9dn6R1fQcyiK+wQyHWfaz/BJB+YIpzU/Cv3Xg=
golang.org/x/sys v0.24.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.22.0 h1:BbsgPEJULsl2fV/AT3v15Mjva5yXKQDyKf+TbDz7QJk=
golang.org/x/term v0.22.0/go.mod h1:F3qCibpT5AMpCRfhfT53vVJwhLtIVHhB9XDjfFvnMI4=
Expand Down
5 changes: 3 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 @@ -76,7 +77,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: lhBitmap.NewBitmap(start, end),

logsDir: logsDir,

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

This file was deleted.

57 changes: 38 additions & 19 deletions pkg/util/bitmap.go → .../longhorn/go-common-libs/bitmap/bitmap.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions vendor/golang.org/x/sys/LICENSE

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions vendor/golang.org/x/sys/unix/mkerrors.sh

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions vendor/golang.org/x/sys/unix/syscall_darwin.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions vendor/golang.org/x/sys/unix/syscall_linux.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions vendor/golang.org/x/sys/unix/syscall_openbsd.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions vendor/golang.org/x/sys/unix/zerrors_darwin_amd64.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions vendor/golang.org/x/sys/unix/zerrors_darwin_arm64.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

38 changes: 35 additions & 3 deletions vendor/golang.org/x/sys/unix/zerrors_linux.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 5bb27b6

Please sign in to comment.