Source File
set.go
Belonging Package
go.opentelemetry.io/otel/label
package label
import (
)
emptySet = &Set{
equivalent: Distinct{
iface: [0]KeyValue{},
},
}
)
const maxConcurrentEncoders = 3
func () *Set {
return emptySet
}
func ( *Set) () int {
if == nil || !.equivalent.Valid() {
return 0
}
return .equivalent.reflect().Len()
}
func ( *Set) ( Key) (Value, bool) {
if == nil {
return Value{}, false
}
:= .equivalent.reflect()
:= .Len()
:= sort.Search(, func( int) bool {
return .Index().Interface().(KeyValue).Key >=
})
if >= {
return Value{}, false
}
:= .Index().Interface().(KeyValue)
if == .Key {
return .Value, true
}
return Value{}, false
}
func ( *Set) () Distinct {
if == nil || !.equivalent.Valid() {
return emptySet.equivalent
}
return .equivalent
}
func ( *Set) ( *Set) bool {
return .Equivalent() == .Equivalent()
}
return .Encode(.Iter())
}
var *string
.lock.Lock()
for := 0; < maxConcurrentEncoders; ++ {
if .encoders[] == {
= &.encoded[]
break
}
}
.lock.Unlock()
if != nil {
return *
}
:= .Encode(.Iter())
.lock.Lock()
defer .lock.Unlock()
for := 0; < maxConcurrentEncoders; ++ {
if .encoders[] == {
return .encoded[]
}
if !.encoders[].Valid() {
.encoders[] =
.encoded[] =
return
}
}
return
}
func () Set {
return Set{
equivalent: emptySet.equivalent,
}
}
if len() == 0 {
return empty()
}
, := NewSetWithSortableFiltered(, , nil)
return //nolint
}
for ; >= 0; -- {
if [].Key == [].Key {
continue
}
--
[], [] = [], []
}
if != nil {
return filterSet([:], )
}
return Set{
equivalent: computeDistinct([:]),
}, nil
}
:= len()
:= len() - 1
for ; >= 0; -- {
if ([]) {
--
[], [] = [], []
continue
}
}
= [:]
return Set{
equivalent: computeDistinct([:]),
},
}
func ( *Set) ( Filter) (Set, []KeyValue) {
if == nil {
return Set{
equivalent: .equivalent,
}, nil
}
func ( []KeyValue) Distinct {
:= computeDistinctFixed()
if == nil {
= computeDistinctReflect()
}
return Distinct{
iface: ,
}
}
func ( []KeyValue) interface{} {
switch len() {
case 1:
:= new([1]KeyValue)
copy((*)[:], )
return *
case 2:
:= new([2]KeyValue)
copy((*)[:], )
return *
case 3:
:= new([3]KeyValue)
copy((*)[:], )
return *
case 4:
:= new([4]KeyValue)
copy((*)[:], )
return *
case 5:
:= new([5]KeyValue)
copy((*)[:], )
return *
case 6:
:= new([6]KeyValue)
copy((*)[:], )
return *
case 7:
:= new([7]KeyValue)
copy((*)[:], )
return *
case 8:
:= new([8]KeyValue)
copy((*)[:], )
return *
case 9:
:= new([9]KeyValue)
copy((*)[:], )
return *
case 10:
:= new([10]KeyValue)
copy((*)[:], )
return *
default:
return nil
}
}
![]() |
The pages are generated with Golds v0.3.2-preview. (GOOS=darwin GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds. |