forked from sourcegraph/sourcegraph-public-snapshot
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.go
More file actions
65 lines (56 loc) · 2.25 KB
/
index.go
File metadata and controls
65 lines (56 loc) · 2.25 KB
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
60
61
62
63
64
65
package types
import (
"database/sql/driver"
"encoding/json"
"time"
"github.com/sourcegraph/sourcegraph/internal/workerutil"
"github.com/sourcegraph/sourcegraph/lib/errors"
)
type Index struct {
ID int `json:"id"`
Commit string `json:"commit"`
QueuedAt time.Time `json:"queuedAt"`
State string `json:"state"`
FailureMessage *string `json:"failureMessage"`
StartedAt *time.Time `json:"startedAt"`
FinishedAt *time.Time `json:"finishedAt"`
ProcessAfter *time.Time `json:"processAfter"`
NumResets int `json:"numResets"`
NumFailures int `json:"numFailures"`
RepositoryID int `json:"repositoryId"`
LocalSteps []string `json:"local_steps"`
RepositoryName string `json:"repositoryName"`
DockerSteps []DockerStep `json:"docker_steps"`
Root string `json:"root"`
Indexer string `json:"indexer"`
IndexerArgs []string `json:"indexer_args"` // TODO - convert this to `IndexCommand string`
Outfile string `json:"outfile"`
ExecutionLogs []workerutil.ExecutionLogEntry `json:"execution_logs"`
Rank *int `json:"placeInQueue"`
AssociatedUploadID *int `json:"associatedUpload"`
}
func (i Index) RecordID() int {
return i.ID
}
type GetIndexesOptions struct {
RepositoryID int
State string
Term string
Limit int
Offset int
}
type DockerStep struct {
Root string `json:"root"`
Image string `json:"image"`
Commands []string `json:"commands"`
}
func (s *DockerStep) Scan(value any) error {
b, ok := value.([]byte)
if !ok {
return errors.Errorf("value is not []byte: %T", value)
}
return json.Unmarshal(b, &s)
}
func (s DockerStep) Value() (driver.Value, error) {
return json.Marshal(s)
}