objects

package
v0.0.0-...-80377ec Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 10, 2023 License: Apache-2.0 Imports: 18 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ContainerPartition

func ContainerPartition(containerName string) (string, string)

func GetContentType

func GetContentType(ct string) string

func IsIdentical

func IsIdentical(manifest []Manifest, path string) (bool, error)

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:

https://github.com/openstack/python-swiftclient/blob/e65070964c7b1e04119c87e5f344d39358780d18/swiftclient/service.py#L1024

type GetManifestOpts

type GetManifestOpts struct {
	ContainerName     string
	ContentLength     int64
	ETag              string
	ObjectManifest    string
	ObjectName        string
	Manifest          string
	StaticLargeObject bool
}

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

func ExtractMultipartManifest(body []byte) ([]Manifest, error)

ExtractMultipartManifest will extract a manifest returned when downloading an object using DownloadOpts.MultipartManifest = "get".

func (*Manifest) UnmarshalJSON

func (r *Manifest) UnmarshalJSON(b []byte) error

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
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL