Documentation ¶
Overview ¶
Package swiftlygo makes working with Large Objects in OpenStack Object Storage easier.
The auth subpackage provides a convenient abstraction for talking to an Object Storage instance. See the documentation of the auth package for details on how to authenticate with Object Storage Instances. The pipeline subpackage implements a low-level API for Static Large Object creation if the SloUploader doesn't offer the level of control that your application requires.
The root swiftlygo package provides functionality for easily creating Dynamic Large Objects and Static Large Objects.
Both the SloUploader and DloUploader types are easy to use. They only have one method, Upload(), that performs a synchronous upload (it will only return after the upload is complete). The SloUploader also exposes a Status struct that can be used during an upload to query the progress up the upload.
Index ¶
- type DloUploader
- type SloUploader
- type Status
- func (s *Status) NumberUploaded() uint
- func (s *Status) PercentComplete() float64
- func (s *Status) Print()
- func (s *Status) Rate() float64
- func (s *Status) RateMBPS() float64
- func (s *Status) Start()
- func (s *Status) Stop()
- func (s *Status) String() string
- func (s *Status) TimeRemaining() time.Duration
- func (s *Status) TotalUploads() uint
- func (s *Status) UploadComplete()
- func (s *Status) UploadSize() uint
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DloUploader ¶
type DloUploader struct {
// contains filtered or unexported fields
}
DloUploader prepares and executes the upload of a Dynamic Large Object manifest.
func NewDloUploader ¶
func NewDloUploader(connection auth.Destination, dloContainer, dloName, objectContainer, prefix string) *DloUploader
NewDloUploader returns an uploader that will create a new DLO. The dloContainer determines where the DLO manifest file is stored, whereas the objectContainer determines which container the DLO will look in for files beginning with the given prefix. This allows you to store the DLO in one container while referencing files within another.
func (*DloUploader) Upload ¶
func (d *DloUploader) Upload() error
Upload actually performs the upload that creates the DLO.
type SloUploader ¶
type SloUploader struct { Status *Status // contains filtered or unexported fields }
SloUploader uploads a file to object storage
func NewSloUploader ¶
func NewSloUploader(connection auth.Destination, chunkSize uint, container string, object string, source *os.File, maxUploads uint, onlyMissing bool, outputFile io.Writer) (*SloUploader, error)
NewUploader prepares an upload for an SLO by constructing a data pipeline that will read the provided file, split it into pieces of chunkSize bytes, and upload it into the provided destination in the provided container with the given object name.
func (*SloUploader) Upload ¶
func (u *SloUploader) Upload() error
Upload uploads the sloUploader's source file to object storage
type Status ¶
type Status struct {
// contains filtered or unexported fields
}
func NewStatus ¶
NewStatus creates a new Status with the number of individual uploads and the size of each upload.
func (*Status) NumberUploaded ¶
NumberUploaded returns how many file chunks have been uploaded.
func (*Status) PercentComplete ¶
PercentComplete returns much of the upload is complete.
func (*Status) Print ¶
func (s *Status) Print()
Print sends the current status of the upload to the output channel.
func (*Status) Start ¶
func (s *Status) Start()
Start begins timing the upload. Only call this once.
func (*Status) Stop ¶
func (s *Status) Stop()
Stop finalizes the duration of the upload. Only call this once.
func (*Status) TimeRemaining ¶
TimeRemaining estimates the amount of time remaining in the upload.
func (*Status) TotalUploads ¶
TotalUploads returns how many file chunks need to be uploaded total.
func (*Status) UploadComplete ¶
func (s *Status) UploadComplete()
UploadComplete marks that one chunk has been uploaded. Call this each time an upload succeeds.
func (*Status) UploadSize ¶
UploadSize returns the size of each file chunk (with the exception of the last file chunk, which can be any size less than this).
Directories ¶
Path | Synopsis |
---|---|
Package auth provides easy methods to authenticate with Object Storage The main fixture of the auth package is the Destination interface.
|
Package auth provides easy methods to authenticate with Object Storage The main fixture of the auth package is the Destination interface. |
mock
Package mock provides fake object storage endpoints for testing The structs defined here all implement the github.com/ibmjstart/swiftlygo/auth.Destination interface and are therefore useful for testing any code that uploads data via a destination.
|
Package mock provides fake object storage endpoints for testing The structs defined here all implement the github.com/ibmjstart/swiftlygo/auth.Destination interface and are therefore useful for testing any code that uploads data via a destination. |
Package pipeline implements a low-level pipelined API for SLO uploads.
|
Package pipeline implements a low-level pipelined API for SLO uploads. |