diff options
author | KatolaZ <katolaz@freaknet.org> | 2017-07-12 08:53:12 +0100 |
---|---|---|
committer | KatolaZ <katolaz@freaknet.org> | 2017-07-12 08:53:12 +0100 |
commit | b3ca09586c23831d9f089ab8a023580c403f8e55 (patch) | |
tree | 60bd13a7efe3a2ea210890fb9b486d6d68a90409 /types.go | |
parent | 32b09256150d139e77d04533f28d0c26a32b12bd (diff) |
reorganised types and modules
Diffstat (limited to 'types.go')
-rw-r--r-- | types.go | 79 |
1 files changed, 79 insertions, 0 deletions
diff --git a/types.go b/types.go new file mode 100644 index 0000000..b14a103 --- /dev/null +++ b/types.go @@ -0,0 +1,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 +} |