cmd

package
v0.0.0-...-d1df5e0 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2016 License: Apache-2.0 Imports: 85 Imported by: 0

Documentation

Overview

Package cmd file carries any specific responses constructed/necessary in multipart operations.

Package cmd This file implements AWS Access Policy Language parser in accordance with http://docs.aws.amazon.com/AmazonS3/latest/dev/access-policy-language-overview.html

Package cmd This file implements helper functions to validate AWS Signature Version '4' authorization header.

This package provides comprehensive helpers for following signature types. - Based on Authorization header. - Based on Query parameters. - Based on Form POST policy.

Package cmd This file implements helper functions to validate Streaming AWS Signature Version '4' authorization header.

Index

Constants

View Source
const (
	Byte = 1 << (iota * 10)
	KiByte
	MiByte
	GiByte
	TiByte
	PiByte
	EiByte
)

IEC Sizes, kibis of bits

View Source
const (
	IByte = 1
	KByte = IByte * 1000
	MByte = KByte * 1000
	GByte = MByte * 1000
	TByte = GByte * 1000
	PByte = TByte * 1000
	EByte = PByte * 1000
)

Scientific notation Sizes.

View Source
const (
	// AWSResourcePrefix - bucket policy resource prefix.
	AWSResourcePrefix = "arn:aws:s3:::"
)
View Source
const MaxJitter = 1.0

MaxJitter will randomize over the full exponential backoff time

View Source
const NoJitter = 0.0

NoJitter disables the use of jitter for randomizing the exponential backoff time

Variables

View Source
var (
	// GOPATH - GOPATH value at the time of build.
	GOPATH = ""

	// Version - version time.RFC3339.
	Version = "DEVELOPMENT.GOGET"
	// ReleaseTag - release tag in TAG.%Y-%m-%dT%H-%M-%SZ.
	ReleaseTag = "DEVELOPMENT.GOGET"
	// CommitID - latest commit id.
	CommitID = "DEVELOPMENT.GOGET"
	// ShortCommitID - first 12 characters from CommitID.
	ShortCommitID = CommitID[:12]
)

DO NOT EDIT THIS FILE DIRECTLY. These are build-time constants set through ‘buildscripts/gen-ldflags.go’.

Functions

func DamerauLevenshteinDistance

func DamerauLevenshteinDistance(a string, b string) int

DamerauLevenshteinDistance calculates distance between two strings using an algorithm described in https://en.wikipedia.org/wiki/Damerau-Levenshtein_distance

func IsValidBucketName

func IsValidBucketName(bucket string) bool

IsValidBucketName verifies a bucket name in accordance with Amazon's requirements. It must be 3-63 characters long, can contain dashes and periods, but must begin and end with a lowercase letter or a number. See: http://docs.aws.amazon.com/AmazonS3/latest/dev/BucketRestrictions.html

func IsValidObjectName

func IsValidObjectName(object string) bool

IsValidObjectName verifies an object name in accordance with Amazon's requirements. It cannot exceed 1024 characters and must be a valid UTF8 string.

See: http://docs.aws.amazon.com/AmazonS3/latest/dev/UsingMetadata.html

You should avoid the following characters in a key name because of significant special handling for consistency across all applications.

Rejects strings with following characters.

