fs

package
v0.0.0-...-a6941c0 Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2016 License: Apache-2.0 Imports: 33 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BucketPrivate         = BucketACL("private")
	BucketPublicRead      = BucketACL("public-read")
	BucketPublicReadWrite = BucketACL("public-read-write")
)

different types of ACL's currently supported for buckets

Variables

View Source
var ErrDirNotEmpty = errors.New("directory not empty")

ErrDirNotEmpty is used to throw error on directories which have atleast one regular file or a symlink left

View Source
var ErrSkipDir = errors.New("skip this directory")

ErrSkipDir is used as a return value from WalkFuncs to indicate that the directory named in the call is to be skipped. It is not returned as an error by any function.

View Source
var ErrSkipFile = errors.New("skip this file")

ErrSkipFile is used as a return value from WalkFuncs to indicate that the file named in the call is to be skipped. It is not returned as an error by any function.

Functions

func IsValidBucketACL

func IsValidBucketACL(acl string) bool

IsValidBucketACL - is provided acl string supported

func IsValidBucketName

func IsValidBucketName(bucket string) bool

IsValidBucketName - verify bucket name in accordance with

func IsValidObjectName

func IsValidObjectName(object string) bool

IsValidObjectName - verify object name in accordance with

func Walk

func Walk(root string, walkFn WalkFunc) error

Walk walks the file tree rooted at root, calling walkFn for each file or directory in the tree, including root.

func WalkUnsorted

func WalkUnsorted(root string, walkFn WalkFunc) error

WalkUnsorted walks the file tree rooted at root, calling walkFn for each file or directory in the tree, including root.

Types

type APINotImplemented

type APINotImplemented struct {
	API string
}

APINotImplemented - generic API not implemented error

func (APINotImplemented) Error

func (e APINotImplemented) Error() string

Return string an error formatted as the given text

type BackendCorrupted

type BackendCorrupted BackendError

BackendCorrupted - path has corrupted data

func (BackendCorrupted) Error

func (e BackendCorrupted) Error() string

Return string an error formatted as the given text

type BackendError

type BackendError struct {
	Path string
}

BackendError - generic disk backend error

type BadDigest

type BadDigest struct {
	Md5    string
	Bucket string
	Object string
}

BadDigest bad md5sum

func (BadDigest) Error

func (e BadDigest) Error() string

type BucketACL

type BucketACL string

BucketACL - bucket level access control

func (BucketACL) IsPrivate

func (b BucketACL) IsPrivate() bool

IsPrivate - is acl Private

func (BucketACL) IsPublicRead

func (b BucketACL) IsPublicRead() bool

IsPublicRead - is acl PublicRead

func (BucketACL) IsPublicReadWrite

func (b BucketACL) IsPublicReadWrite() bool

IsPublicReadWrite - is acl PublicReadWrite

func (BucketACL) String

func (b BucketACL) String() string

type BucketExists

type BucketExists struct {
	Bucket string
}

BucketExists bucket exists

func (BucketExists) Error

func (e BucketExists) Error() string

type BucketMetadata

type BucketMetadata struct {
	Name    string
	Created time.Time
	ACL     BucketACL
}

BucketMetadata - name and create date

type BucketMultipartResourcesMetadata

type BucketMultipartResourcesMetadata struct {
	KeyMarker          string
	UploadIDMarker     string
	NextKeyMarker      string
	NextUploadIDMarker string
	EncodingType       string
	MaxUploads         int
	IsTruncated        bool
	Upload             []*UploadMetadata
	Prefix             string
	Delimiter          string
	CommonPrefixes     []string
}

BucketMultipartResourcesMetadata - various types of bucket resources for inprogress multipart uploads

type BucketNameInvalid

type BucketNameInvalid GenericBucketError

BucketNameInvalid - bucketname provided is invalid

func (BucketNameInvalid) Error

func (e BucketNameInvalid) Error() string

Return string an error formatted as the given text

type BucketNotEmpty

type BucketNotEmpty struct {
	Bucket string
}

BucketNotEmpty bucket is not empty

func (BucketNotEmpty) Error

func (e BucketNotEmpty) Error() string

type BucketNotFound

type BucketNotFound struct {
	Bucket string
}

BucketNotFound bucket does not exist

func (BucketNotFound) Error

func (e BucketNotFound) Error() string

type BucketResourcesMetadata

type BucketResourcesMetadata struct {
	Prefix         string
	Marker         string
	NextMarker     string
	Maxkeys        int
	EncodingType   string
	Delimiter      string
	IsTruncated    bool
	CommonPrefixes []string
}

BucketResourcesMetadata - various types of bucket resources

type Buckets

type Buckets struct {
	Version  string `json:"version"`
	Metadata map[string]*BucketMetadata
}

Buckets holds acl information

