@@ -7,18 +7,11 @@ import (
7
7
"errors"
8
8
"fmt"
9
9
"math"
10
-
11
- "go.opentelemetry.io/collector/pdata/pcommon"
12
10
)
13
11
14
- type locatable interface {
15
- LocationIndices () pcommon.Int32Slice
16
- }
17
-
18
- // FromLocationIndices builds a slice containing all the locations of a record.
19
- // The record can be any struct that implements a `LocationIndices` method.
20
- // Updates made to the returned map will not be applied back to the record.
21
- func FromLocationIndices (table LocationSlice , record locatable ) LocationSlice {
12
+ // FromLocationIndices builds a slice containing all the locations of a Profile.
13
+ // Updates made to the returned map will not be applied back to the Profile.
14
+ func FromLocationIndices (table LocationSlice , record Profile ) LocationSlice {
22
15
m := NewLocationSlice ()
23
16
m .EnsureCapacity (record .LocationIndices ().Len ())
24
17
@@ -32,12 +25,11 @@ func FromLocationIndices(table LocationSlice, record locatable) LocationSlice {
32
25
33
26
var errTooManyLocationTableEntries = errors .New ("too many entries in LocationTable" )
34
27
35
- // PutLocation updates a LocationTable and a record 's LocationIndices to
28
+ // PutLocation updates a LocationTable and a Profile 's LocationIndices to
36
29
// add or update a location.
37
- // The record can be any struct that implements a `LocationIndices` method.
38
- func PutLocation (table LocationSlice , record locatable , loc Location ) error {
39
- for i , locIdx := range record .LocationIndices ().All () {
40
- idx := int (locIdx )
30
+ func PutLocation (table LocationSlice , record Profile , loc Location ) error {
31
+ for i := range record .LocationIndices ().All () {
32
+ idx := int (record .LocationIndices ().At (i ))
41
33
if idx < 0 || idx >= table .Len () {
42
34
return fmt .Errorf ("index value %d out of range in LocationIndices[%d]" , idx , i )
43
35
}
0 commit comments