github.com/Cloud-Foundations/Dominator@v0.3.4/proto/sub/messages.go (about) 1 package sub 2 3 import ( 4 "time" 5 6 "github.com/Cloud-Foundations/Dominator/lib/filesystem" 7 "github.com/Cloud-Foundations/Dominator/lib/hash" 8 "github.com/Cloud-Foundations/Dominator/lib/objectcache" 9 "github.com/Cloud-Foundations/Dominator/lib/triggers" 10 ) 11 12 const ( 13 DisruptionStateAnytime = 0 // Not implemented or configured. 14 DisruptionStatePermitted = 1 15 DisruptionStateRequested = 2 16 DisruptionStateDenied = 3 17 18 ErrorDisruptionPending = "disruption pending" 19 ErrorDisruptionDenied = "disruption denied" 20 ) 21 22 type BoostCpuLimitRequest struct{} 23 24 type BoostCpuLimitResponse struct{} 25 26 type CleanupRequest struct { 27 Hashes []hash.Hash 28 } 29 30 type CleanupResponse struct{} 31 32 type DisruptionState uint 33 34 type FetchRequest struct { 35 LockFor time.Duration // Duration to lock other clients from mutating. 36 ServerAddress string 37 Wait bool 38 Hashes []hash.Hash 39 } 40 41 type FetchResponse struct { 42 LockedUntil time.Time 43 } 44 45 type GetConfigurationRequest struct{} 46 47 type GetConfigurationResponse Configuration 48 49 // The GetFiles() RPC is fully streamed. 50 // The client sends a stream of strings (filenames) it wants. An empty string 51 // signals the end of the stream. 52 // The server (the sub) sends a stream of GetFileResponse messages. No response 53 // is sent for the end-of-stream signal. 54 55 type GetFileResponse struct { 56 Error string 57 Size uint64 58 } // File data are streamed afterwards. 59 60 type PollRequest struct { 61 HaveGeneration uint64 62 LockFor time.Duration 63 ShortPollOnly bool // If true, do not send FileSystem or ObjectCache. 64 } 65 66 type PollResponse struct { 67 NetworkSpeed uint64 // Capacity of the network interface. 68 CurrentConfiguration Configuration 69 FetchInProgress bool // Fetch() and Update() mutually exclusive 70 UpdateInProgress bool 71 InitialImageName string 72 LastFetchError string 73 LastNote string // Updated after successful Update(). 74 LastSuccessfulImageName string 75 LastUpdateError string 76 LastUpdateHadTriggerFailures bool 77 LastWriteError string 78 LockedByAnotherClient bool // Fetch() and Update() restricted. 79 LockedUntil time.Time 80 FreeSpace *uint64 81 StartTime time.Time 82 PollTime time.Time 83 ScanCount uint64 84 DurationOfLastScan time.Duration 85 GenerationCount uint64 86 SystemUptime *time.Duration 87 DisruptionState DisruptionState 88 FileSystemFollows bool 89 FileSystem *filesystem.FileSystem // Streamed separately. 90 ObjectCache objectcache.ObjectCache // Streamed separately. 91 } // FileSystem is encoded afterwards, followed by ObjectCache. 92 93 type SetConfigurationRequest Configuration 94 95 type SetConfigurationResponse struct{} 96 97 type UpdateRequest struct { 98 ForceDisruption bool 99 ImageName string 100 Wait bool 101 // The ordering here reflects the ordering that the sub is expected to use. 102 FilesToCopyToCache []FileToCopyToCache 103 DirectoriesToMake []Inode 104 InodesToMake []Inode 105 HardlinksToMake []Hardlink 106 PathsToDelete []string 107 InodesToChange []Inode 108 MultiplyUsedObjects map[hash.Hash]uint64 109 Triggers *triggers.Triggers 110 } 111 112 type UpdateResponse struct{}