Documentation
¶
Index ¶
- func ContainerPartition(containerName string) (string, string)
- func FileMD5Sum(filename string) (string, error)
- func GetContentType(ct string) string
- func IsIdentical(manifest []Manifest, path string) (bool, error)
- type DownloadOpts
- type DownloadResult
- type GetManifestOpts
- type Manifest
- type UploadOpts
- type UploadResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ContainerPartition ¶
func FileMD5Sum ¶
func GetContentType ¶
Types ¶
type DownloadOpts ¶
type DownloadOpts struct {
// Delimiter is a delimiter to specify for listing objects.
Delimiter string
// IgnoreMtime won't update the downloaded file's mtime.
IgnoreMtime bool
// NoDownload won't actually download the object.
NoDownload bool
// OutDirectory is a directory to save the objects to.
OutDirectory string
// OutFile is a file to save the object to.
OutFile string
// Prefix is a prefix string for a container.
Prefix string
// RemovePrefix will remove the prefix from the container.
RemovePrefix bool
// SkipIdentical will skip identical objects already downloaded.
SkipIdentical bool
// YesAll will download everything.
YesAll bool
}
DownloadOpts represents options used for downloading an object.
type DownloadResult ¶
type DownloadResult struct {
Action string
Container string
Content io.ReadCloser
Object string
Path string
PseudoDir bool
Success bool
}
func Download ¶
func Download(client *gophercloud.ServiceClient, containerName string, objectNames []string, opts *DownloadOpts) ([]DownloadResult, error)
Download downloads one or more objects from an Object Storage account. It is roughly based on the python-swiftclient implementation:
type GetManifestOpts ¶
type Manifest ¶
type Manifest struct {
Bytes int64 `json:"bytes"`
ContentType string `json:"content_type"`
Hash string `json:"hash"`
Name string `json:"name"`
LastModified time.Time `json:"-"`
}
Manifest represents an object manifest.
func ExtractMultipartManifest ¶
ExtractMultipartManifest will extract a manifest returned when downloading an object using DownloadOpts.MultipartManifest = "get".
func GetManifest ¶
func GetManifest(client *gophercloud.ServiceClient, opts GetManifestOpts) ([]Manifest, error)
func (*Manifest) UnmarshalJSON ¶
type UploadOpts ¶
type UploadOpts struct {
// Changed will prevent an upload if the mtime and size of the source
// and destination objects are the same.
Changed bool
// Checksum will enforce a comparison of the md5sum/etag between the
// local and remote object to ensure integrity.
Checksum bool
// Content is an io.Reader which can be used to upload a object via an
// open file descriptor or any other type of stream.
Content io.Reader
// DirMarker will create a directory marker.
DirMarker bool
// LeaveSegments will cause old segments of an object to be left in a
// container.
LeaveSegments bool
// Metadata is optional metadata to place on the object.
Metadata map[string]string
// Path is a local filesystem path of an object to be uploaded.
Path string
// Segment container is a custom container name to store object segments.
// If one is not specified, then "containerName_segments" will be used.
SegmentContainer string
// SegmentSize is the size of each segment. An object will be split into
// pieces (segments) of this size.
SegmentSize int64
// SkipIdentical is a more thorough check than "Changed". It will compare
// the md5sum/etag of the object as a comparison.
SkipIdentical bool
// StoragePolicy represents a storage policy of where the object should be
// uploaded.
StoragePolicy string
// UseSLO will have the object uploaded using Static Large Object support.
UseSLO bool
}
UploadOpts represents options used for uploading an object.
type UploadResult ¶
type UploadResult struct {
Action string
Container string
LargeObject bool
Object string
Path string
Status string
Success bool
}
func Upload ¶
func Upload(client *gophercloud.ServiceClient, containerName, objectName string, opts *UploadOpts) (*UploadResult, error)
Upload uploads a single object to swift.
Click to show internal directories.
Click to hide internal directories.