cmd

package
v0.0.0-...-65e45ac Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2016 License: Apache-2.0 Imports: 78 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:::"
)

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 ("\") - Caret ("^") - Grave accent / back tick ("`") - Vertical bar / pipe ("|")

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
	ErrBucketAlreadyExists
	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
)

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 {
	// 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 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:"-"`
	ETag         string
	LastModified string // time string of format "2006-01-02T15:04:05.000Z"
}

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 {
	// 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 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{}

GenericArgs represents any generic RPC arguments.

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 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 {
	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 by ListObjects RPC.

type HealObjectArgs

type HealObjectArgs struct {
	Bucket string
	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 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 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:"-"`
	// Container for one or more buckets.
	Buckets struct {
		Buckets []Bucket `xml:"Bucket"`
	} // Buckets are nested
	Owner Owner
}

ListBucketsResponse - format for list buckets response

type ListDirArgs

type ListDirArgs struct {
	// 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"`
	EncodingType       string
	MaxUploads         int
	IsTruncated        bool
	Uploads            []Upload `xml:"Upload"`
	Prefix             string
	Delimiter          string
	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:"-"`

	CommonPrefixes []CommonPrefix
	Contents       []Object

	Delimiter string

	// Encoding type used to encode object keys in the response.
	EncodingType string

	// A flag that indicates whether or not ListObjects returned all of the results
	// that satisfied the search criteria.
	IsTruncated bool
	Marker      string
	MaxKeys     int
	Name        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
	Prefix     string
}

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:"-"`

	CommonPrefixes []CommonPrefix
	Contents       []Object

	Delimiter string

	// Encoding type used to encode object keys in the response.
	EncodingType string

	// A flag that indicates whether or not ListObjects returned all of the results
	// that satisfied the search criteria.
	IsTruncated bool
	StartAfter  string
	MaxKeys     int
	Name        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.
	ContinuationToken     string
	NextContinuationToken string
	Prefix                string
}

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 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 {
	ETag         string
	Key          string
	LastModified string // time string of format "2006-01-02T15:04:05.000Z"
	Size         int64

	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) (md5 string, 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) (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 Owner

type Owner struct {
	ID          string
	DisplayName string
}

Owner - bucket owner/principal

type Part

type Part struct {
	PartNumber   int
	ETag         string
	LastModified 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 ReadAllArgs

type ReadAllArgs struct {
	// Name of the volume.
	Vol string

	// Name of the path.
	Path string
}

ReadAllArgs represents read all RPC arguments.

type ReadFileArgs

type ReadFileArgs struct {
	// Name of the volume.
	Vol string

	// Name of the path.
	Path string

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

	// Data buffer read from the path at offset.
	Buffer []byte
}

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 {
	// 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 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 {
	Reboot bool
}

ShutdownArgs - argument for Shutdown RPC.

type ShutdownReply

type ShutdownReply struct{}

ShutdownReply - reply by Shutdown RPC.

type StatFileArgs

type StatFileArgs struct {
	// Name of the volume.
	Vol string

	// Name of the path.
	Path string
}

StatFileArgs represents stat file RPC arguments.

type StorageAPI

type StorageAPI interface {
	// 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
}

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 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 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