type ChecksumMismatch

type ChecksumMismatch struct{}

ChecksumMismatch checksum mismatch

func (ChecksumMismatch) Error

func (e ChecksumMismatch) Error() string

type CompleteMultipartUpload

type CompleteMultipartUpload struct {
	Part []CompletePart
}

CompleteMultipartUpload container for completing multipart upload

type CompletePart

type CompletePart struct {
	PartNumber int
	ETag       string
}

CompletePart - completed part container

type CorruptedBackend

type CorruptedBackend struct {
	Backend string
}

CorruptedBackend backend found to be corrupted

func (CorruptedBackend) Error

func (e CorruptedBackend) Error() string

type DigestError

type DigestError struct {
	Bucket string
	Key    string
	Md5    string
}

DigestError - Generic Md5 error

type EntityTooLarge

type EntityTooLarge struct {
	GenericObjectError
	Size    string
	MaxSize string
}

EntityTooLarge - object size exceeds maximum limit

func (EntityTooLarge) Error

func (e EntityTooLarge) Error() string

Return string an error formatted as the given text

type ExpiredPresignedRequest

type ExpiredPresignedRequest struct{}

ExpiredPresignedRequest request already expired

func (ExpiredPresignedRequest) Error

func (e ExpiredPresignedRequest) Error() string

type Filesystem

type Filesystem struct {
	// contains filtered or unexported fields
}

Filesystem - local variables

func New

func New(rootPath string) (Filesystem, *probe.Error)

New instantiate a new donut

func (Filesystem) AbortMultipartUpload

func (fs Filesystem) AbortMultipartUpload(bucket, object, uploadID string) *probe.Error

AbortMultipartUpload - abort an incomplete multipart session

func (Filesystem) AutoExpiryThread

func (fs Filesystem) AutoExpiryThread(expiry time.Duration)

AutoExpiryThread - auto expiry thread

func (Filesystem) CompleteMultipartUpload

func (fs Filesystem) CompleteMultipartUpload(bucket, object, uploadID string, data io.Reader, signature *Signature) (ObjectMetadata, *probe.Error)

CompleteMultipartUpload - complete a multipart upload and persist the data

func (Filesystem) CreateObject

func (fs Filesystem) CreateObject(bucket, object, expectedMD5Sum string, size int64, data io.Reader, signature *Signature) (ObjectMetadata, *probe.Error)

CreateObject - PUT object

func (Filesystem) CreateObjectPart

func (fs Filesystem) CreateObjectPart(bucket, object, uploadID, expectedMD5Sum string, partID int, size int64, data io.Reader, signature *Signature) (string, *probe.Error)

CreateObjectPart - create a part in a multipart session

func (Filesystem) DeleteBucket

func (fs Filesystem) DeleteBucket(bucket string) *probe.Error

DeleteBucket - delete bucket

func (Filesystem) DeleteObject

func (fs Filesystem) DeleteObject(bucket, object string) *probe.Error

DeleteObject - delete and object

func (Filesystem) GetBucketMetadata

func (fs Filesystem) GetBucketMetadata(bucket string) (BucketMetadata, *probe.Error)

GetBucketMetadata - get bucket metadata

func (Filesystem) GetObject

func (fs Filesystem) GetObject(w io.Writer, bucket, object string, start, length int64) (int64, *probe.Error)

GetObject - GET object

func (Filesystem) GetObjectMetadata

func (fs Filesystem) GetObjectMetadata(bucket, object string) (ObjectMetadata, *probe.Error)

GetObjectMetadata - HEAD object

func (Filesystem) IsPrivateBucket

func (fs Filesystem) IsPrivateBucket(bucket string) bool

IsPrivateBucket - is private bucket

func (Filesystem) IsPublicBucket

func (fs Filesystem) IsPublicBucket(bucket string) bool

IsPublicBucket - is public bucket

func (Filesystem) IsReadOnlyBucket

func (fs Filesystem) IsReadOnlyBucket(bucket string) bool

IsReadOnlyBucket - is read only bucket

func (Filesystem) ListBuckets

func (fs Filesystem) ListBuckets() ([]BucketMetadata, *probe.Error)

ListBuckets - Get service

func (Filesystem) ListMultipartUploads

func (fs Filesystem) ListMultipartUploads(bucket string, resources BucketMultipartResourcesMetadata) (BucketMultipartResourcesMetadata, *probe.Error)

ListMultipartUploads - list incomplete multipart sessions for a given BucketMultipartResourcesMetadata

func (Filesystem) ListObjectParts

func (fs Filesystem) ListObjectParts(bucket, object string, resources ObjectResourcesMetadata) (ObjectResourcesMetadata, *probe.Error)

ListObjectParts - list parts from incomplete multipart session for a given ObjectResourcesMetadata

