Documentation ¶
Index ¶
- func Fixpath(name string) string
- func ReadImages(client *rokka.Client, images chan string, r Reader, bar *pb.ProgressBar) error
- func WriteImages(client *rokka.Client, images chan string, results chan OperationResult, ...)
- type CopyAllSourceImagesWriter
- type DeleteAllSourceImagesWriter
- type MassUploadOptions
- type MassUploader
- type NoopWriter
- type OperationResult
- type Options
- type ProgressCounter
- type Reader
- type SourceImagesReader
- type Writer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Fixpath ¶
Fixpath returns an absolute path on the current OS which is mostly relevant for windows.
func ReadImages ¶
ReadImages is a simple wrapper around the Reader.Read call. In the future there may be things we can move here.
func WriteImages ¶
func WriteImages(client *rokka.Client, images chan string, results chan OperationResult, w Writer, concurrency int, flushInterval int)
WriteImages creates a group of goroutines bound by the concurrency option. It executes the Writer.Write command for each flushInterval amount of images.
Types ¶
type CopyAllSourceImagesWriter ¶
CopyAllSourceImagesWriter uses the copy all API to transfer images from one organization to a destination organization.
func (*CopyAllSourceImagesWriter) Write ¶
func (cas *CopyAllSourceImagesWriter) Write(client *rokka.Client, images []string) OperationResult
type DeleteAllSourceImagesWriter ¶
type DeleteAllSourceImagesWriter struct {
Organization string
}
DeleteAllSourceImagesWriter deletes source images of an organization.
func (*DeleteAllSourceImagesWriter) Write ¶
func (das *DeleteAllSourceImagesWriter) Write(client *rokka.Client, images []string) OperationResult
type MassUploadOptions ¶
MassUploadOptions are specific CLI flags for the mass upload CLI cmd.
type MassUploader ¶
type MassUploader struct { BasePath string Recursive bool Extensions []string Organization string UserMetadata map[string]interface{} }
MassUploader is both a Reader and Writer which reads from the fileSystem and creates source images in the writer.
func (*MassUploader) Read ¶
func (mu *MassUploader) Read(client *rokka.Client, images chan string, bar *pb.ProgressBar) error
Read walks the directory specified in the CLI and adds the found images (filtered by extensions) to the image channel.
func (*MassUploader) Write ¶
func (mu *MassUploader) Write(client *rokka.Client, images []string) OperationResult
Write creates source images for each image.
type NoopWriter ¶
type NoopWriter struct{}
NoopWriter does not do anything. It is used for the dry run.
func (*NoopWriter) Write ¶
func (nw *NoopWriter) Write(client *rokka.Client, images []string) OperationResult
type OperationResult ¶
OperationResult contains the result of the operation
type ProgressCounter ¶
ProgressCounter returns the total images to be processed. It is used for the progress bar and confirmation messages of the batch CLIs. It's an optional interface to implement because not all operations allow to know beforehand how many images there are.
type Reader ¶
Reader allows to read from an arbitrary location and inserts the image identifications to the channel for concurrent processing. The values within the images channel are string, and therefore can be pretty much anything. The writer used after reading needs to know and understand what an image string actually represents. E.g. in the case of copy-all it's an existing image hash. In the case of massUpload it's a filesystem path to an image.
type SourceImagesReader ¶
type SourceImagesReader struct {
Organization string
}
SourceImagesReader reads images from rokka on an organization.
type Writer ¶
type Writer interface {
Write(client *rokka.Client, images []string) OperationResult
}
Writer operates on the previously found image list and executes a write operation. This can be pretty much anything. For example it could create source images on rokka. Or delete a source image on rokka.