github.com/cloud-foundations/dominator@v0.0.0-20221004181915-6e4fee580046/proto/imageserver/messages.go (about)

     1  package imageserver
     2  
     3  import (
     4  	"time"
     5  
     6  	"github.com/Cloud-Foundations/Dominator/lib/hash"
     7  	"github.com/Cloud-Foundations/Dominator/lib/image"
     8  )
     9  
    10  type AddImageRequest struct {
    11  	ImageName string
    12  	Image     *image.Image
    13  }
    14  
    15  type AddImageResponse struct{}
    16  
    17  type ChangeImageExpirationRequest struct {
    18  	ExpiresAt time.Time
    19  	ImageName string
    20  }
    21  
    22  type ChangeImageExpirationResponse struct {
    23  	Error string
    24  }
    25  
    26  type ChangeOwnerRequest struct {
    27  	DirectoryName string
    28  	OwnerGroup    string
    29  }
    30  
    31  type ChangeOwnerResponse struct{}
    32  
    33  type CheckDirectoryRequest struct {
    34  	DirectoryName string
    35  }
    36  
    37  type CheckDirectoryResponse struct {
    38  	DirectoryExists bool
    39  }
    40  
    41  type CheckImageRequest struct {
    42  	ImageName string
    43  }
    44  
    45  type CheckImageResponse struct {
    46  	ImageExists bool
    47  }
    48  
    49  type DeleteImageRequest struct {
    50  	ImageName string
    51  }
    52  
    53  type DeleteImageResponse struct{}
    54  
    55  type DeleteUnreferencedObjectsRequest struct {
    56  	Percentage uint8
    57  	Bytes      uint64
    58  }
    59  
    60  type DeleteUnreferencedObjectsResponse struct{}
    61  
    62  type FindLatestImageRequest struct {
    63  	DirectoryName        string
    64  	IgnoreExpiringImages bool
    65  }
    66  
    67  type FindLatestImageResponse struct {
    68  	ImageName string
    69  	Error     string
    70  }
    71  
    72  type GetImageExpirationRequest struct {
    73  	ImageName string
    74  }
    75  
    76  type GetImageExpirationResponse struct {
    77  	Error     string
    78  	ExpiresAt time.Time
    79  }
    80  
    81  type GetImageRequest struct {
    82  	ImageName                  string
    83  	IgnoreFilesystem           bool
    84  	IgnoreFilesystemIfExpiring bool
    85  	Timeout                    time.Duration
    86  }
    87  
    88  type GetImageResponse struct {
    89  	Image *image.Image
    90  }
    91  
    92  const (
    93  	OperationAddImage = iota
    94  	OperationDeleteImage
    95  	OperationMakeDirectory
    96  )
    97  
    98  // The GetImageUpdates() RPC is fully streamed.
    99  // The client sends no information to the server.
   100  // The server sends a stream of ImageUpdate messages.
   101  
   102  type ImageUpdate struct {
   103  	Name      string // "" signifies initial list is sent, changes to follow.
   104  	Directory *image.Directory
   105  	Operation uint
   106  }
   107  
   108  // The ListDirectories() RPC is fully streamed.
   109  // The client sends no information to the server.
   110  // The server sends a stream of image.Directory values with an empty string
   111  // for the Name field signifying the end of the list.
   112  
   113  // The ListImages() RPC is fully streamed.
   114  // The client sends no information to the server.
   115  // The server sends a stream of strings (image names) with an empty string
   116  // signifying the end of the list.
   117  
   118  // The ListUnreferencedObjects() RPC is fully streamed.
   119  // The client sends no information to the server.
   120  // The server sends a stream of Object values with a zero Size field signifying
   121  // the end of the stream.
   122  
   123  type Object struct {
   124  	Hash hash.Hash
   125  	Size uint64
   126  }
   127  
   128  type MakeDirectoryRequest struct {
   129  	DirectoryName string
   130  }
   131  
   132  type MakeDirectoryResponse struct{}