github.com/cloud-foundations/dominator@v0.0.0-20221004181915-6e4fee580046/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 type BoostCpuLimitRequest struct{} 13 14 type BoostCpuLimitResponse struct{} 15 16 type Configuration struct { 17 CpuPercent uint 18 NetworkSpeedPercent uint 19 ScanSpeedPercent uint 20 ScanExclusionList []string 21 } 22 23 type FetchRequest struct { 24 ServerAddress string 25 Wait bool 26 Hashes []hash.Hash 27 } 28 29 type FetchResponse struct{} 30 31 type GetConfigurationRequest struct{} 32 33 type GetConfigurationResponse Configuration 34 35 // The GetFiles() RPC is fully streamed. 36 // The client sends a stream of strings (filenames) it wants. An empty string 37 // signals the end of the stream. 38 // The server (the sub) sends a stream of GetFileResponse messages. No response 39 // is sent for the end-of-stream signal. 40 41 type GetFileResponse struct { 42 Error error 43 Size uint64 44 } // File data are streamed afterwards. 45 46 type PollRequest struct { 47 HaveGeneration uint64 48 ShortPollOnly bool // If true, do not send FileSystem or ObjectCache. 49 } 50 51 type PollResponse struct { 52 NetworkSpeed uint64 // Capacity of the network interface. 53 CurrentConfiguration Configuration 54 FetchInProgress bool // Fetch() and Update() mutually exclusive 55 UpdateInProgress bool 56 LastFetchError string 57 LastUpdateError string 58 LastUpdateHadTriggerFailures bool 59 LastSuccessfulImageName string 60 FreeSpace *uint64 61 StartTime time.Time 62 PollTime time.Time 63 ScanCount uint64 64 DurationOfLastScan time.Duration 65 GenerationCount uint64 66 FileSystemFollows bool 67 FileSystem *filesystem.FileSystem // Streamed separately. 68 ObjectCache objectcache.ObjectCache // Streamed separately. 69 } // FileSystem is encoded afterwards, followed by ObjectCache. 70 71 type SetConfigurationRequest Configuration 72 73 type SetConfigurationResponse struct{} 74 75 type FileToCopyToCache struct { 76 Name string 77 Hash hash.Hash 78 DoHardlink bool 79 } 80 81 type Hardlink struct { 82 NewLink string 83 Target string 84 } 85 86 type Inode struct { 87 Name string 88 filesystem.GenericInode 89 } 90 91 type UpdateRequest struct { 92 ImageName string 93 Wait bool 94 // The ordering here reflects the ordering that the sub is expected to use. 95 FilesToCopyToCache []FileToCopyToCache 96 DirectoriesToMake []Inode 97 InodesToMake []Inode 98 HardlinksToMake []Hardlink 99 PathsToDelete []string 100 InodesToChange []Inode 101 MultiplyUsedObjects map[hash.Hash]uint64 102 Triggers *triggers.Triggers 103 } 104 105 type UpdateResponse struct{} 106 107 type CleanupRequest struct { 108 Hashes []hash.Hash 109 } 110 111 type CleanupResponse struct{}