mirror of
https://github.com/ceph/ceph-csi.git
synced 2025-06-13 10:33:35 +00:00
rebase: bump the golang-dependencies group with 1 update
Bumps the golang-dependencies group with 1 update: [golang.org/x/crypto](https://github.com/golang/crypto). Updates `golang.org/x/crypto` from 0.16.0 to 0.17.0 - [Commits](https://github.com/golang/crypto/compare/v0.16.0...v0.17.0) --- updated-dependencies: - dependency-name: golang.org/x/crypto dependency-type: direct:production update-type: version-update:semver-minor dependency-group: golang-dependencies ... Signed-off-by: dependabot[bot] <support@github.com>
This commit is contained in:
committed by
mergify[bot]
parent
1ad79314f9
commit
e5d9b68d36
45
vendor/sigs.k8s.io/structured-merge-diff/v4/fieldpath/pathelementmap.go
generated
vendored
45
vendor/sigs.k8s.io/structured-merge-diff/v4/fieldpath/pathelementmap.go
generated
vendored
@ -28,20 +28,15 @@ import (
|
||||
// for PathElementSet and SetNodeMap, so we could probably share the
|
||||
// code.
|
||||
type PathElementValueMap struct {
|
||||
members sortedPathElementValues
|
||||
valueMap PathElementMap
|
||||
}
|
||||
|
||||
func MakePathElementValueMap(size int) PathElementValueMap {
|
||||
return PathElementValueMap{
|
||||
members: make(sortedPathElementValues, 0, size),
|
||||
valueMap: MakePathElementMap(size),
|
||||
}
|
||||
}
|
||||
|
||||
type pathElementValue struct {
|
||||
PathElement PathElement
|
||||
Value value.Value
|
||||
}
|
||||
|
||||
type sortedPathElementValues []pathElementValue
|
||||
|
||||
// Implement the sort interface; this would permit bulk creation, which would
|
||||
@ -53,7 +48,40 @@ func (spev sortedPathElementValues) Less(i, j int) bool {
|
||||
func (spev sortedPathElementValues) Swap(i, j int) { spev[i], spev[j] = spev[j], spev[i] }
|
||||
|
||||
// Insert adds the pathelement and associated value in the map.
|
||||
// If insert is called twice with the same PathElement, the value is replaced.
|
||||
func (s *PathElementValueMap) Insert(pe PathElement, v value.Value) {
|
||||
s.valueMap.Insert(pe, v)
|
||||
}
|
||||
|
||||
// Get retrieves the value associated with the given PathElement from the map.
|
||||
// (nil, false) is returned if there is no such PathElement.
|
||||
func (s *PathElementValueMap) Get(pe PathElement) (value.Value, bool) {
|
||||
v, ok := s.valueMap.Get(pe)
|
||||
if !ok {
|
||||
return nil, false
|
||||
}
|
||||
return v.(value.Value), true
|
||||
}
|
||||
|
||||
// PathElementValueMap is a map from PathElement to interface{}.
|
||||
type PathElementMap struct {
|
||||
members sortedPathElementValues
|
||||
}
|
||||
|
||||
type pathElementValue struct {
|
||||
PathElement PathElement
|
||||
Value interface{}
|
||||
}
|
||||
|
||||
func MakePathElementMap(size int) PathElementMap {
|
||||
return PathElementMap{
|
||||
members: make(sortedPathElementValues, 0, size),
|
||||
}
|
||||
}
|
||||
|
||||
// Insert adds the pathelement and associated value in the map.
|
||||
// If insert is called twice with the same PathElement, the value is replaced.
|
||||
func (s *PathElementMap) Insert(pe PathElement, v interface{}) {
|
||||
loc := sort.Search(len(s.members), func(i int) bool {
|
||||
return !s.members[i].PathElement.Less(pe)
|
||||
})
|
||||
@ -62,6 +90,7 @@ func (s *PathElementValueMap) Insert(pe PathElement, v value.Value) {
|
||||
return
|
||||
}
|
||||
if s.members[loc].PathElement.Equals(pe) {
|
||||
s.members[loc].Value = v
|
||||
return
|
||||
}
|
||||
s.members = append(s.members, pathElementValue{})
|
||||
@ -71,7 +100,7 @@ func (s *PathElementValueMap) Insert(pe PathElement, v value.Value) {
|
||||
|
||||
// Get retrieves the value associated with the given PathElement from the map.
|
||||
// (nil, false) is returned if there is no such PathElement.
|
||||
func (s *PathElementValueMap) Get(pe PathElement) (value.Value, bool) {
|
||||
func (s *PathElementMap) Get(pe PathElement) (interface{}, bool) {
|
||||
loc := sort.Search(len(s.members), func(i int) bool {
|
||||
return !s.members[i].PathElement.Less(pe)
|
||||
})
|
||||
|
Reference in New Issue
Block a user