diff --git a/go.mod b/go.mod index 7f11b1c0..c13400ff 100644 --- a/go.mod +++ b/go.mod @@ -7,9 +7,9 @@ toolchain go1.23.2 require ( github.com/0xPolygon/polygon-edge v1.3.3 github.com/google/uuid v1.6.0 - github.com/longhorn/backupstore v0.0.0-20241013024428-b52180a5191f - github.com/longhorn/go-common-libs v0.0.0-20241012153249-4c71f1cbdd9e - github.com/longhorn/go-spdk-helper v0.0.0-20241017032159-f0613870a0b5 + github.com/longhorn/backupstore v0.0.0-20241019064138-ef7b22d3fcb0 + github.com/longhorn/go-common-libs v0.0.0-20241024003634-9e7505c868e3 + github.com/longhorn/go-spdk-helper v0.0.0-20241023025952-76b81140218f github.com/longhorn/types v0.0.0-20241007141758-3640f2357238 github.com/pkg/errors v0.9.1 github.com/sirupsen/logrus v1.9.3 @@ -18,7 +18,7 @@ require ( google.golang.org/grpc v1.67.1 google.golang.org/protobuf v1.35.1 gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c - k8s.io/apimachinery v0.31.1 + k8s.io/apimachinery v0.31.2 ) require ( @@ -51,6 +51,7 @@ require ( github.com/shirou/gopsutil/v3 v3.24.5 // indirect github.com/slok/goresilience v0.2.0 // indirect github.com/yusufpapurcu/wmi v1.2.4 // indirect + golang.org/x/exp v0.0.0-20231006140011-7918f672742d // indirect golang.org/x/sys v0.26.0 // indirect golang.org/x/text v0.19.0 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240814211410-ddb44dafa142 // indirect diff --git a/go.sum b/go.sum index 173d26d1..e45bb3b0 100644 --- a/go.sum +++ b/go.sum @@ -42,12 +42,12 @@ 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= -github.com/longhorn/backupstore v0.0.0-20241013024428-b52180a5191f h1:p2DmYXbpCSYRrdpZR5w9Py3sgXfK8zdWxfpH83tnk7E= -github.com/longhorn/backupstore v0.0.0-20241013024428-b52180a5191f/go.mod h1:Wv5tV0/Jv2OuYo8ZcpgsLVOS4xos2qKLrLQ7pgWsfFY= -github.com/longhorn/go-common-libs v0.0.0-20241012153249-4c71f1cbdd9e h1:ux8DZoSohmkA4vpvmlw8ow5pGsaSiVRAONkGx7l1R1Y= -github.com/longhorn/go-common-libs v0.0.0-20241012153249-4c71f1cbdd9e/go.mod h1:ypnoivZeYoZVRqeI2MQHEGA+Vqt8DZVkCbhf/3Ogx7Q= -github.com/longhorn/go-spdk-helper v0.0.0-20241017032159-f0613870a0b5 h1:GTvdzXoXm9KmcnAucY5kRVOYBhRqR/1t50A/Ja6//GM= -github.com/longhorn/go-spdk-helper v0.0.0-20241017032159-f0613870a0b5/go.mod h1:bcuZXckBY6XdJ/IY3VFbDfsSGhoPLVeg5QZ2Av5JcAo= +github.com/longhorn/backupstore v0.0.0-20241019064138-ef7b22d3fcb0 h1:5GvcnLoSIL7re4ACTDtQrvf7Vv1eBtiCTIQK3hLApR0= +github.com/longhorn/backupstore v0.0.0-20241019064138-ef7b22d3fcb0/go.mod h1:4K4Z8zeVXbp5pcozF8fGrZRXatxIreqNH/xWa93odAQ= +github.com/longhorn/go-common-libs v0.0.0-20241024003634-9e7505c868e3 h1:mWgSoMgTYoguJt4TBYSrq3ZweQR11GHPxEth39QiT2o= +github.com/longhorn/go-common-libs v0.0.0-20241024003634-9e7505c868e3/go.mod h1:00v9OlN7rulbJxh7ZM3h0J9UfXQ0EAHzuS2zlJgqno0= +github.com/longhorn/go-spdk-helper v0.0.0-20241023025952-76b81140218f h1:HqNdF85McEX+3BLDimiAqAeYlhTuPiyJj/3MvTrku28= +github.com/longhorn/go-spdk-helper v0.0.0-20241023025952-76b81140218f/go.mod h1:dXn8ig3ic+uwy4hOCkXDZUU1tqe8CxsEVO/D+7/a72Y= github.com/longhorn/types v0.0.0-20241007141758-3640f2357238 h1:zo3jTRYbH1KtO2TwgIt3eb4wTLGAfN/SAzWJsOwY+Pc= github.com/longhorn/types v0.0.0-20241007141758-3640f2357238/go.mod h1:IpV+1bctQgBgp3brj0nsHmnBDFkd5IrzTgBtVAloJuw= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= @@ -135,8 +135,8 @@ gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EV gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -k8s.io/apimachinery v0.31.1 h1:mhcUBbj7KUjaVhyXILglcVjuS4nYXiwC+KKFBgIVy7U= -k8s.io/apimachinery v0.31.1/go.mod h1:rsPdaZJfTfLsNJSQzNHQvYoTmxhoOEofxtOsF3rtsMo= +k8s.io/apimachinery v0.31.2 h1:i4vUt2hPK56W6mlT7Ry+AO8eEsyxMD1U44NR22CLTYw= +k8s.io/apimachinery v0.31.2/go.mod h1:rsPdaZJfTfLsNJSQzNHQvYoTmxhoOEofxtOsF3rtsMo= k8s.io/klog/v2 v2.130.1 h1:n9Xl7H1Xvksem4KFG4PYbdQCQxqc/tTUyrgXaOhHSzk= k8s.io/klog/v2 v2.130.1/go.mod h1:3Jpz1GvMt720eyJH1ckRHK1EDfpxISzJ7I9OYgaDtPE= k8s.io/mount-utils v0.31.1 h1:f8UrH9kRynljmdNGM6BaCvFUON5ZPKDgE+ltmYqI4wA= diff --git a/vendor/github.com/longhorn/go-common-libs/utils/misc.go b/vendor/github.com/longhorn/go-common-libs/utils/misc.go index 69aced9c..dc18368f 100644 --- a/vendor/github.com/longhorn/go-common-libs/utils/misc.go +++ b/vendor/github.com/longhorn/go-common-libs/utils/misc.go @@ -7,11 +7,13 @@ import ( "path/filepath" "reflect" "runtime" + "sort" "strconv" "strings" "github.com/google/uuid" "github.com/pkg/errors" + "golang.org/x/exp/constraints" "github.com/longhorn/go-common-libs/types" ) @@ -119,3 +121,21 @@ func ConvertTypeToString[T any](value T) string { return fmt.Sprintf("Unsupported type: %v", v.Kind()) } } + +// SortKeys sorts the keys of a map in ascending order. +func SortKeys[K constraints.Ordered, V any](mapObj map[K]V) ([]K, error) { + if mapObj == nil { + return nil, fmt.Errorf("input object cannot be nil") + } + + keys := make([]K, 0, len(mapObj)) + for key := range mapObj { + keys = append(keys, key) + } + + sort.Slice(keys, func(i, j int) bool { + return keys[i] < keys[j] + }) + + return keys, nil +} diff --git a/vendor/golang.org/x/exp/LICENSE b/vendor/golang.org/x/exp/LICENSE new file mode 100644 index 00000000..6a66aea5 --- /dev/null +++ b/vendor/golang.org/x/exp/LICENSE @@ -0,0 +1,27 @@ +Copyright (c) 2009 The Go Authors. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/vendor/golang.org/x/exp/PATENTS b/vendor/golang.org/x/exp/PATENTS new file mode 100644 index 00000000..73309904 --- /dev/null +++ b/vendor/golang.org/x/exp/PATENTS @@ -0,0 +1,22 @@ +Additional IP Rights Grant (Patents) + +"This implementation" means the copyrightable works distributed by +Google as part of the Go project. + +Google hereby grants to You a perpetual, worldwide, non-exclusive, +no-charge, royalty-free, irrevocable (except as stated in this section) +patent license to make, have made, use, offer to sell, sell, import, +transfer and otherwise run, modify and propagate the contents of this +implementation of Go, where such license applies only to those patent +claims, both currently owned or controlled by Google and acquired in +the future, licensable by Google that are necessarily infringed by this +implementation of Go. This grant does not include claims that would be +infringed only as a consequence of further modification of this +implementation. If you or your agent or exclusive licensee institute or +order or agree to the institution of patent litigation against any +entity (including a cross-claim or counterclaim in a lawsuit) alleging +that this implementation of Go or any code incorporated within this +implementation of Go constitutes direct or contributory patent +infringement, or inducement of patent infringement, then any patent +rights granted to you under this License for this implementation of Go +shall terminate as of the date such litigation is filed. diff --git a/vendor/golang.org/x/exp/constraints/constraints.go b/vendor/golang.org/x/exp/constraints/constraints.go new file mode 100644 index 00000000..2c033dff --- /dev/null +++ b/vendor/golang.org/x/exp/constraints/constraints.go @@ -0,0 +1,50 @@ +// Copyright 2021 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Package constraints defines a set of useful constraints to be used +// with type parameters. +package constraints + +// Signed is a constraint that permits any signed integer type. +// If future releases of Go add new predeclared signed integer types, +// this constraint will be modified to include them. +type Signed interface { + ~int | ~int8 | ~int16 | ~int32 | ~int64 +} + +// Unsigned is a constraint that permits any unsigned integer type. +// If future releases of Go add new predeclared unsigned integer types, +// this constraint will be modified to include them. +type Unsigned interface { + ~uint | ~uint8 | ~uint16 | ~uint32 | ~uint64 | ~uintptr +} + +// Integer is a constraint that permits any integer type. +// If future releases of Go add new predeclared integer types, +// this constraint will be modified to include them. +type Integer interface { + Signed | Unsigned +} + +// Float is a constraint that permits any floating-point type. +// If future releases of Go add new predeclared floating-point types, +// this constraint will be modified to include them. +type Float interface { + ~float32 | ~float64 +} + +// Complex is a constraint that permits any complex numeric type. +// If future releases of Go add new predeclared complex numeric types, +// this constraint will be modified to include them. +type Complex interface { + ~complex64 | ~complex128 +} + +// Ordered is a constraint that permits any ordered type: any type +// that supports the operators < <= >= >. +// If future releases of Go add new ordered types, +// this constraint will be modified to include them. +type Ordered interface { + Integer | Float | ~string +} diff --git a/vendor/modules.txt b/vendor/modules.txt index f3e4b754..e6ba2f6f 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -45,13 +45,13 @@ github.com/kr/pretty # github.com/kr/text v0.2.0 ## explicit github.com/kr/text -# github.com/longhorn/backupstore v0.0.0-20241013024428-b52180a5191f +# github.com/longhorn/backupstore v0.0.0-20241019064138-ef7b22d3fcb0 ## explicit; go 1.22.0 github.com/longhorn/backupstore github.com/longhorn/backupstore/logging github.com/longhorn/backupstore/types github.com/longhorn/backupstore/util -# github.com/longhorn/go-common-libs v0.0.0-20241012153249-4c71f1cbdd9e +# github.com/longhorn/go-common-libs v0.0.0-20241024003634-9e7505c868e3 ## explicit; go 1.22.0 github.com/longhorn/go-common-libs/backup github.com/longhorn/go-common-libs/bitmap @@ -64,7 +64,7 @@ github.com/longhorn/go-common-libs/sync github.com/longhorn/go-common-libs/sys github.com/longhorn/go-common-libs/types github.com/longhorn/go-common-libs/utils -# github.com/longhorn/go-spdk-helper v0.0.0-20241017032159-f0613870a0b5 +# github.com/longhorn/go-spdk-helper v0.0.0-20241023025952-76b81140218f ## explicit; go 1.22.0 github.com/longhorn/go-spdk-helper/pkg/jsonrpc github.com/longhorn/go-spdk-helper/pkg/nvme @@ -150,6 +150,9 @@ github.com/yusufpapurcu/wmi # go.uber.org/multierr v1.11.0 ## explicit; go 1.19 go.uber.org/multierr +# golang.org/x/exp v0.0.0-20231006140011-7918f672742d +## explicit; go 1.20 +golang.org/x/exp/constraints # golang.org/x/net v0.30.0 ## explicit; go 1.18 golang.org/x/net/context @@ -276,7 +279,7 @@ google.golang.org/protobuf/types/known/timestamppb # gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c ## explicit; go 1.11 gopkg.in/check.v1 -# k8s.io/apimachinery v0.31.1 +# k8s.io/apimachinery v0.31.2 ## explicit; go 1.22.0 k8s.io/apimachinery/pkg/util/errors k8s.io/apimachinery/pkg/util/runtime