func (Filesystem) ListObjects

ListObjects - GET bucket (list objects)

func (Filesystem) MakeBucket

func (fs Filesystem) MakeBucket(bucket, acl string) *probe.Error

MakeBucket - PUT Bucket

func (Filesystem) NewMultipartUpload

func (fs Filesystem) NewMultipartUpload(bucket, object string) (string, *probe.Error)

NewMultipartUpload - initiate a new multipart session

func (Filesystem) SetBucketMetadata

func (fs Filesystem) SetBucketMetadata(bucket string, metadata map[string]string) *probe.Error

SetBucketMetadata - set bucket metadata

func (*Filesystem) SetMinFreeDisk

func (fs *Filesystem) SetMinFreeDisk(minFreeDisk int64)

SetMinFreeDisk - set min free disk

type GenericBucketError

type GenericBucketError struct {
	Bucket string
}

GenericBucketError - generic bucket error

type GenericObjectError

type GenericObjectError struct {
	Bucket string
	Object string
}

GenericObjectError - generic object error

type ImplementationError

type ImplementationError struct {
	Bucket string
	Object string
	Err    error
}

ImplementationError - generic implementation error

func EmbedError

func EmbedError(bucket, object string, err error) ImplementationError

EmbedError - wrapper function for error object

func (ImplementationError) Error

func (e ImplementationError) Error() string

Return string an error formatted as the given text

type IncompleteBody

type IncompleteBody GenericObjectError

IncompleteBody You did not provide the number of bytes specified by the Content-Length HTTP header

func (IncompleteBody) Error

func (e IncompleteBody) Error() string

Return string an error formatted as the given text

type InternalError

type InternalError struct {
}

InternalError - generic internal error

func (InternalError) Error

func (e InternalError) Error() string

Return string an error formatted as the given text

type InvalidACL

type InvalidACL struct {
	ACL string
}

InvalidACL - acl invalid

func (InvalidACL) Error

func (e InvalidACL) Error() string

type InvalidArgument

type InvalidArgument struct{}

InvalidArgument invalid argument

func (InvalidArgument) Error

func (e InvalidArgument) Error() string

type InvalidDigest

type InvalidDigest DigestError

InvalidDigest - md5 in request header invalid

func (InvalidDigest) Error

func (e InvalidDigest) Error() string

Return string an error formatted as the given text

type InvalidDisksArgument

type InvalidDisksArgument struct{}

InvalidDisksArgument invalid number of disks per node

func (InvalidDisksArgument) Error

func (e InvalidDisksArgument) Error() string

type InvalidPart

type InvalidPart struct{}

InvalidPart One or more of the specified parts could not be found

func (InvalidPart) Error

func (e InvalidPart) Error() string

type InvalidPartOrder

type InvalidPartOrder struct {
	UploadID string
}

InvalidPartOrder parts are not ordered as Requested

func (InvalidPartOrder) Error

func (e InvalidPartOrder) Error() string

type InvalidRange

type InvalidRange struct {
	Start  int64
	Length int64
}

InvalidRange - invalid range

func (InvalidRange) Error

func (e InvalidRange) Error() string

type InvalidUploadID

type InvalidUploadID struct {
	UploadID string
}

InvalidUploadID invalid upload id

func (InvalidUploadID) Error

func (e InvalidUploadID) Error() string

type MalformedXML

type MalformedXML struct{}

MalformedXML invalid xml format

func (MalformedXML) Error

func (e MalformedXML) Error() string

type Metadata

type Metadata struct {
	Md5sum      []byte
	ContentType string
}

Metadata - carries metadata about object

type MissingDateHeader

type MissingDateHeader struct{}

MissingDateHeader date header missing

func (MissingDateHeader) Error

func (e MissingDateHeader) Error() string

type MissingExpiresQuery

type MissingExpiresQuery struct{}

MissingExpiresQuery expires query string missing

func (MissingExpiresQuery) Error

func (e MissingExpiresQuery) Error() string

type MissingPOSTPolicy

type MissingPOSTPolicy struct{}

MissingPOSTPolicy missing post policy

func (MissingPOSTPolicy) Error

func (e MissingPOSTPolicy) Error() string

type MultipartSession

type MultipartSession struct {
	TotalParts int
	UploadID   string
	Initiated  time.Time
	Parts      []*PartMetadata
}

MultipartSession holds active session information

type Multiparts

type Multiparts struct {
	Version       string                       `json:"version"`
	ActiveSession map[string]*MultipartSession `json:"activeSessions"`
}

Multiparts collection of many parts

type NotImplemented

type NotImplemented struct {
	Function string
}

NotImplemented function not implemented

func (NotImplemented) Error

func (e NotImplemented) Error() string

type ObjectCorrupted

