versions

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2021 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func OfPathByName

func OfPathByName(client *s3.S3, bucketName string, path string) (map[string]Versions, error)

OfPathByName returns a collection of versions of objects in a bucket that have the given path prefix, indexed by path name as a map of object paths to its generation list. If an empty string is given as a path prefix, all versions of all objects in the bucket will be returned.

Types

type Version

type Version struct {
	Key            string
	ID             string
	LastModified   time.Time
	IsLatest       bool
	IsDeleteMarker bool
	ETag           string
	Size           int64
}

Version represents a version or delete marker of an object in AWS

func FromAWSDeleteMarker

func FromAWSDeleteMarker(marker *s3.DeleteMarkerEntry) Version

FromAWSDeleteMarker builds a Version object from a s3.DeleteMarkerEntry

func FromAWSVersion

func FromAWSVersion(obj *s3.ObjectVersion) Version

FromAWSVersion builds a Version object from a s3.ObjectVersion

func (*Version) String

func (v *Version) String() string

String converts a Version into a string.

func (*Version) StringWithoutName

func (v *Version) StringWithoutName() string

StringWithoutName converts a Version to a string, omitting the name of the file. This is useful for situations where the name is implicit,

type Versions

type Versions []Version

Versions represents a collection of versions

func OfBucket

func OfBucket(client *s3.S3, bucketName string) (Versions, error)

OfBucket returns a collection of all versions of all objects in a bucket.

func OfPath

func OfPath(client *s3.S3, bucketName string, path string) (Versions, error)

OfPath returns a collection of versions of objects in a bucket that have the given path prefix. If an empty string is given as a path prefix, all versions of all objects in the bucket will be returned.

func (Versions) SortByLastModifiedAsc

func (gs Versions) SortByLastModifiedAsc()

SortByLastModifiedAsc sorts the versions by ascending order of their creation date.

func (Versions) SortByLastModifiedDesc

func (gs Versions) SortByLastModifiedDesc()

SortByLastModifiedDesc sorts the versions by descending order of their creation date.

func (Versions) SortIfNeeded

func (gs Versions) SortIfNeeded(sortFunc func(i, j int) bool)

SortIfNeeded sorts the collection of versions by the given sortFunc, but checks first if the list isn't already sorted by the same sortFunc. If the collection is already sorted, nothing is done.

Jump to

Keyboard shortcuts

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