This file is indexed.

/usr/share/gocode/src/github.com/influxdata/influxdb/stress/v2/statement/set.go is in golang-github-influxdb-influxdb-dev 1.1.1+dfsg1-4.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

 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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
package statement

import (
	"fmt"
	"strings"

	"github.com/influxdata/influxdb/stress/v2/stress_client"
)

// SetStatement set state variables for the test
type SetStatement struct {
	Var   string
	Value string

	StatementID string

	Tracer *stressClient.Tracer
}

// SetID statisfies the Statement Interface
func (i *SetStatement) SetID(s string) {
	i.StatementID = s
}

// Run statisfies the Statement Interface
func (i *SetStatement) Run(s *stressClient.StressTest) {
	i.Tracer = stressClient.NewTracer(make(map[string]string))
	d := stressClient.NewDirective(strings.ToLower(i.Var), strings.ToLower(i.Value), i.Tracer)
	switch d.Property {
	// Needs to be set on both StressTest and stressClient
	// Set the write percison for points generated
	case "precision":
		s.Precision = d.Value
		i.Tracer.Add(1)
		s.SendDirective(d)
	// Lives on StressTest
	// Set the date for the first point entered into the database
	case "startdate":
		s.Lock()
		s.StartDate = d.Value
		s.Unlock()
	// Lives on StressTest
	// Set the BatchSize for writes
	case "batchsize":
		s.Lock()
		s.BatchSize = parseInt(d.Value)
		s.Unlock()
	// All other variables live on stressClient
	default:
		i.Tracer.Add(1)
		s.SendDirective(d)
	}
	i.Tracer.Wait()
}

// Report statisfies the Statement Interface
func (i *SetStatement) Report(s *stressClient.StressTest) string {
	return fmt.Sprintf("SET %v = '%v'", i.Var, i.Value)
}