- Backslash ("\")

additionally minio does not support object names with trailing "/".

func IsValidObjectPrefix

func IsValidObjectPrefix(object string) bool

IsValidObjectPrefix verifies whether the prefix is a valid object name. Its valid to have a empty prefix.

func Main

func Main()

Main main for minio server.

func UNCPath

func UNCPath(path string) string

UNCPath converts a absolute windows path to a UNC long path.

Types

type APIError

type APIError struct {
	Code           string
	Description    string
	HTTPStatusCode int
}

APIError structure

type APIErrorCode

type APIErrorCode int

APIErrorCode type of error status.

const (
	ErrNone APIErrorCode = iota
	ErrAccessDenied
	ErrBadDigest
	ErrEntityTooSmall
	ErrEntityTooLarge
	ErrIncompleteBody
	ErrInternalError
	ErrInvalidAccessKeyID
	ErrInvalidBucketName
	ErrInvalidDigest
	ErrInvalidRange
	ErrInvalidMaxKeys
	ErrInvalidMaxUploads
	ErrInvalidMaxParts
	ErrInvalidPartNumberMarker
	ErrInvalidRequestBody
	ErrInvalidCopySource
	ErrInvalidCopyDest
	ErrInvalidPolicyDocument
	ErrMalformedXML
	ErrMissingContentLength
	ErrMissingContentMD5
	ErrMissingRequestBodyError
	ErrNoSuchBucket
	ErrNoSuchBucketPolicy
	ErrNoSuchKey
	ErrNoSuchUpload
	ErrNotImplemented
	ErrPreconditionFailed
	ErrRequestTimeTooSkewed
	ErrSignatureDoesNotMatch
	ErrMethodNotAllowed
	ErrInvalidPart
	ErrInvalidPartOrder
	ErrAuthorizationHeaderMalformed
	ErrMalformedPOSTRequest
	ErrSignatureVersionNotSupported
	ErrBucketNotEmpty
	ErrAllAccessDisabled
	ErrMalformedPolicy
	ErrMissingFields
	ErrMissingCredTag
	ErrCredMalformed
	ErrInvalidRegion
	ErrInvalidService
	ErrInvalidRequestVersion
	ErrMissingSignTag
	ErrMissingSignHeadersTag
	ErrPolicyAlreadyExpired
	ErrMalformedDate
	ErrMalformedPresignedDate
	ErrMalformedCredentialDate
	ErrMalformedCredentialRegion
	ErrMalformedExpires
	ErrNegativeExpires
	ErrAuthHeaderEmpty
	ErrExpiredPresignRequest
	ErrRequestNotReadyYet
	ErrUnsignedHeaders
	ErrMissingDateHeader
	ErrInvalidQuerySignatureAlgo
	ErrInvalidQueryParams
	ErrBucketAlreadyOwnedByYou

	// Bucket notification related errors.
	ErrEventNotification
	ErrARNNotification
	ErrRegionNotification
	ErrOverlappingFilterNotification
	ErrFilterNameInvalid
	ErrFilterNamePrefix
	ErrFilterNameSuffix
	ErrFilterValueInvalid
	ErrOverlappingConfigs

	// S3 extended errors.
	ErrContentSHA256Mismatch

	// Minio extended errors.
	ErrReadQuorum
	ErrWriteQuorum
	ErrStorageFull
	ErrObjectExistsAsDirectory
	ErrPolicyNesting
	ErrInvalidObjectName
	ErrServerNotInitialized
)

Error codes, non exhaustive list - http://docs.aws.amazon.com/AmazonS3/latest/API/ErrorResponses.html

type APIErrorResponse

type APIErrorResponse struct {
	XMLName    xml.Name `xml:"Error" json:"-"`
	Code       string
	Message    string
	Key        string
	BucketName string
	Resource   string
	RequestID  string `xml:"RequestId"`
	HostID     string `xml:"HostId"`
}

APIErrorResponse - error response format

type AppendFileArgs

type AppendFileArgs struct {
	// Authentication token generated by Login.
	GenericArgs

	// Name of the volume.
	Vol string

	// Name of the path.
	Path string

	// Data buffer to be saved at path.
	Buffer []byte
}

AppendFileArgs represents append file RPC arguments.

type AuthRPCClient

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

AuthRPCClient is a wrapper type for RPCClient which provides JWT based authentication across reconnects.

func (*AuthRPCClient) Call

func (authClient *AuthRPCClient) Call(serviceMethod string, args interface {
	SetToken(token string)
	SetTimestamp(tstamp time.Time)
}, reply interface{}) (err error)

Call - If rpc connection isn't established yet since previous disconnect, connection is established, a jwt authenticated login is performed and then the call is performed.

func (*AuthRPCClient) Close

func (authClient *AuthRPCClient) Close() error

Close - closes underlying rpc connection.

func (*AuthRPCClient) Login

func (authClient *AuthRPCClient) Login() error

Login - a jwt based authentication is performed with rpc server.

func (*AuthRPCClient) Node

func (authClient *AuthRPCClient) Node() string

Node returns the node (network address) of the connection

func (*AuthRPCClient) RPCPath

func (authClient *AuthRPCClient) RPCPath() string

RPCPath returns the RPC path of the connection

type BackendType

type BackendType int

BackendType - represents different backend types.

const (
	Unknown BackendType = iota
	// Filesystem backend.
	FS
	// Multi disk single node XL backend.
	XL
)

Enum for different backend types.

type BadDigest

type BadDigest struct {
	ExpectedMD5   string
	CalculatedMD5 string
}

BadDigest - Content-MD5 you specified did not match what we received.

func (BadDigest) Error

func (e BadDigest) Error() string

type Bucket

type Bucket struct {
	Name         string
	CreationDate string // time string of format "2006-01-02T15:04:05.000Z"
}

Bucket container for bucket metadata

type BucketExists

type BucketExists GenericError

BucketExists bucket exists.

func (BucketExists) Error

func (e BucketExists) Error() string

type BucketInfo

type BucketInfo struct {
	// Name of the bucket.
	Name string

	// Date and time when the bucket was created.
	Created time.Time
}

BucketInfo - represents bucket metadata.

type BucketNameInvalid

type BucketNameInvalid GenericError

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 GenericError

BucketNotEmpty bucket is not empty.

func (BucketNotEmpty) Error

func (e BucketNotEmpty) Error() string

type BucketNotFound

type BucketNotFound GenericError

BucketNotFound bucket does not exist.

func (BucketNotFound) Error

func (e BucketNotFound) Error() string

type BucketPolicyNotFound

type BucketPolicyNotFound GenericError

BucketPolicyNotFound - no bucket policy found.

func (BucketPolicyNotFound) Error

func (e BucketPolicyNotFound) Error() string

type CommonPrefix

type CommonPrefix struct {
	Prefix string
}

CommonPrefix container for prefix response in ListObjectsResponse

type CompleteMultipartUploadResponse

type CompleteMultipartUploadResponse struct {
	XMLName xml.Name `xml:"http://s3.amazonaws.com/doc/2006-03-01/ CompleteMultipartUploadResult" json:"-"`

	Location string
	Bucket   string
	Key      string
	ETag     string
}

CompleteMultipartUploadResponse container for completed multipart upload response

type ConnBuf

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

ConnBuf - contains network buffer to record data

type ConnMux

type ConnMux struct {
	net.Conn
	// contains filtered or unexported fields
}

ConnMux - implements a Read() which streams twice the firs bytes from the incoming connection, to help peeking protocol

func NewConnMux

func NewConnMux(c net.Conn) *ConnMux

NewConnMux - creates a new ConnMux instance

func (*ConnMux) PeekProtocol

func (c *ConnMux) PeekProtocol() string

PeekProtocol - reads the first bytes, then checks if it is similar to one of the default http methods

func (*ConnMux) Read

func (c *ConnMux) Read(b []byte) (int, error)

Read - streams the ConnMux buffer when reset flag is activated, otherwise streams from the incoming network connection

type CopyObjectResponse

type CopyObjectResponse struct {
	XMLName      xml.Name `xml:"http://s3.amazonaws.com/doc/2006-03-01/ CopyObjectResult" json:"-"`
	LastModified string   // time string of format "2006-01-02T15:04:05.000Z"
	ETag         string   // md5sum of the copied object.
}

CopyObjectResponse container returns ETag and LastModified of the successfully copied object

type DeleteError

type DeleteError struct {
	Code    string
	Message string
	Key     string
}

DeleteError structure.

type DeleteFileArgs

type DeleteFileArgs struct {
	// Authentication token generated by Login.
	GenericArgs

	// Name of the volume.
	Vol string

	// Name of the path.
	Path string
}

DeleteFileArgs represents delete file RPC arguments.

type DeleteObjectsRequest

type DeleteObjectsRequest struct {
	// Element to enable quiet mode for the request
	Quiet bool
	// List of objects to be deleted
	Objects []ObjectIdentifier `xml:"Object"`
}

DeleteObjectsRequest - xml carrying the object key names which needs to be deleted.

type DeleteObjectsResponse

type DeleteObjectsResponse struct {
	XMLName xml.Name `xml:"http://s3.amazonaws.com/doc/2006-03-01/ DeleteResult" json:"-"`

	// Collection of all deleted objects
	DeletedObjects []ObjectIdentifier `xml:"Deleted,omitempty"`

	// Collection of errors deleting certain objects.
	Errors []DeleteError `xml:"Error,omitempty"`
}

DeleteObjectsResponse container for multiple object deletes.

type Error

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

Error - error type containing cause and the stack trace.

func (Error) Error

func (e Error) Error() string

Implement error interface.

func (Error) Trace

func (e Error) Trace() []string

Trace - returns stack trace.

type EventName

type EventName int

EventName is AWS S3 event type: http://docs.aws.amazon.com/AmazonS3/latest/dev/NotificationHowTo.html

const (
	// ObjectCreatedPut is s3:ObjectCreated:Put
	ObjectCreatedPut EventName = iota
	// ObjectCreatedPost is s3:ObjectCreated:Post
	ObjectCreatedPost
	// ObjectCreatedCopy is s3:ObjectCreated:Copy
	ObjectCreatedCopy
	// ObjectCreatedCompleteMultipartUpload is s3:ObjectCreated:CompleteMultipartUpload
	ObjectCreatedCompleteMultipartUpload
	// ObjectRemovedDelete is s3:ObjectRemoved:Delete
	ObjectRemovedDelete
)

func (EventName) String

func (eventName EventName) String() string

Stringer interface for event name.

type FileInfo

type FileInfo struct {
	// Name of the volume.
	Volume string

	// Name of the file.
	Name string

	// Date and time when the file was last modified.
	ModTime time.Time

	// Total file size.
	Size int64

	// File mode bits.
	Mode os.FileMode

	// Hex encoded md5 checksum of the file.
	MD5Sum string
}

FileInfo - represents file stat information.

type GenerateAuthReply

type GenerateAuthReply struct {
	AccessKey string `json:"accessKey"`
	SecretKey string `json:"secretKey"`
	UIVersion string `json:"uiVersion"`
}

GenerateAuthReply - reply for GenerateAuth

type GenericArgs

type GenericArgs struct {
	Token     string    // Used to authenticate every RPC call.
	Timestamp time.Time // Used to verify if the RPC call was issued between the same Login() and disconnect event pair.
}

GenericArgs represents any generic RPC arguments.

func (*GenericArgs) SetTimestamp

func (ga *GenericArgs) SetTimestamp(tstamp time.Time)

SetTimestamp - sets the timestamp to the supplied value.

func (*GenericArgs) SetToken

func (ga *GenericArgs) SetToken(token string)

SetToken - sets the token to the supplied value.

type GenericError

type GenericError struct {
	Bucket string
	Object string
}

GenericError - generic object layer error.

type GenericReply

type GenericReply struct{}

GenericReply represents any generic RPC reply.

type GenericVolArgs

type GenericVolArgs struct {
	// Authentication token generated by Login.
	GenericArgs

	// Name of the volume.
	Vol string
}

GenericVolArgs - generic volume args.

type GetAuthReply

type GetAuthReply struct {
	AccessKey string `json:"accessKey"`
	SecretKey string `json:"secretKey"`
	UIVersion string `json:"uiVersion"`
}

GetAuthReply - Reply current credentials.

type GetBucketPolicyArgs

type GetBucketPolicyArgs struct {
	BucketName string `json:"bucketName"`
	Prefix     string `json:"prefix"`
}

GetBucketPolicyArgs - get bucket policy args.

type GetBucketPolicyRep

type GetBucketPolicyRep struct {
	UIVersion string              `json:"uiVersion"`
	Policy    policy.BucketPolicy `json:"policy"`
}

GetBucketPolicyRep - get bucket policy reply.

type HandlerFunc

type HandlerFunc func(http.Handler) http.Handler

HandlerFunc - useful to chain different middleware http.Handler

type HealListArgs

type HealListArgs struct {
	// Authentication token generated by Login.
	GenericArgs

	Bucket    string
	Prefix    string
	Marker    string
	Delimiter string
	MaxKeys   int
}

HealListArgs - argument for ListObjects RPC.

type HealListReply

type HealListReply struct {
	IsTruncated bool
	NextMarker  string
	Objects     []string
}

HealListReply - reply object by ListObjects RPC.

type HealObjectArgs

type HealObjectArgs struct {
	// Authentication token generated by Login.
	GenericArgs

	// Name of the bucket.
	Bucket string

	// Name of the object.
	Object string
}

HealObjectArgs - argument for HealObject RPC.

type HealObjectReply

type HealObjectReply struct{}

HealObjectReply - reply by HealObject RPC.

type IncompleteBody

type IncompleteBody GenericError

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 InitActions

type InitActions int

InitActions - a type synonym for enumerating initialization activities.

const (
	// FormatDisks - see above table for disk states where it is applicable.
	FormatDisks InitActions = iota

	// WaitForHeal - Wait for disks to heal.
	WaitForHeal

	// WaitForQuorum - Wait for quorum number of disks to be online.
	WaitForQuorum

	// WaitForAll - Wait for all disks to be online.
	WaitForAll

	// WaitForFormatting - Wait for formatting to be triggered from the '1st' server in the cluster.
	WaitForFormatting

	// WaitForConfig - Wait for all servers to have the same config including (credentials, version and time).
	WaitForConfig

	// InitObjectLayer - Initialize object layer.
	InitObjectLayer

	// Abort initialization of object layer since there aren't enough good
	// copies of format.json to recover.
	Abort
)

type InitiateMultipartUploadResponse

type InitiateMultipartUploadResponse struct {
	XMLName xml.Name `xml:"http://s3.amazonaws.com/doc/2006-03-01/ InitiateMultipartUploadResult" json:"-"`

	Bucket   string
	Key      string
	UploadID string `xml:"UploadId"`
}

InitiateMultipartUploadResponse container for InitiateMultiPartUpload response, provides uploadID to start MultiPart upload

type Initiator

type Initiator Owner

Initiator inherit from Owner struct, fields are same

type InsufficientReadQuorum

type InsufficientReadQuorum struct{}

InsufficientReadQuorum storage cannot satisfy quorum for read operation.

func (InsufficientReadQuorum) Error

func (e InsufficientReadQuorum) Error() string

type InsufficientWriteQuorum

type InsufficientWriteQuorum struct{}

InsufficientWriteQuorum storage cannot satisfy quorum for write operation.

func (InsufficientWriteQuorum) Error

func (e InsufficientWriteQuorum) Error() string

type InvalidMarkerPrefixCombination

type InvalidMarkerPrefixCombination struct {
	Marker, Prefix string
}

InvalidMarkerPrefixCombination - invalid marker and prefix combination.

func (InvalidMarkerPrefixCombination) Error

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 InvalidRange

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

InvalidRange - invalid range typed error.

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 InvalidUploadIDKeyCombination

type InvalidUploadIDKeyCombination struct {
	UploadIDMarker, KeyMarker string
}

InvalidUploadIDKeyCombination - invalid upload id and key marker combination.

func (InvalidUploadIDKeyCombination) Error

type JWT

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

JWT - jwt auth backend

func (*JWT) Authenticate

func (jwt *JWT) Authenticate(accessKey, secretKey string) error

Authenticate - authenticates incoming access key and secret key.

func (*JWT) GenerateToken

func (jwt *JWT) GenerateToken(accessKey string) (string, error)

GenerateToken - generates a new Json Web Token based on the incoming access key.

type ListAllBucketPoliciesArgs

type ListAllBucketPoliciesArgs struct {
	BucketName string `json:"bucketName"`
}

ListAllBucketPoliciesArgs - get all bucket policies.

type ListAllBucketPoliciesRep

type ListAllBucketPoliciesRep struct {
	UIVersion string               `json:"uiVersion"`
	Policies  []bucketAccessPolicy `json:"policies"`
}

ListAllBucketPoliciesRep - get all bucket policy reply.

type ListBucketsRep

type ListBucketsRep struct {
	Buckets   []WebBucketInfo `json:"buckets"`
	UIVersion string          `json:"uiVersion"`
}

ListBucketsRep - list buckets response

type ListBucketsResponse

type ListBucketsResponse struct {
	XMLName xml.Name `xml:"http://s3.amazonaws.com/doc/2006-03-01/ ListAllMyBucketsResult" json:"-"`

	Owner Owner

	// Container for one or more buckets.
	Buckets struct {
		Buckets []Bucket `xml:"Bucket"`
	} // Buckets are nested
}

ListBucketsResponse - format for list buckets response

type ListDirArgs

type ListDirArgs struct {
	// Authentication token generated by Login.
	GenericArgs

	// Name of the volume.
	Vol string

	// Name of the path.
	Path string
}

ListDirArgs represents list contents RPC arguments.

type ListMultipartUploadsResponse

type ListMultipartUploadsResponse struct {
	XMLName xml.Name `xml:"http://s3.amazonaws.com/doc/2006-03-01/ ListMultipartUploadsResult" json:"-"`

	Bucket             string
	KeyMarker          string
	UploadIDMarker     string `xml:"UploadIdMarker"`
	NextKeyMarker      string
	NextUploadIDMarker string `xml:"NextUploadIdMarker"`
	Delimiter          string
	Prefix             string
	EncodingType       string `xml:"EncodingType,omitempty"`
	MaxUploads         int
	IsTruncated        bool

	// List of pending uploads.
	Uploads []Upload `xml:"Upload"`

	// Delimed common prefixes.
	CommonPrefixes []CommonPrefix
}

ListMultipartUploadsResponse - format for list multipart uploads response.

type ListMultipartsInfo

type ListMultipartsInfo struct {
	// Together with upload-id-marker, this parameter specifies the multipart upload
	// after which listing should begin.
	KeyMarker string

	// Together with key-marker, specifies the multipart upload after which listing
	// should begin. If key-marker is not specified, the upload-id-marker parameter
	// is ignored.
	UploadIDMarker string

	// When a list is truncated, this element specifies the value that should be
	// used for the key-marker request parameter in a subsequent request.
	NextKeyMarker string

	// When a list is truncated, this element specifies the value that should be
	// used for the upload-id-marker request parameter in a subsequent request.
	NextUploadIDMarker string

	// Maximum number of multipart uploads that could have been included in the
	// response.
	MaxUploads int

	// Indicates whether the returned list of multipart uploads is truncated. A
	// value of true indicates that the list was truncated. The list can be truncated
	// if the number of multipart uploads exceeds the limit allowed or specified
	// by max uploads.
	IsTruncated bool

	// List of all pending uploads.
	Uploads []uploadMetadata

	// When a prefix is provided in the request, The result contains only keys
	// starting with the specified prefix.
	Prefix string

	// A character used to truncate the object prefixes.
	// NOTE: only supported delimiter is '/'.
	Delimiter string

	// CommonPrefixes contains all (if there are any) keys between Prefix and the
	// next occurrence of the string specified by delimiter.
	CommonPrefixes []string

	EncodingType string // Not supported yet.
}

ListMultipartsInfo - represnets bucket resources for incomplete multipart uploads.

type ListObjectsArgs

type ListObjectsArgs struct {
	BucketName string `json:"bucketName"`
	Prefix     string `json:"prefix"`
}

ListObjectsArgs - list object args.

type ListObjectsInfo

type ListObjectsInfo struct {
	// Indicates whether the returned list objects response is truncated. A
	// value of true indicates that the list was truncated. The list can be truncated
	// if the number of objects exceeds the limit allowed or specified
	// by max keys.
	IsTruncated bool

	// When response is truncated (the IsTruncated element value in the response
	// is true), you can use the key name in this field as marker in the subsequent
	// request to get next set of objects.
	//
	// NOTE: This element is returned only if you have delimiter request parameter
	// specified.
	NextMarker string

	// List of objects info for this request.
	Objects []ObjectInfo

	// List of prefixes for this request.
	Prefixes []string
}

ListObjectsInfo - container for list objects.

type ListObjectsRep

type ListObjectsRep struct {
	Objects   []WebObjectInfo `json:"objects"`
	UIVersion string          `json:"uiVersion"`
}

ListObjectsRep - list objects response.

type ListObjectsResponse

type ListObjectsResponse struct {
	XMLName xml.Name `xml:"http://s3.amazonaws.com/doc/2006-03-01/ ListBucketResult" json:"-"`

	Name   string
	Prefix string
	Marker string

	// When response is truncated (the IsTruncated element value in the response
	// is true), you can use the key name in this field as marker in the subsequent
	// request to get next set of objects. Server lists objects in alphabetical
	// order Note: This element is returned only if you have delimiter request parameter
	// specified. If response does not include the NextMaker and it is truncated,
	// you can use the value of the last Key in the response as the marker in the
	// subsequent request to get the next set of object keys.
	NextMarker string `xml:"NextMarker,omitempty"`

	MaxKeys   int
	Delimiter string
	// A flag that indicates whether or not ListObjects returned all of the results
	// that satisfied the search criteria.
	IsTruncated bool

	Contents       []Object
	CommonPrefixes []CommonPrefix

	// Encoding type used to encode object keys in the response.
	EncodingType string `xml:"EncodingType,omitempty"`
}

ListObjectsResponse - format for list objects response.

type ListObjectsV2Response

type ListObjectsV2Response struct {
	XMLName xml.Name `xml:"http://s3.amazonaws.com/doc/2006-03-01/ ListBucketResult" json:"-"`

	Name       string
	Prefix     string
	StartAfter string `xml:"StartAfter,omitempty"`
	// When response is truncated (the IsTruncated element value in the response
	// is true), you can use the key name in this field as marker in the subsequent
	// request to get next set of objects. Server lists objects in alphabetical
	// order Note: This element is returned only if you have delimiter request parameter
	// specified. If response does not include the NextMaker and it is truncated,
	// you can use the value of the last Key in the response as the marker in the
	// subsequent request to get the next set of object keys.
	ContinuationToken     string `xml:"ContinuationToken,omitempty"`
	NextContinuationToken string `xml:"NextContinuationToken,omitempty"`

	KeyCount  int
	MaxKeys   int
	Delimiter string
	// A flag that indicates whether or not ListObjects returned all of the results
	// that satisfied the search criteria.
	IsTruncated bool

	Contents       []Object
	CommonPrefixes []CommonPrefix

	// Encoding type used to encode object keys in the response.
	EncodingType string `xml:"EncodingType,omitempty"`
}

ListObjectsV2Response - format for list objects response.

type ListPartsInfo

type ListPartsInfo struct {
	// Name of the bucket.
	Bucket string

	// Name of the object.
	Object string

	// Upload ID identifying the multipart upload whose parts are being listed.
	UploadID string

	// The class of storage used to store the object.
	StorageClass string

	// Part number after which listing begins.
	PartNumberMarker int

	// When a list is truncated, this element specifies the last part in the list,
	// as well as the value to use for the part-number-marker request parameter
	// in a subsequent request.
	NextPartNumberMarker int

	// Maximum number of parts that were allowed in the response.
	MaxParts int

	// Indicates whether the returned list of parts is truncated.
	IsTruncated bool

	// List of all parts.
	Parts []partInfo

	EncodingType string // Not supported yet.
}

ListPartsInfo - represents list of all parts.

type ListPartsResponse

type ListPartsResponse struct {
	XMLName xml.Name `xml:"http://s3.amazonaws.com/doc/2006-03-01/ ListPartsResult" json:"-"`

	Bucket   string
	Key      string
	UploadID string `xml:"UploadId"`

	Initiator Initiator
	Owner     Owner

	// The class of storage used to store the object.
	StorageClass string

	PartNumberMarker     int
	NextPartNumberMarker int
	MaxParts             int
	IsTruncated          bool

	// List of parts.
	Parts []Part `xml:"Part"`
}

ListPartsResponse - format for list parts response.

type ListVolsReply

type ListVolsReply struct {
	// List of volumes stat information.
	Vols []VolInfo
}

ListVolsReply represents list of vols RPC reply.

type ListenerMux

type ListenerMux struct {
	net.Listener
	// contains filtered or unexported fields
}

ListenerMux - encapuslates the standard net.Listener to inspect the communication protocol upon network connection

func (*ListenerMux) Accept

func (l *ListenerMux) Accept() (net.Conn, error)

Accept - peek the protocol to decide if we should wrap the network stream with the TLS server

func (*ListenerMux) Close

func (l *ListenerMux) Close() error

Close Listener

type LocationResponse

type LocationResponse struct {
	XMLName  xml.Name `xml:"http://s3.amazonaws.com/doc/2006-03-01/ LocationConstraint" json:"-"`
	Location string   `xml:",chardata"`
}

LocationResponse - format for location response.

type LockArgs

type LockArgs struct {
	Name      string
	Token     string
	Timestamp time.Time
	Node      string
	RPCPath   string
	UID       string
}

LockArgs besides lock name, holds Token and Timestamp for session authentication and validation server restart.

func (*LockArgs) SetTimestamp

func (l *LockArgs) SetTimestamp(tstamp time.Time)

SetTimestamp - sets the timestamp to the supplied value.

func (*LockArgs) SetToken

func (l *LockArgs) SetToken(token string)

SetToken - sets the token to the supplied value.

type LockInfoOpsIDNotFound

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

LockInfoOpsIDNotFound - Returned when the lock state info exists, but the entry for given operation ID doesn't exist.

func (LockInfoOpsIDNotFound) Error

func (l LockInfoOpsIDNotFound) Error() string

type LockInfoOriginNotFound

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

LockInfoOriginNotFound - While changing the state of the lock info its important that the entry for lock at a given origin exists, if not `LockInfoOriginNotFound` is returned.

func (LockInfoOriginNotFound) Error

func (l LockInfoOriginNotFound) Error() string

type LockInfoStateNotBlocked

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

LockInfoStateNotBlocked - When an attempt to change the state of the lock form `blocked` to `running` is done, its necessary that the state before the transsition is "blocked", otherwise LockInfoStateNotBlocked returned.

func (LockInfoStateNotBlocked) Error

func (l LockInfoStateNotBlocked) Error() string

type LockInfoVolPathMssing

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

LockInfoVolPathMssing - Error interface. Returned when the info the

func (LockInfoVolPathMssing) Error

func (l LockInfoVolPathMssing) Error() string

type LoginArgs

type LoginArgs struct {
	Username string `json:"username" form:"username"`
	Password string `json:"password" form:"password"`
}

LoginArgs - login arguments.

type LoginRep

type LoginRep struct {
	Token     string `json:"token"`
	UIVersion string `json:"uiVersion"`
}

LoginRep - login reply.

type MakeBucketArgs

type MakeBucketArgs struct {
	BucketName string `json:"bucketName"`
}

MakeBucketArgs - make bucket args.

type MalformedUploadID

type MalformedUploadID struct {
	UploadID string
}

MalformedUploadID malformed upload id.

func (MalformedUploadID) Error

func (e MalformedUploadID) Error() string

type NotImplemented

type NotImplemented struct{}

NotImplemented If a feature is not implemented

func (NotImplemented) Error

func (e NotImplemented) Error() string

type NotificationEvent

type NotificationEvent struct {
	EventVersion      string            `json:"eventVersion"`
	EventSource       string            `json:"eventSource"`
	AwsRegion         string            `json:"awsRegion"`
	EventTime         string            `json:"eventTime"`
	EventName         string            `json:"eventName"`
	UserIdentity      identity          `json:"userIdentity"`
	RequestParameters map[string]string `json:"requestParameters"`
	ResponseElements  map[string]string `json:"responseElements"`
	S3                eventMeta         `json:"s3"`
}

NotificationEvent represents an Amazon an S3 bucket notification event.

type Object

type Object struct {
	Key          string
	LastModified string // time string of format "2006-01-02T15:04:05.000Z"
	ETag         string
	Size         int64

	// Owner of the object.
	Owner Owner

	// The class of storage used to store the object.
	StorageClass string
}

Object container for object metadata

type ObjectExistsAsDirectory

type ObjectExistsAsDirectory GenericError

ObjectExistsAsDirectory object already exists as a directory.

func (ObjectExistsAsDirectory) Error

func (e ObjectExistsAsDirectory) Error() string

type ObjectIdentifier

type ObjectIdentifier struct {
	ObjectName string `xml:"Key"`
}

ObjectIdentifier carries key name for the object to delete.

type ObjectInfo

type ObjectInfo struct {
	// Name of the bucket.
	Bucket string

	// Name of the object.
	Name string

	// Date and time when the object was last modified.
	ModTime time.Time

	// Total object size.
	Size int64

	// IsDir indicates if the object is prefix.
	IsDir bool

	// Hex encoded md5 checksum of the object.
	MD5Sum string

	// A standard MIME type describing the format of the object.
	ContentType string

	// Specifies what content encodings have been applied to the object and thus
	// what decoding mechanisms must be applied to obtain the object referenced
	// by the Content-Type header field.
	ContentEncoding string

	// User-Defined metadata
	UserDefined map[string]string
}

ObjectInfo - represents object metadata.

type ObjectLayer

type ObjectLayer interface {
	// Storage operations.
	Shutdown() error
	StorageInfo() StorageInfo

	// Bucket operations.
	MakeBucket(bucket string) error
	GetBucketInfo(bucket string) (bucketInfo BucketInfo, err error)
	ListBuckets() (buckets []BucketInfo, err error)
	DeleteBucket(bucket string) error
	ListObjects(bucket, prefix, marker, delimiter string, maxKeys int) (result ListObjectsInfo, err error)
	ListObjectsHeal(bucket, prefix, marker, delimiter string, maxKeys int) (ListObjectsInfo, error)

	// Object operations.
	GetObject(bucket, object string, startOffset int64, length int64, writer io.Writer) (err error)
	GetObjectInfo(bucket, object string) (objInfo ObjectInfo, err error)
	PutObject(bucket, object string, size int64, data io.Reader, metadata map[string]string, sha256sum string) (objInto ObjectInfo, err error)
	DeleteObject(bucket, object string) error
	HealObject(bucket, object string) error

	// Multipart operations.
	ListMultipartUploads(bucket, prefix, keyMarker, uploadIDMarker, delimiter string, maxUploads int) (result ListMultipartsInfo, err error)
	NewMultipartUpload(bucket, object string, metadata map[string]string) (uploadID string, err error)
	PutObjectPart(bucket, object, uploadID string, partID int, size int64, data io.Reader, md5Hex string, sha256sum string) (md5 string, err error)
	ListObjectParts(bucket, object, uploadID string, partNumberMarker int, maxParts int) (result ListPartsInfo, err error)
	AbortMultipartUpload(bucket, object, uploadID string) error
	CompleteMultipartUpload(bucket, object, uploadID string, uploadedParts []completePart) (md5 string, err error)
}

ObjectLayer implements primitives for object API layer.

type ObjectNameInvalid

type ObjectNameInvalid GenericError

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 GenericError

ObjectNotFound object does not exist.

func (ObjectNotFound) Error

func (e ObjectNotFound) Error() string

type OpsLockState

type OpsLockState struct {
	OperationID string `json:"opsID"`      // string containing operation ID.
	LockOrigin  string `json:"lockOrigin"` // contant which mentions the operation type (Get Obejct, PutObject...)
	LockType    string `json:"lockType"`
	Status      string `json:"status"`      // status can be running/ready/blocked.
	StatusSince string `json:"statusSince"` // time info of the since how long the status holds true, value in seconds.
}

OpsLockState - structure to fill in state information of the lock. structure to fill in status information for each operation with given operation ID.

type Owner

type Owner struct {
	ID          string
	DisplayName string
}

Owner - bucket owner/principal

type Part

type Part struct {
	PartNumber   int
	LastModified string
	ETag         string
	Size         int64
}

Part container for part metadata.

type PartTooSmall

type PartTooSmall struct {
	PartSize   int64
	PartNumber int
	PartETag   string
}

PartTooSmall - error if part size is less than 5MB.

func (PartTooSmall) Error

func (e PartTooSmall) Error() string

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.

type PresignedGetArgs

type PresignedGetArgs struct {
	// Host header required for signed headers.
	HostName string `json:"host"`

	// Bucket name of the object to be presigned.
	BucketName string `json:"bucket"`

	// Object name to be presigned.
	ObjectName string `json:"object"`
}

PresignedGetArgs - presigned-get API args.

type PresignedGetRep

type PresignedGetRep struct {
	// Presigned URL of the object.
	URL string `json:"url"`
}

PresignedGetRep - presigned-get URL reply.

type RPCClient

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

RPCClient is a wrapper type for rpc.Client which provides reconnect on first failure.

func (*RPCClient) Call

func (rpcClient *RPCClient) Call(serviceMethod string, args interface{}, reply interface{}) error

Call makes a RPC call to the remote endpoint using the default codec, namely encoding/gob.

func (*RPCClient) Close

func (rpcClient *RPCClient) Close() error

Close closes the underlying socket file descriptor.

func (*RPCClient) Node

func (rpcClient *RPCClient) Node() string

Node returns the node (network address) of the connection

func (*RPCClient) RPCPath

func (rpcClient *RPCClient) RPCPath() string

RPCPath returns the RPC path of the connection

type RPCLoginArgs

type RPCLoginArgs struct {
	Username string
	Password string
}

RPCLoginArgs - login username and password for RPC.

type RPCLoginReply

type RPCLoginReply struct {
	Token         string
	Timestamp     time.Time
	ServerVersion string
}

RPCLoginReply - login reply provides generated token to be used with subsequent requests.

type RWLocker

type RWLocker interface {
	sync.Locker
	RLock()
	RUnlock()
}

RWLocker - interface that any read-write locking library should implement.

type ReadAllArgs

type ReadAllArgs struct {
	// Authentication token generated by Login.
	GenericArgs

	// Name of the volume.
	Vol string

	// Name of the path.
	Path string
}

ReadAllArgs represents read all RPC arguments.

type ReadFileArgs

type ReadFileArgs struct {
	// Authentication token generated by Login.
	GenericArgs

	// Name of the volume.
	Vol string

	// Name of the path.
	Path string

	// Starting offset to start reading into Buffer.
	Offset int64

	// Data size read from the path at offset.
	Size int
}

ReadFileArgs represents read file RPC arguments.

type RemoveObjectArgs

type RemoveObjectArgs struct {
	TargetHost string `json:"targetHost"`
	BucketName string `json:"bucketName"`
	ObjectName string `json:"objectName"`
}

RemoveObjectArgs - args to remove an object

type RenameFileArgs

type RenameFileArgs struct {
	// Authentication token generated by Login.
	GenericArgs

	// Name of source volume.
	SrcVol string

	// Source path to be renamed.
	SrcPath string

	// Name of destination volume.
	DstVol string

	// Destination path of renamed file.
	DstPath string
}

RenameFileArgs represents rename file RPC arguments.

type SHA256Mismatch

type SHA256Mismatch struct{}

SHA256Mismatch - when content sha256 does not match with what was sent from client.

func (SHA256Mismatch) Error

func (e SHA256Mismatch) Error() string

type ServerInfoRep

type ServerInfoRep struct {
	MinioVersion  string
	MinioMemory   string
	MinioPlatform string
	MinioRuntime  string
	MinioEnvVars  []string
	UIVersion     string `json:"uiVersion"`
}

ServerInfoRep - server info reply.

type ServerMux

type ServerMux struct {
	http.Server

	WaitGroup       *sync.WaitGroup
	GracefulTimeout time.Duration
	// contains filtered or unexported fields
}

ServerMux - the main mux server

func NewServerMux

func NewServerMux(addr string, handler http.Handler) *ServerMux

NewServerMux constructor to create a ServerMux

func (*ServerMux) Close

func (m *ServerMux) Close() error

Close initiates the graceful shutdown

func (*ServerMux) ListenAndServe

func (m *ServerMux) ListenAndServe() error

ListenAndServe - Same as the http.Server version

func (*ServerMux) ListenAndServeTLS

func (m *ServerMux) ListenAndServeTLS(certFile, keyFile string) error

ListenAndServeTLS - similar to the http.Server version. However, it has the ability to redirect http requests to the correct HTTPS url if the client mistakenly initiates a http connection over the https port

type SetAuthArgs

type SetAuthArgs struct {
	AccessKey string `json:"accessKey"`
	SecretKey string `json:"secretKey"`
}

SetAuthArgs - argument for SetAuth

type SetAuthReply

type SetAuthReply struct {
	Token     string `json:"token"`
	UIVersion string `json:"uiVersion"`
}

SetAuthReply - reply for SetAuth

type SetBucketPolicyArgs

type SetBucketPolicyArgs struct {
	BucketName string `json:"bucketName"`
	Prefix     string `json:"prefix"`
	Policy     string `json:"policy"`
}

SetBucketPolicyArgs - set bucket policy args.

type ShutdownArgs

type ShutdownArgs struct {
	// Authentication token generated by Login.
	GenericArgs

	// Should the server be restarted, all active connections are
	// served before server is restarted.
	Restart bool
}

ShutdownArgs - argument for Shutdown RPC.

type StatFileArgs

type StatFileArgs struct {
	// Authentication token generated by Login.
	GenericArgs

	// Name of the volume.
	Vol string

	// Name of the path.
	Path string
}

StatFileArgs represents stat file RPC arguments.

type StorageAPI

type StorageAPI interface {
	// Stringified version of disk.
	String() string

	// Storage operations.
	DiskInfo() (info disk.Info, err error)

	// Volume operations.
	MakeVol(volume string) (err error)
	ListVols() (vols []VolInfo, err error)
	StatVol(volume string) (vol VolInfo, err error)
	DeleteVol(volume string) (err error)

	// File operations.
	ListDir(volume, dirPath string) ([]string, error)
	ReadFile(volume string, path string, offset int64, buf []byte) (n int64, err error)
	AppendFile(volume string, path string, buf []byte) (err error)
	RenameFile(srcVolume, srcPath, dstVolume, dstPath string) error
	StatFile(volume string, path string) (file FileInfo, err error)
	DeleteFile(volume string, path string) (err error)

	// Read all.
	ReadAll(volume string, path string) (buf []byte, err error)
}

StorageAPI interface.

type StorageFull

type StorageFull struct{}

StorageFull storage ran out of space.

func (StorageFull) Error

func (e StorageFull) Error() string

type StorageInfo

type StorageInfo struct {
	// Total disk space.
	Total int64
	// Free available disk space.
	Free int64
	// Backend type.
	Backend struct {
		// Represents various backend types, currently on FS and XL.
		Type BackendType

		// Following fields are only meaningful if BackendType is XL.
		OnlineDisks  int // Online disks during server startup.
		OfflineDisks int // Offline disks during server startup.
		Quorum       int // Minimum disks required for successful operations.
	}
}

StorageInfo - represents total capacity of underlying storage.

type StorageInfoRep

type StorageInfoRep struct {
	StorageInfo StorageInfo `json:"storageInfo"`
	UIVersion   string      `json:"uiVersion"`
}

StorageInfoRep - contains storage usage statistics.

type SystemLockState

type SystemLockState struct {
	TotalLocks         int64            `json:"totalLocks"`
	TotalBlockedLocks  int64            `json:"totalBlockedLocks"`  // count of operations which are blocked waiting for the lock to be released.
	TotalAcquiredLocks int64            `json:"totalAcquiredLocks"` // count of operations which has successfully acquired the lock but hasn't unlocked yet( operation in progress).
	LocksInfoPerObject []VolumeLockInfo `json:"locksInfoPerObject"`
}

SystemLockState - Structure to fill the lock state of entire object storage. That is the total locks held, total calls blocked on locks and state of all the locks for the entire system.

type Trie

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

Trie trie container

func (*Trie) Insert

func (t *Trie) Insert(key string)

Insert insert a key

func (*Trie) PrefixMatch

func (t *Trie) PrefixMatch(key string) []interface{}

PrefixMatch - prefix match

type UnsupportedDelimiter

type UnsupportedDelimiter struct {
	Delimiter string
}

UnsupportedDelimiter - unsupported delimiter.

func (UnsupportedDelimiter) Error

func (e UnsupportedDelimiter) Error() string

type Upload

type Upload struct {
	Key          string
	UploadID     string `xml:"UploadId"`
	Initiator    Initiator
	Owner        Owner
	StorageClass string
	Initiated    string
}

Upload container for in progress multipart upload

type VolInfo

type VolInfo struct {
	// Name of the volume.
	Name string

	// Date and time when the volume was created.
	Created time.Time
}

VolInfo - represents volume stat information.

type VolumeLockInfo

type VolumeLockInfo struct {
	Bucket                string         `json:"bucket"`
	Object                string         `json:"object"`
	LocksOnObject         int64          `json:"locksOnObject"`         // All locks blocked + running for given <volume,path> pair.
	LocksAcquiredOnObject int64          `json:"locksAcquiredOnObject"` // count of operations which has successfully acquired the lock but hasn't unlocked yet( operation in progress).
	TotalBlockedLocks     int64          `json:"locksBlockedOnObject"`  // count of operations which are blocked waiting for the lock to be released.
	LockDetailsOnObject   []OpsLockState `json:"lockDetailsOnObject"`   // state information containing state of the locks for all operations on given <volume,path> pair.
}

VolumeLockInfo - Structure to contain the lock state info for volume, path pair.

type WebBucketInfo

type WebBucketInfo struct {
	// The name of the bucket.
	Name string `json:"name"`
	// Date the bucket was created.
	CreationDate time.Time `json:"creationDate"`
}

WebBucketInfo container for list buckets metadata.

type WebGenericArgs

type WebGenericArgs struct{}

WebGenericArgs - empty struct for calls that don't accept arguments for ex. ServerInfo, GenerateAuth

type WebGenericRep

type WebGenericRep struct {
	UIVersion string `json:"uiVersion"`
}

WebGenericRep - reply structure for calls for which reply is success/failure for ex. RemoveObject MakeBucket

type WebObjectInfo

type WebObjectInfo struct {
	// Name of the object
	Key string `json:"name"`
	// Date and time the object was last modified.
	LastModified time.Time `json:"lastModified"`
	// Size in bytes of the object.
	Size int64 `json:"size"`
	// ContentType is mime type of the object.
	ContentType string `json:"contentType"`
}

WebObjectInfo container for list objects metadata.

Source Files

Jump to

Keyboard shortcuts

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