type ObjectCorrupted struct {
	Object string
}

ObjectCorrupted object found to be corrupted

func (ObjectCorrupted) Error

func (e ObjectCorrupted) Error() string

type ObjectMetadata

type ObjectMetadata struct {
	Bucket string
	Object string

	ContentType string
	Created     time.Time
	Mode        os.FileMode
	Md5         string
	Size        int64
}

ObjectMetadata - object key and its relevant metadata

type ObjectNameInvalid

type ObjectNameInvalid GenericObjectError

ObjectNameInvalid - object name provided is invalid

func (ObjectNameInvalid) Error

func (e ObjectNameInvalid) Error() string

Return string an error formatted as the given text

type ObjectNotFound

type ObjectNotFound struct {
	Bucket string
	Object string
}

ObjectNotFound object does not exist

func (ObjectNotFound) Error

func (e ObjectNotFound) Error() string

type ObjectResourcesMetadata

type ObjectResourcesMetadata struct {
	Bucket               string
	Object               string
	UploadID             string
	StorageClass         string
	PartNumberMarker     int
	NextPartNumberMarker int
	MaxParts             int
	IsTruncated          bool

	Part         []*PartMetadata
	EncodingType string
}

ObjectResourcesMetadata - various types of object resources

type OperationNotPermitted

type OperationNotPermitted struct {
	Op     string
	Reason string
}

OperationNotPermitted - operation not permitted

func (OperationNotPermitted) Error

func (e OperationNotPermitted) Error() string

type ParityOverflow

type ParityOverflow struct{}

ParityOverflow parity over flow

func (ParityOverflow) Error

func (e ParityOverflow) Error() string

type PartMetadata

type PartMetadata struct {
	PartNumber   int
	LastModified time.Time
	ETag         string
	Size         int64
}

PartMetadata - various types of individual part resources

type PostPolicyForm

type PostPolicyForm struct {
	Expiration time.Time // Expiration date and time of the POST policy.
	Conditions struct {
		Policies map[string]struct {
			Operator string
			Value    string
		}
		ContentLengthRange struct {
			Min int
			Max int
		}
	}
}

PostPolicyForm provides strict static type conversion and validation for Amazon S3's POST policy JSON string.

func ParsePostPolicyForm

func ParsePostPolicyForm(policy string) (PostPolicyForm, *probe.Error)

ParsePostPolicyForm - Parse JSON policy string into typed POostPolicyForm structure.

type RootPathFull

type RootPathFull struct {
	Path string
}

RootPathFull root path out of space

func (RootPathFull) Error

func (e RootPathFull) Error() string

type Signature

type Signature struct {
	AccessKeyID     string
	SecretAccessKey string
	Region          string
	Presigned       bool
	PresignedPolicy string
	SignedHeaders   []string
	Signature       string
	Request         *http.Request
}

Signature - local variables

func (*Signature) DoesPolicySignatureMatch

func (r *Signature) DoesPolicySignatureMatch(date string) (bool, *probe.Error)

DoesPolicySignatureMatch - Verify query headers with post policy

returns true if matches, false otherwise. if error is not nil then it is always false

func (*Signature) DoesPresignedSignatureMatch

func (r *Signature) DoesPresignedSignatureMatch() (bool, *probe.Error)

DoesPresignedSignatureMatch - Verify query headers with presigned signature

returns true if matches, false otherwise. if error is not nil then it is always false

func (*Signature) DoesSignatureMatch

func (r *Signature) DoesSignatureMatch(hashedPayload string) (bool, *probe.Error)

DoesSignatureMatch - Verify authorization header with calculated header in accordance with

returns true if matches, false otherwise. if error is not nil then it is always false

type SignatureDoesNotMatch

type SignatureDoesNotMatch struct {
	SignatureSent       string
	SignatureCalculated string
}

SignatureDoesNotMatch invalid signature

func (SignatureDoesNotMatch) Error

func (e SignatureDoesNotMatch) Error() string

type UnsupportedFilesystem

type UnsupportedFilesystem struct {
	Type string
}

UnsupportedFilesystem unsupported filesystem type

func (UnsupportedFilesystem) Error

func (e UnsupportedFilesystem) Error() string

type UploadMetadata

type UploadMetadata struct {
	Object       string
	UploadID     string
	StorageClass string
	Initiated    time.Time
}

UploadMetadata container capturing metadata on in progress multipart upload in a given bucket

type WalkFunc

type WalkFunc func(path string, info os.FileInfo, err error) error

WalkFunc is the type of the function called for each file or directory visited by Walk. The path argument contains the argument to Walk as a prefix; that is, if Walk is called with "dir", which is a directory containing the file "a", the walk function will be called with argument "dir/a". The info argument is the os.FileInfo for the named path.

Jump to

Keyboard shortcuts

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