github.com/cloud-foundations/dominator@v0.0.0-20221004181915-6e4fee580046/proto/imageunpacker/messages.go (about) 1 package imageunpacker 2 3 import "time" 4 5 const ( 6 StatusStreamNoDevice = 0 7 StatusStreamNotMounted = 1 8 StatusStreamMounted = 2 9 StatusStreamScanning = 3 10 StatusStreamScanned = 4 11 StatusStreamFetching = 5 12 StatusStreamUpdating = 6 13 StatusStreamPreparing = 7 14 StatusStreamExporting = 8 15 StatusStreamNoFileSystem = 9 16 ) 17 18 type DeviceInfo struct { 19 DeviceName string 20 Size uint64 21 StreamName string 22 } 23 24 // The AddDevice() RPC is an exclusive transaction following this sequence: 25 // - Server sends string "\n" if Client should proceed with attaching a device 26 // to the server, else it sends a string indicating an error 27 // - Client sends string containing the DeviceID that was just attached 28 // - Server sends "\n" if device was found, else an error message. 29 // - End of transaction. Method completes. 30 31 type AssociateStreamWithDeviceRequest struct { 32 StreamName string 33 DeviceId string 34 } 35 36 type AssociateStreamWithDeviceResponse struct{} 37 38 type ExportImageRequest struct { 39 StreamName string 40 Type string 41 Destination string 42 } 43 44 type ExportImageResponse struct{} 45 46 type GetStatusRequest struct{} 47 48 type GetStatusResponse struct { 49 Devices map[string]DeviceInfo // Key: DeviceId. 50 ImageStreams map[string]ImageStreamInfo // Key: StreamName. 51 TimeSinceLastUsed time.Duration 52 } 53 54 type ImageStreamInfo struct { 55 DeviceId string 56 Status StreamStatus 57 } 58 59 type PrepareForCaptureRequest struct { 60 StreamName string 61 } 62 63 type PrepareForCaptureResponse struct{} 64 65 type PrepareForCopyRequest struct { 66 StreamName string 67 } 68 69 type PrepareForCopyResponse struct{} 70 71 type PrepareForUnpackRequest struct { 72 StreamName string 73 SkipIfPrepared bool 74 DoNotWaitForResult bool 75 } 76 77 type PrepareForUnpackResponse struct{} 78 79 type RemoveDeviceRequest struct { 80 DeviceId string 81 } 82 83 type RemoveDeviceResponse struct{} 84 85 type StreamStatus uint 86 87 func (status StreamStatus) String() string { 88 return status.string() 89 } 90 91 type UnpackImageRequest struct { 92 StreamName string 93 ImageLeafName string 94 } 95 96 type UnpackImageResponse struct{}