1 // RPC primitives for safcm: message and additional types
3 // Copyright (C) 2021 Simon Ruderich
5 // This program is free software: you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation, either version 3 of the License, or
8 // (at your option) any later version.
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
15 // You should have received a copy of the GNU General Public License
16 // along with this program. If not, see <http://www.gnu.org/licenses/>.
28 msg() // unused, only to implement interface
36 type MsgInfoReq struct {
41 type MsgInfoResp struct {
49 type MsgSyncReq struct {
51 Groups []string // for commands
53 Files map[string]*File
58 type MsgSyncResp struct {
59 FileChanges []FileChange
60 PackageChanges []PackageChange
61 ServiceChanges []ServiceChange
62 CommandChanges []CommandChange
67 type MsgQuitReq struct {
69 type MsgQuitResp struct {
72 func (MsgLog) msg() {}
73 func (MsgInfoReq) msg() {}
74 func (MsgInfoResp) msg() {}
75 func (MsgSyncReq) msg() {}
76 func (MsgSyncResp) msg() {}
77 func (MsgQuitReq) msg() {}
78 func (MsgQuitResp) msg() {}
81 // Necessary to receive "into" an interface type
82 gob.Register(MsgLog{})
83 gob.Register(MsgInfoReq{})
84 gob.Register(MsgInfoResp{})
85 gob.Register(MsgSyncReq{})
86 gob.Register(MsgSyncResp{})
87 gob.Register(MsgQuitReq{})
88 gob.Register(MsgQuitResp{})
91 // Types used in messages
94 OrigGroup string // group which provided this file
100 Uid int //lint:ignore ST1003 UID is too ugly
102 Gid int //lint:ignore ST1003 GID is too ugly
106 TriggerCommands []string
109 type Command struct {
110 OrigGroup string // group which provided this command
114 type FileChange struct {
121 type FileChangeInfo struct {
124 Uid int //lint:ignore ST1003 UID is too ugly
126 Gid int //lint:ignore ST1003 GID is too ugly
129 type PackageChange struct {
133 type ServiceChange struct {
139 type CommandChange struct {
141 Trigger string // path which triggered this command (optional)
142 Output string // stdout and stderr combined