blob: b14a103e2225ef1d506b4d0047ea664068122070 (
plain)
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
|
package main
import (
"golang.org/x/crypto/openpgp"
)
const (
SCORSH_ERR_NO_FILE = -(1 << iota)
SCORSH_ERR_KEYRING
SCORSH_ERR_NO_REPO
SCORSH_ERR_NO_COMMIT
SCORSH_ERR_SIGNATURE
)
// the SCORSHmsg type represents messages received from the spool and
// sent to workers
type SCORSHmsg struct {
repo string
branch string
old_rev string
new_rev string
}
type SCORSHcmd struct {
URL string
hash string
}
type SCORSHtag struct {
TagName string
Keyrings []string
Commands []SCORSHcmd
}
// Configuration of a worker
type SCORSHworker_cfg struct {
Name string `yaml:"w_name"`
Repos []string `yaml:"w_repos"`
Folder string `yaml:"w_folder"`
Logfile string `yaml:"w_logfile"`
Tagfile string `yaml:"w_tagfile"`
Keyrings []string `yaml:"w_keyrings"`
}
// State of a worker
type SCORSHworker_state struct {
Tags map[string]SCORSHtag
Keys map[string]openpgp.KeyRing
Chan chan SCORSHmsg
}
// The type SCORSHworker represents the configuration and state of a
// worker
type SCORSHworker struct {
SCORSHworker_cfg
SCORSHworker_state
}
// Configuration of the master
type SCORSHmaster_cfg struct {
Spooldir string `yaml:"s_spooldir"`
Logfile string `yaml:"s_logfile"`
LogPrefix string `yaml:"s_logprefix"`
Workers []SCORSHworker `yaml:"s_workers"`
}
// State of the master
type SCORSHmaster_state struct {
Spooler chan SCORSHmsg
Repos map[string][]*SCORSHworker
}
// The type SCORSHmaster represents the configuration and state of the
// master
type SCORSHmaster struct {
SCORSHmaster_cfg
SCORSHmaster_state
}
|