-
-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathinstance.go
31 lines (27 loc) · 881 Bytes
/
instance.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package speed
// Instances defines a valid collection of instance name and values
type Instances map[string]interface{}
// Keys collects and returns all the keys in all instance values
func (i Instances) Keys() []string {
s := make([]string, 0, len(i))
for k := range i {
s = append(s, k)
}
return s
}
// pcpInstance wraps a PCP compatible Instance
type pcpInstance struct {
name string
id uint32
offset int
}
// newpcpInstance generates a new Instance type based on the passed parameters
// the id is passed explicitly as it is assumed that this will be constructed
// after initializing the InstanceDomain
// this is not a part of the public API as this is not supposed to be used directly,
// but instead added using the AddInstance method of InstanceDomain
func newpcpInstance(name string) *pcpInstance {
return &pcpInstance{
name, hash(name, 0), 0,
}
}