github.com/Cloud-Foundations/Dominator@v0.3.4/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  	StatusStreamTransferring = 10
    17  )
    18  
    19  type DeviceInfo struct {
    20  	DeviceName string
    21  	Size       uint64
    22  	StreamName string
    23  }
    24  
    25  // The AddDevice() RPC is an exclusive transaction following this sequence:
    26  // - Server sends string "\n" if Client should proceed with attaching a device
    27  //   to the server, else it sends a string indicating an error
    28  // - Client sends string containing the DeviceID that was just attached
    29  // - Server sends "\n" if device was found, else an error message.
    30  // - End of transaction. Method completes.
    31  
    32  type AssociateStreamWithDeviceRequest struct {
    33  	StreamName string
    34  	DeviceId   string
    35  }
    36  
    37  type AssociateStreamWithDeviceResponse struct{}
    38  
    39  type ClaimDeviceRequest struct {
    40  	DeviceId   string
    41  	DeviceName string // Relative to "/dev" directory.
    42  }
    43  
    44  type ClaimDeviceResponse struct{}
    45  
    46  type ExportImageRequest struct {
    47  	StreamName  string
    48  	Type        string
    49  	Destination string
    50  }
    51  
    52  type ExportImageResponse struct{}
    53  
    54  type ForgetStreamRequest struct {
    55  	StreamName string
    56  }
    57  
    58  type ForgetStreamResponse struct{}
    59  
    60  type GetRawRequest struct {
    61  	StreamName string
    62  }
    63  
    64  type GetRawResponse struct {
    65  	Error string
    66  	Size  uint64
    67  } // Image data are streamed afterwards.
    68  
    69  type GetStatusRequest struct{}
    70  
    71  type GetStatusResponse struct {
    72  	Devices           map[string]DeviceInfo      // Key: DeviceId.
    73  	ImageStreams      map[string]ImageStreamInfo // Key: StreamName.
    74  	TimeSinceLastUsed time.Duration
    75  }
    76  
    77  type ImageStreamInfo struct {
    78  	DeviceId string
    79  	Status   StreamStatus
    80  }
    81  
    82  type PrepareForCaptureRequest struct {
    83  	StreamName string
    84  }
    85  
    86  type PrepareForCaptureResponse struct{}
    87  
    88  type PrepareForCopyRequest struct {
    89  	StreamName string
    90  }
    91  
    92  type PrepareForCopyResponse struct{}
    93  
    94  type PrepareForUnpackRequest struct {
    95  	StreamName         string
    96  	SkipIfPrepared     bool
    97  	DoNotWaitForResult bool
    98  }
    99  
   100  type PrepareForUnpackResponse struct{}
   101  
   102  type RemoveDeviceRequest struct {
   103  	DeviceId string
   104  }
   105  
   106  type RemoveDeviceResponse struct{}
   107  
   108  type StreamStatus uint
   109  
   110  func (status StreamStatus) String() string {
   111  	return status.string()
   112  }
   113  
   114  type UnpackImageRequest struct {
   115  	StreamName    string
   116  	ImageLeafName string
   117  }
   118  
   119  type UnpackImageResponse struct{}