cmd

package
v0.0.0-...-695f612 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2020 License: AGPL-3.0 Imports: 100 Imported by: 0

Documentation

Overview

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 (
	// SSEKmsID is the HTTP header key referencing the SSE-KMS
	// key ID.
	SSEKmsID = SSEHeader + "-Aws-Kms-Key-Id"

	// SSEKmsContext is the HTTP header key referencing the
	// SSE-KMS encryption context.
	SSEKmsContext = SSEHeader + "-Context"
)
View Source
const (
	// SSECAlgorithm is the HTTP header key referencing
	// the SSE-C algorithm.
	SSECAlgorithm = SSEHeader + "-Customer-Algorithm"

	// SSECKey is the HTTP header key referencing the
	// SSE-C client-provided key..
	SSECKey = SSEHeader + "-Customer-Key"

	// SSECKeyMD5 is the HTTP header key referencing
	// the MD5 sum of the client-provided key.
	SSECKeyMD5 = SSEHeader + "-Customer-Key-Md5"
)
View Source
const (
	// SSECopyAlgorithm is the HTTP header key referencing
	// the SSE-C algorithm for SSE-C copy requests.
	SSECopyAlgorithm = "X-Amz-Copy-Source-Server-Side-Encryption-Customer-Algorithm"

	// SSECopyKey is the HTTP header key referencing the SSE-C
	// client-provided key for SSE-C copy requests.
	SSECopyKey = "X-Amz-Copy-Source-Server-Side-Encryption-Customer-Key"

	// SSECopyKeyMD5 is the HTTP header key referencing the
	// MD5 sum of the client key for SSE-C copy requests.
	SSECopyKeyMD5 = "X-Amz-Copy-Source-Server-Side-Encryption-Customer-Key-Md5"
)
View Source
const (
	// SSEAlgorithmAES256 is the only supported value for the SSE-S3 or SSE-C algorithm header.
	// For SSE-S3 see: https://docs.aws.amazon.com/AmazonS3/latest/dev/SSEUsingRESTAPI.html
	// For SSE-C  see: https://docs.aws.amazon.com/AmazonS3/latest/dev/ServerSideEncryptionCustomerKeys.html
	SSEAlgorithmAES256 = "AES256"

	// SSEAlgorithmKMS is the value of 'X-Amz-Server-Side-Encryption' for SSE-KMS.
	// See: https://docs.aws.amazon.com/AmazonS3/latest/dev/UsingKMSEncryption.html
	SSEAlgorithmKMS = "aws:kms"
)
View Source
const (
	DefaultBitrotAlgorithm = HighwayHash256S
)

DefaultBitrotAlgorithm is the default algorithm used for bitrot protection.

View Source
const DefaultSkewTime = 15 * time.Minute

DefaultSkewTime - skew time is 15 minutes between minio peers.

View Source
const ReservedMetadataPrefix = "X-Minio-Internal-"

ReservedMetadataPrefix is the prefix of a metadata key which is reserved and for internal use only.

View Source
const SSEHeader = "X-Amz-Server-Side-Encryption"

SSEHeader is the general AWS SSE HTTP header key.

View Source
const SlashSeparator = "/"

SlashSeparator - slash separator.

Variables

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

	// GOROOT - GOROOT value at the time of build.
	GOROOT = ""

	// Version - version time.RFC3339.
	Version = goGetTag
	// ReleaseTag - release tag in TAG.%Y-%m-%dT%H-%M-%SZ.
	ReleaseTag = goGetTag
	// CommitID - latest commit id.
	CommitID = goGetTag
	// 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’.

View Source
var (
	// SSEC represents AWS SSE-C. It provides functionality to handle
	// SSE-C requests.
	SSEC = ssec{}

	// SSECopy represents AWS SSE-C for copy requests. It provides
	// functionality to handle SSE-C copy requests.
	SSECopy = ssecCopy{}
)
View Source
var (
	// ErrInvalidCustomerAlgorithm indicates that the specified SSE-C algorithm
	// is not supported.
	ErrInvalidCustomerAlgorithm = errors.New("the SSE-C algorithm is not supported")

	// ErrMissingCustomerKey indicates that the HTTP headers contains no SSE-C client key.
	ErrMissingCustomerKey = errors.New("the SSE-C request is missing the customer key")

	// ErrMissingCustomerKeyMD5 indicates that the HTTP headers contains no SSE-C client key
	// MD5 checksum.
	ErrMissingCustomerKeyMD5 = errors.New("the SSE-C request is missing the customer key MD5")

	// ErrInvalidCustomerKey indicates that the SSE-C client key is not valid - e.g. not a
	// base64-encoded string or not 256 bits long.
	ErrInvalidCustomerKey = errors.New("the SSE-C client key is invalid")

	// ErrSecretKeyMismatch indicates that the provided secret key (SSE-C client key / SSE-S3 KMS key)
	// does not match the secret key used during encrypting the object.
	ErrSecretKeyMismatch = errors.New("the secret key does not match the secret key used during upload")

	// ErrCustomerKeyMD5Mismatch indicates that the SSE-C key MD5 does not match the
	// computed MD5 sum. This means that the client provided either the wrong key for
	// a certain MD5 checksum or the wrong MD5 for a certain key.
	ErrCustomerKeyMD5Mismatch = errors.New("the provided SSE-C key MD5 does not match the computed MD5 of the SSE-C key")
)
View Source
var ErrMaliciousData = sio.NotAuthentic

ErrMaliciousData indicates that the stream cannot be decrypted by provided credentials.

View Source
var GlobalContext context.Context
View Source
var GlobalFlags = []cli.Flag{
	cli.BoolFlag{
		Name:  "quiet",
		Usage: "disable startup information",
	},
	cli.BoolFlag{
		Name:  "anonymous",
		Usage: "hide sensitive information from logging",
	},
	cli.BoolFlag{
		Name:  "json",
		Usage: "output server logs and startup information in json format",
	},
	cli.BoolFlag{
		Name:  "compat",
		Usage: "enable strict S3 compatibility by turning off certain performance optimizations",
	},
}

GlobalFlags - global flags for minio.

View Source
var GlobalServiceDoneCh <-chan struct{}

GlobalServiceDoneCh - Global service done channel.

View Source
var S3 = s3{}

S3 represents AWS SSE-S3. It provides functionality to handle SSE-S3 requests.

View Source
var S3KMS = s3KMS{}

S3KMS represents AWS SSE-KMS. It provides functionality to handle SSE-KMS requests.

Functions

func AnonErrToObjectErr

func AnonErrToObjectErr(statusCode int, params ...string) error

AnonErrToObjectErr - converts standard http codes into meaningful object layer errors.

func CheckLocalServerAddr

func CheckLocalServerAddr(serverAddr string) error

CheckLocalServerAddr - checks if serverAddr is valid and local host.

func CleanMinioInternalMetadataKeys

func CleanMinioInternalMetadataKeys(metadata map[string]string) map[string]string

CleanMinioInternalMetadataKeys removes X-Amz-Meta- prefix from minio internal encryption metadata that was sent by minio radio

func ComputeCompleteMultipartMD5

func ComputeCompleteMultipartMD5(parts []CompletePart) string

ComputeCompleteMultipartMD5 calculates MD5 ETag for complete multipart responses

func DecryptData

func DecryptData(password string, data io.Reader) ([]byte, error)

DecryptData decrypts the data with the key derived from the salt (part of data) and the password using the PBKDF used in EncryptData. DecryptData returns the decrypted plaintext on success.

The data must be a valid ciphertext produced by EncryptData. Otherwise, the decryption will fail.

func EncryptData

func EncryptData(password string, data []byte) ([]byte, error)

EncryptData encrypts the data with an unique key derived from password using the Argon2id PBKDF.

The returned ciphertext data consists of:

salt | AEAD ID | nonce | encrypted data
 32      1         8      ~ len(data)

func ErrorRespToObjectError

func ErrorRespToObjectError(err error, params ...string) error

ErrorRespToObjectError converts MinIO errors to minio object layer errors.

func FromMinioClientMetadata

func FromMinioClientMetadata(metadata map[string][]string) map[string]string

FromMinioClientMetadata converts minio metadata to map[string]string

func GenETag

func GenETag() string

GenETag - generate UUID based ETag

func HasPrefix

func HasPrefix(s string, prefix string) bool

HasPrefix - Prefix matcher string matches prefix in a platform specific way. For example on windows since its case insensitive we are supposed to do case insensitive checks.

func HasSuffix

func HasSuffix(s string, suffix string) bool

HasSuffix - Suffix matcher string matches suffix in a platform specific way. For example on windows since its case insensitive we are supposed to do case insensitive checks.

func IsBackendOnline

func IsBackendOnline(ctx context.Context, clnt *http.Client, urlStr string) bool

IsBackendOnline - verifies if the backend is reachable by performing a GET request on the URL. returns 'true' if backend is reachable.

func IsErr

func IsErr(err error, errs ...error) bool

IsErr returns whether given error is exact error.

func IsErrIgnored

func IsErrIgnored(err error, ignoredErrs ...error) bool

IsErrIgnored returns whether given error is ignored or not.

func IsRequested

func IsRequested(h http.Header) bool

IsRequested returns true if the HTTP headers indicates that any form server-side encryption (SSE-C, SSE-S3 or SSE-KMS) is requested.

func IsValidBucketName

func IsValidBucketName(bucket string) bool

IsValidBucketName verifies that a bucket name is in accordance with Amazon's requirements (i.e. DNS naming conventions). It must be 3-63 characters long, and it must be a sequence of one or more labels separated by periods. Each label can contain lowercase ascii letters, decimal digits and hyphens, but must not begin or end with a hyphen. 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 SlashSeparator.

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 LivenessCheckHandler

func LivenessCheckHandler(w http.ResponseWriter, r *http.Request)

LivenessCheckHandler -- checks if server can reach its disks internally. If not, server is considered to have failed and needs to be restarted. Liveness probes are used to detect situations where application (minio) has gone into a state where it can not recover except by being restarted.

func Main

func Main(args []string)

Main main for minio server.

func NewCustomHTTPTransport

func NewCustomHTTPTransport() *http.Transport

NewCustomHTTPTransport returns a new http configuration used while communicating with the cloud backends. This sets the value for MaxIdleConnsPerHost from 2 (go default) to 256.

func ReadinessCheckHandler

func ReadinessCheckHandler(w http.ResponseWriter, r *http.Request)

ReadinessCheckHandler -- checks if there are more than threshold number of goroutines running, returns service unavailable.

Readiness probes are used to detect situations where application is under heavy load and temporarily unable to serve. In a orchestrated setup like Kubernetes, containers reporting that they are not ready do not receive traffic through Kubernetes Services.

func RemoveSensitiveHeaders

func RemoveSensitiveHeaders(h http.Header)

RemoveSensitiveHeaders removes confidential encryption information - e.g. the SSE-C key - from the HTTP headers. It has the same semantics as RemoveSensitiveEntires.

func ToMinioClientCompletePart

func ToMinioClientCompletePart(part CompletePart) minio.CompletePart

ToMinioClientCompletePart converts CompletePart to minio CompletePart

func ToMinioClientCompleteParts

func ToMinioClientCompleteParts(parts []CompletePart) []minio.CompletePart

ToMinioClientCompleteParts converts []CompletePart to minio []CompletePart

func ToMinioClientMetadata

func ToMinioClientMetadata(metadata map[string]string) map[string]string

ToMinioClientMetadata converts metadata to map[string]string

func ToMinioClientObjectInfoMetadata

func ToMinioClientObjectInfoMetadata(metadata map[string]string) map[string][]string

ToMinioClientObjectInfoMetadata convertes metadata to map[string][]string

func ToS3ETag

func ToS3ETag(etag string) string

ToS3ETag - return checksum to ETag

func Trace

func Trace(f http.HandlerFunc, logBody bool, w http.ResponseWriter, r *http.Request) trace.Info

Trace gets trace of http request

func UTCNow

func UTCNow() time.Time

UTCNow - returns current UTC time.

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
	ErrPolicyTooLarge
	ErrIncompleteBody
	ErrInternalError
	ErrInvalidAccessKeyID
	ErrInvalidBucketName
	ErrInvalidDigest
	ErrInvalidRange
	ErrInvalidCopyPartRange
	ErrInvalidCopyPartRangeSource
	ErrInvalidMaxKeys
	ErrInvalidEncodingMethod
	ErrInvalidMaxUploads
	ErrInvalidMaxParts
	ErrInvalidPartNumberMarker
	ErrInvalidRequestBody
	ErrInvalidCopySource
	ErrInvalidMetadataDirective
	ErrInvalidCopyDest
	ErrInvalidPolicyDocument
	ErrInvalidObjectState
	ErrMalformedXML
	ErrMissingContentLength
	ErrMissingContentMD5
	ErrMissingRequestBodyError
	ErrNoSuchBucket
	ErrNoSuchBucketPolicy
	ErrNoSuchBucketLifecycle
	ErrNoSuchKey
	ErrNoSuchUpload
	ErrNoSuchVersion
	ErrNotImplemented
	ErrPreconditionFailed
	ErrRequestTimeTooSkewed
	ErrSignatureDoesNotMatch
	ErrMethodNotAllowed
	ErrInvalidPart
	ErrInvalidPartOrder
	ErrAuthorizationHeaderMalformed
	ErrMalformedPOSTRequest
	ErrPOSTFileRequired
	ErrSignatureVersionNotSupported
	ErrBucketNotEmpty
	ErrAllAccessDisabled
	ErrMalformedPolicy
	ErrMissingFields
	ErrMissingCredTag
	ErrCredMalformed
	ErrInvalidRegion
	ErrInvalidService
	ErrInvalidRequestVersion
	ErrMissingSignTag
	ErrMissingSignHeadersTag
	ErrMalformedDate
	ErrMalformedPresignedDate
	ErrMalformedCredentialDate
	ErrMalformedCredentialRegion
	ErrMalformedExpires
	ErrNegativeExpires
	ErrAuthHeaderEmpty
	ErrExpiredPresignRequest
	ErrRequestNotReadyYet
	ErrUnsignedHeaders
	ErrMissingDateHeader
	ErrInvalidQuerySignatureAlgo
	ErrInvalidQueryParams
	ErrBucketAlreadyOwnedByYou
	ErrInvalidDuration
	ErrBucketAlreadyExists
	ErrMetadataTooLarge
	ErrUnsupportedMetadata
	ErrMaximumExpires
	ErrSlowDown
	ErrInvalidPrefixMarker
	ErrBadRequest
	ErrKeyTooLongError
	ErrInvalidBucketObjectLockConfiguration
	ErrObjectLocked
	ErrPastObjectLockRetainDate
	ErrUnknownWORMModeDirective
	ErrObjectLockInvalidHeaders

	// Server-Side-Encryption (with Customer provided key) related API errors.
	ErrInsecureSSECustomerRequest
	ErrSSEMultipartEncrypted
	ErrSSEEncryptedObject
	ErrInvalidEncryptionParameters
	ErrInvalidSSECustomerAlgorithm
	ErrInvalidSSECustomerKey
	ErrMissingSSECustomerKey
	ErrMissingSSECustomerKeyMD5
	ErrSSECustomerKeyMD5Mismatch
	ErrInvalidSSECustomerParameters
	ErrKMSNotConfigured
	ErrKMSAuthFailure

	ErrNoAccessKey
	ErrInvalidToken

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

	// S3 extended errors.
	ErrContentSHA256Mismatch

	// Radio extended errors.
	ErrReadQuorum
	ErrWriteQuorum
	ErrParentIsObject
	ErrStorageFull
	ErrRequestBodyParse
	ErrObjectExistsAsDirectory
	ErrInvalidObjectName
	ErrInvalidObjectNamePrefixSlash
	ErrInvalidResourceName
	ErrServerNotInitialized
	ErrOperationTimedOut
	ErrInvalidRequest
	// Radio storage class error codes
	ErrInvalidStorageClass
	ErrBackendDown

	ErrMalformedJSON
	ErrAdminInvalidArgument
	ErrAdminInvalidAccessKey
	ErrAdminInvalidSecretKey
	ErrInsecureClientRequest
	ErrIncorrectContinuationToken

	// S3 Select Errors
	ErrEmptyRequestBody
	ErrUnsupportedFunction
	ErrInvalidExpressionType
	ErrBusy
	ErrUnauthorizedAccess
	ErrExpressionTooLong
	ErrIllegalSQLFunctionArgument
	ErrInvalidKeyPath
	ErrInvalidFileHeaderInfo
	ErrInvalidJSONType
	ErrInvalidQuoteFields
	ErrInvalidRequestParameter
	ErrInvalidDataType
	ErrInvalidTextEncoding
	ErrInvalidDataSource
	ErrInvalidTableAlias
	ErrMissingRequiredParameter
	ErrObjectSerializationConflict
	ErrUnsupportedSQLOperation
	ErrUnsupportedSQLStructure
	ErrUnsupportedSyntax
	ErrUnsupportedRangeHeader
	ErrLexerInvalidChar
	ErrLexerInvalidOperator
	ErrLexerInvalidLiteral
	ErrLexerInvalidIONLiteral
	ErrParseExpectedDatePart
	ErrParseExpectedKeyword
	ErrParseExpectedTokenType
	ErrParseExpected2TokenTypes
	ErrParseExpectedNumber
	ErrParseExpectedRightParenBuiltinFunctionCall
	ErrParseExpectedTypeName
	ErrParseExpectedWhenClause
	ErrParseUnsupportedToken
	ErrParseUnsupportedLiteralsGroupBy
	ErrParseExpectedMember
	ErrParseUnsupportedSelect
	ErrParseUnsupportedCase
	ErrParseUnsupportedCaseClause
	ErrParseUnsupportedAlias
	ErrParseUnsupportedSyntax
	ErrParseUnknownOperator
	ErrParseMissingIdentAfterAt
	ErrParseUnexpectedOperator
	ErrParseUnexpectedTerm
	ErrParseUnexpectedToken
	ErrParseUnexpectedKeyword
	ErrParseExpectedExpression
	ErrParseExpectedLeftParenAfterCast
	ErrParseExpectedLeftParenValueConstructor
	ErrParseExpectedLeftParenBuiltinFunctionCall
	ErrParseExpectedArgumentDelimiter
	ErrParseCastArity
	ErrParseInvalidTypeParam
	ErrParseEmptySelect
	ErrParseSelectMissingFrom
	ErrParseExpectedIdentForGroupName
	ErrParseExpectedIdentForAlias
	ErrParseUnsupportedCallWithStar
	ErrParseNonUnaryAgregateFunctionCall
	ErrParseMalformedJoin
	ErrParseExpectedIdentForAt
	ErrParseAsteriskIsNotAloneInSelectList
	ErrParseCannotMixSqbAndWildcardInSelectList
	ErrParseInvalidContextForWildcardInSelectList
	ErrIncorrectSQLFunctionArgumentType
	ErrValueParseFailure
	ErrEvaluatorInvalidArguments
	ErrIntegerOverflow
	ErrLikeInvalidInputs
	ErrCastFailed
	ErrInvalidCast
	ErrEvaluatorInvalidTimestampFormatPattern
	ErrEvaluatorInvalidTimestampFormatPatternSymbolForParsing
	ErrEvaluatorTimestampFormatPatternDuplicateFields
	ErrEvaluatorTimestampFormatPatternHourClockAmPmMismatch
	ErrEvaluatorUnterminatedTimestampFormatPatternToken
	ErrEvaluatorInvalidTimestampFormatPatternToken
	ErrEvaluatorInvalidTimestampFormatPatternSymbol
	ErrEvaluatorBindingDoesNotExist
	ErrMissingHeaders
	ErrInvalidColumnIndex

	ErrPostPolicyConditionInvalidFormat
)

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 `xml:"Key,omitempty" json:"Key,omitempty"`
	BucketName string `xml:"BucketName,omitempty" json:"BucketName,omitempty"`
	Resource   string
	Region     string `xml:"Region,omitempty" json:"Region,omitempty"`
	RequestID  string `xml:"RequestId" json:"RequestId"`
	HostID     string `xml:"HostId" json:"HostId"`
}

APIErrorResponse - error response format

type AllAccessDisabled

type AllAccessDisabled GenericError

AllAccessDisabled All access to this object has been disabled

func (AllAccessDisabled) Error

func (e AllAccessDisabled) Error() string

Return string an error formatted as the given text.

type BackendDown

type BackendDown struct{}

BackendDown is returned for network errors or if the radio's backend is down.

func (BackendDown) Error

func (e BackendDown) Error() string

type BitrotAlgorithm

type BitrotAlgorithm uint

BitrotAlgorithm specifies a algorithm used for bitrot protection.

const (
	// SHA256 represents the SHA-256 hash function
	SHA256 BitrotAlgorithm = 1 + iota
	// HighwayHash256 represents the HighwayHash-256 hash function
	HighwayHash256
	// HighwayHash256S represents the Streaming HighwayHash-256 hash function
	HighwayHash256S
	// BLAKE2b512 represents the BLAKE2b-512 hash function
	BLAKE2b512
)

func (BitrotAlgorithm) Available

func (a BitrotAlgorithm) Available() bool

Available reports whether the given algorithm is available.

func (BitrotAlgorithm) New

func (a BitrotAlgorithm) New() hash.Hash

New returns a new hash.Hash calculating the given bitrot algorithm.

func (BitrotAlgorithm) String

func (a BitrotAlgorithm) String() string

String returns the string identifier for a given bitrot algorithm. If the algorithm is not supported String panics.

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 BucketAlreadyExists

type BucketAlreadyExists GenericError

BucketAlreadyExists the requested bucket name is not available.

func (BucketAlreadyExists) Error

func (e BucketAlreadyExists) Error() string

type BucketAlreadyOwnedByYou

type BucketAlreadyOwnedByYou GenericError

BucketAlreadyOwnedByYou already owned by you.

func (BucketAlreadyOwnedByYou) Error

func (e BucketAlreadyOwnedByYou) Error() string

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 BucketLifecycleNotFound

type BucketLifecycleNotFound GenericError

BucketLifecycleNotFound - no bucket lifecycle found.

func (BucketLifecycleNotFound) Error

func (e BucketLifecycleNotFound) Error() string

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 CacheChecksumInfoV1

type CacheChecksumInfoV1 struct {
	Algorithm string `json:"algorithm"`
	Blocksize int64  `json:"blocksize"`
}

CacheChecksumInfoV1 - carries checksums of individual blocks on disk.

type CacheObjectLayer

type CacheObjectLayer interface {
	// Object operations.
	GetObjectNInfo(ctx context.Context, bucket, object string, rs *HTTPRangeSpec, h http.Header, lockType LockType, opts ObjectOptions) (gr *GetObjectReader, err error)
	GetObjectInfo(ctx context.Context, bucket, object string, opts ObjectOptions) (objInfo ObjectInfo, err error)
	DeleteObject(ctx context.Context, bucket, object string) error
	DeleteObjects(ctx context.Context, bucket string, objects []string) ([]error, error)
	PutObject(ctx context.Context, bucket, object string, data *PutObjReader, opts ObjectOptions) (objInfo ObjectInfo, err error)
	CopyObject(ctx context.Context, srcBucket, srcObject, destBucket, destObject string, srcInfo ObjectInfo, srcOpts, dstOpts ObjectOptions) (objInfo ObjectInfo, err error)
	// Storage operations.
	StorageInfo(ctx context.Context) CacheStorageInfo
	CacheStats() *CacheStats
}

CacheObjectLayer implements primitives for cache object API layer.

type CacheStats

type CacheStats struct {
	BytesServed atomic.Uint64
	Hits        atomic.Uint64
	Misses      atomic.Uint64
}

CacheStats - represents bytes served from cache, cache hits and cache misses.

type CacheStatusType

type CacheStatusType string

CacheStatusType - whether the request was served from cache.

const (
	// CacheHit - whether object was served from cache.
	CacheHit CacheStatusType = "HIT"

	// CacheMiss - object served from backend.
	CacheMiss CacheStatusType = "MISS"
)

func (CacheStatusType) String

func (c CacheStatusType) String() string

type CacheStorageInfo

type CacheStorageInfo struct {
	Total uint64 // Total cache disk space.
	Free  uint64 // Free cache available space.
}

CacheStorageInfo - represents total, free capacity of underlying cache storage.

type CheckCopyPreconditionFn

type CheckCopyPreconditionFn func(o ObjectInfo, encETag string) bool

CheckCopyPreconditionFn returns true if copy precondition check failed.

type CommonPrefix

type CommonPrefix struct {
	Prefix string
}

CommonPrefix container for prefix response in ListObjectsResponse

type CompleteMultipartUpload

type CompleteMultipartUpload struct {
	Parts []CompletePart `xml:"Part"`
}

CompleteMultipartUpload - represents list of parts which are completed, this is sent by the client during CompleteMultipartUpload request.

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 CompletePart

type CompletePart struct {
	// Part number identifying the part. This is a positive integer between 1 and
	// 10,000
	PartNumber int

	// Entity tag returned when the part was uploaded.
	ETag string
}

CompletePart - represents the part that was completed, this is sent by the client during CompleteMultipartUpload request.

type CompletedParts

type CompletedParts []CompletePart

CompletedParts - is a collection satisfying sort.Interface.

func (CompletedParts) Len

func (a CompletedParts) Len() int

func (CompletedParts) Less

func (a CompletedParts) Less(i, j int) bool

func (CompletedParts) Swap

func (a CompletedParts) Swap(i, j int)

type ConnStats

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

ConnStats - Network statistics Count total input/output transferred bytes during the server's life.

type CopyObjectPartResponse

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

CopyObjectPartResponse container returns ETag and LastModified of the successfully copied object

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

type Endpoint struct {
	*url.URL
	IsLocal  bool
	SetIndex int
}

Endpoint - any type of endpoint.

func NewEndpoint

func NewEndpoint(arg string) (ep Endpoint, e error)

NewEndpoint - returns new endpoint based on given arguments.

func (Endpoint) HTTPS

func (endpoint Endpoint) HTTPS() bool

HTTPS - returns true if secure for URLEndpointType.

func (Endpoint) String

func (endpoint Endpoint) String() string

func (Endpoint) Type

func (endpoint Endpoint) Type() EndpointType

Type - returns type of endpoint.

func (*Endpoint) UpdateIsLocal

func (endpoint *Endpoint) UpdateIsLocal() (err error)

UpdateIsLocal - resolves the host and updates if it is local or not.

type EndpointType

type EndpointType int

EndpointType - enum for endpoint type.

const (
	// PathEndpointType - path style endpoint type enum.
	PathEndpointType EndpointType = iota + 1

	// URLEndpointType - URL style endpoint type enum.
	URLEndpointType
)

type Endpoints

type Endpoints []Endpoint

Endpoints - list of same type of endpoint.

func NewEndpoints

func NewEndpoints(args ...string) (endpoints Endpoints, err error)

NewEndpoints - returns new endpoint list based on input args.

func (Endpoints) GetString

func (endpoints Endpoints) GetString(i int) string

GetString - returns endpoint string of i-th endpoint (0-based), and empty string for invalid indexes.

func (Endpoints) HTTPS

func (endpoints Endpoints) HTTPS() bool

HTTPS - returns true if secure for URLEndpointType.

func (Endpoints) UpdateIsLocal

func (endpoints Endpoints) UpdateIsLocal() error

UpdateIsLocal - resolves the host and discovers the local host.

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

	// File metadata
	Metadata map[string]string

	// All the parts per object.
	Parts []ObjectPartInfo

	Quorum int
}

FileInfo - represents file stat information.

type FilesInfo

type FilesInfo struct {
	Files       []FileInfo
	IsTruncated bool
}

FilesInfo represent a list of files, additionally indicates if the list is last.

type GenericError

type GenericError struct {
	Bucket string
	Object string
}

GenericError - generic object layer error.

type GetObjectInfoFn

type GetObjectInfoFn func(ctx context.Context, bucket, object string, opts ObjectOptions) (objInfo ObjectInfo, err error)

GetObjectInfoFn is the signature of GetObjectInfo function.

type GetObjectReader

type GetObjectReader struct {
	ObjInfo ObjectInfo
	// contains filtered or unexported fields
}

GetObjectReader is a type that wraps a reader with a lock to provide a ReadCloser interface that unlocks on Close()

func NewGetObjectReaderFromReader

func NewGetObjectReaderFromReader(r io.Reader, oi ObjectInfo, opts ObjectOptions, cleanupFns ...func()) (*GetObjectReader, error)

NewGetObjectReaderFromReader sets up a GetObjectReader with a given reader. This ignores any object properties.

func (*GetObjectReader) Close

func (g *GetObjectReader) Close() error

Close - calls the cleanup actions in reverse order

func (*GetObjectReader) Read

func (g *GetObjectReader) Read(p []byte) (n int, err error)

Read - to implement Reader interface.

type HTTPAPIStats

type HTTPAPIStats struct {
	APIStats map[string]int
	sync.RWMutex
}

HTTPAPIStats holds statistics information about a given API in the requests.

func (*HTTPAPIStats) Dec

func (stats *HTTPAPIStats) Dec(api string)

Dec increments the api stats counter.

func (*HTTPAPIStats) Inc

func (stats *HTTPAPIStats) Inc(api string)

Inc increments the api stats counter.

func (*HTTPAPIStats) Load

func (stats *HTTPAPIStats) Load() map[string]int

Load returns the recorded stats.

type HTTPConsoleLoggerSys

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

HTTPConsoleLoggerSys holds global console logger state

func NewConsoleLogger

func NewConsoleLogger(ctx context.Context) *HTTPConsoleLoggerSys

NewConsoleLogger - creates new HTTPConsoleLoggerSys with all nodes subscribed to the console logging pub sub system

func (*HTTPConsoleLoggerSys) Console

Console returns a console target

func (*HTTPConsoleLoggerSys) HasLogListeners

func (sys *HTTPConsoleLoggerSys) HasLogListeners() bool

HasLogListeners returns true if console log listeners are registered for this node or peers

func (*HTTPConsoleLoggerSys) Send

func (sys *HTTPConsoleLoggerSys) Send(e interface{}, logKind string) error

Send log message 'e' to console and publish to console log pubsub system

func (*HTTPConsoleLoggerSys) Subscribe

func (sys *HTTPConsoleLoggerSys) Subscribe(subCh chan interface{}, doneCh chan struct{}, node string, last int, logKind string, filter func(entry interface{}) bool)

Subscribe starts console logging for this node.

type HTTPRangeSpec

type HTTPRangeSpec struct {
	// Does the range spec refer to a suffix of the object?
	IsSuffixLength bool

	// Start and end offset specified in range spec
	Start, End int64
}

HTTPRangeSpec represents a range specification as supported by S3 GET object request.

Case 1: Not present -> represented by a nil RangeSpec Case 2: bytes=1-10 (absolute start and end offsets) -> RangeSpec{false, 1, 10} Case 3: bytes=10- (absolute start offset with end offset unspecified) -> RangeSpec{false, 10, -1} Case 4: bytes=-30 (suffix length specification) -> RangeSpec{true, -30, -1}

func (*HTTPRangeSpec) GetLength

func (h *HTTPRangeSpec) GetLength(resourceSize int64) (rangeLength int64, err error)

GetLength - get length of range

func (*HTTPRangeSpec) GetOffsetLength

func (h *HTTPRangeSpec) GetOffsetLength(resourceSize int64) (start, length int64, err error)

GetOffsetLength computes the start offset and length of the range given the size of the resource

func (*HTTPRangeSpec) String

func (h *HTTPRangeSpec) String(resourceSize int64) string

String returns stringified representation of range for a particular resource size.

type HTTPStats

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

HTTPStats holds statistics information about HTTP requests made by all clients

type HandlerFunc

type HandlerFunc func(http.Handler) http.Handler

HandlerFunc - useful to chain different middleware http.Handler

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 InvalidETag

type InvalidETag struct{}

InvalidETag error returned when the etag has changed on disk

func (InvalidETag) Error

func (e InvalidETag) Error() string

type InvalidMarkerPrefixCombination

type InvalidMarkerPrefixCombination struct {
	Marker, Prefix string
}

InvalidMarkerPrefixCombination - invalid marker and prefix combination.

func (InvalidMarkerPrefixCombination) Error

type InvalidPart

type InvalidPart struct {
	PartNumber int
	ExpETag    string
	GotETag    string
}

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 {
	OffsetBegin  int64
	OffsetEnd    int64
	ResourceSize int64
}

InvalidRange - invalid range typed error.

func (InvalidRange) Error

func (e InvalidRange) Error() string

type InvalidUploadID

type InvalidUploadID struct {
	Bucket   string
	Object   string
	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 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 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 []MultipartInfo

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

func FromMinioClientListMultipartsInfo

func FromMinioClientListMultipartsInfo(lmur minio.ListMultipartUploadsResult) ListMultipartsInfo

FromMinioClientListMultipartsInfo converts minio ListMultipartUploadsResult to ListMultipartsInfo

func (ListMultipartsInfo) Lookup

func (lm ListMultipartsInfo) Lookup(uploadID string) bool

Lookup - returns if uploadID is valid

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: AWS S3 returns NextMarker only if you have delimiter request parameter specified,
	//       MinIO always returns NextMarker.
	NextMarker string

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

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

ListObjectsInfo - container for list objects.

func FromMinioClientListBucketResult

func FromMinioClientListBucketResult(bucket string, result minio.ListBucketResult) ListObjectsInfo

FromMinioClientListBucketResult converts minio ListBucketResult to ListObjectsInfo

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 ListObjectsV2Info

type ListObjectsV2Info 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.
	ContinuationToken     string
	NextContinuationToken string

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

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

ListObjectsV2Info - container for list objects version 2.

func FromMinioClientListBucketResultToV2Info

func FromMinioClientListBucketResultToV2Info(bucket string, result minio.ListBucketResult) ListObjectsV2Info

FromMinioClientListBucketResultToV2Info converts minio ListBucketResult to ListObjectsV2Info

func FromMinioClientListBucketV2Result

func FromMinioClientListBucketV2Result(bucket string, result minio.ListBucketV2Result) ListObjectsV2Info

FromMinioClientListBucketV2Result converts minio ListBucketResult to ListObjectsInfo

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

	// Any metadata set during InitMultipartUpload, including encryption headers.
	UserDefined map[string]string

	EncodingType string // Not supported yet.
}

ListPartsInfo - represents list of all parts.

func FromMinioClientListPartsInfo

func FromMinioClientListPartsInfo(lopr minio.ListObjectPartsResult) ListPartsInfo

FromMinioClientListPartsInfo converts minio ListObjectPartsResult to ListPartsInfo

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 ListVersionsResponse

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

	Name      string
	Prefix    string
	KeyMarker 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.
	NextKeyMarker string `xml:"NextKeyMarker,omitempty"`

	// When the number of responses exceeds the value of MaxKeys,
	// NextVersionIdMarker specifies the first object version not
	// returned that satisfies the search criteria. Use this value
	// for the version-id-marker request parameter in a subsequent request.
	NextVersionIDMarker string `xml:"NextVersionIdMarker"`

	// Marks the last version of the Key returned in a truncated response.
	VersionIDMarker string `xml:"VersionIdMarker"`

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

	CommonPrefixes []CommonPrefix
	Versions       []ObjectVersion

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

ListVersionsResponse - format for list bucket versions response.

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 LockType

type LockType int

LockType represents required locking for ObjectLayer operations

const (
	NoLock LockType = iota
	ReadLock
	WriteLock
)

Different lock types

type LogInfo

type LogInfo struct {
	log.Entry
	ConsoleMsg string
	NodeName   string `json:"node"`
	Err        error  `json:"-"`
}

LogInfo holds console log messages

func (LogInfo) SendLog

func (l LogInfo) SendLog(node, logKind string) bool

SendLog returns true if log pertains to node specified in args.

type MalformedUploadID

type MalformedUploadID struct {
	UploadID string
}

MalformedUploadID malformed upload id.

func (MalformedUploadID) Error

func (e MalformedUploadID) Error() string

type Metrics

type Metrics struct {
	BytesReceived atomic.Uint64
	BytesSent     atomic.Uint64
	RequestStats  map[string]int
	sync.RWMutex
}

Metrics - represents bytes served

func NewMetrics

func NewMetrics() *Metrics

NewMetrics - Prepare new Metrics structure

func (*Metrics) GetBytesReceived

func (s *Metrics) GetBytesReceived() uint64

GetBytesReceived - Get total bytes received from radio backend

func (*Metrics) GetBytesSent

func (s *Metrics) GetBytesSent() uint64

GetBytesSent - Get total bytes received from radio backend

func (*Metrics) GetRequests

func (s *Metrics) GetRequests() map[string]int

GetRequests - Get total number of requests sent to radio backend

func (*Metrics) IncBytesReceived

func (s *Metrics) IncBytesReceived(n int64)

IncBytesReceived - Increase total bytes received from radio backend

func (*Metrics) IncBytesSent

func (s *Metrics) IncBytesSent(n int64)

IncBytesSent - Increase total bytes sent to radio backend

func (*Metrics) IncRequests

func (s *Metrics) IncRequests(method string)

IncRequests - Increase request sent to radio backend by 1

type MultipartInfo

type MultipartInfo struct {
	// Object name for which the multipart upload was initiated.
	Object string

	// Unique identifier for this multipart upload.
	UploadID string

	// Date and time at which the multipart upload was initiated.
	Initiated time.Time

	StorageClass string // Not supported yet.
}

MultipartInfo - represents metadata in progress multipart upload.

type NSLockMap

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

NSLockMap - namespace lock map, provides primitives to Lock, Unlock, RLock and RUnlock.

func (*NSLockMap) Lock

func (n *NSLockMap) Lock(volume, path, opsID string, timeout time.Duration) (locked bool)

Lock - locks the given resource for writes, using a previously allocated name space lock or initializing a new one.

func (*NSLockMap) NewNSLock

func (n *NSLockMap) NewNSLock(ctx context.Context, lockersFn func() []dsync.NetLocker, volume string, paths ...string) RWLocker

NewNSLock - returns a lock instance for a given volume and path. The returned lockInstance object encapsulates the nsLockMap, volume, path and operation ID.

func (*NSLockMap) RLock

func (n *NSLockMap) RLock(volume, path, opsID string, timeout time.Duration) (locked bool)

RLock - locks any previously acquired read locks.

func (*NSLockMap) RUnlock

func (n *NSLockMap) RUnlock(volume, path, opsID string)

RUnlock - unlocks any previously acquired read locks.

func (*NSLockMap) Unlock

func (n *NSLockMap) Unlock(volume, path, opsID string)

Unlock - unlocks any previously acquired write locks.

type NotImplemented

type NotImplemented struct{}

NotImplemented If a feature is not implemented

func (NotImplemented) Error

func (e NotImplemented) Error() string

type ObjReaderFn

type ObjReaderFn func(inputReader io.Reader, h http.Header, pcfn CheckCopyPreconditionFn, cleanupFns ...func()) (r *GetObjectReader, err error)

ObjReaderFn is a function type that takes a reader and returns GetObjectReader and an error. Request headers are passed to provide encryption parameters. cleanupFns allow cleanup funcs to be registered for calling after usage of the reader.

func NewGetObjectReader

func NewGetObjectReader(rs *HTTPRangeSpec, oi ObjectInfo, opts ObjectOptions, cleanUpFns ...func()) (
	fn ObjReaderFn, off, length int64, err error)

NewGetObjectReader creates a new GetObjectReader. The cleanUpFns are called on Close() in reverse order as passed here. NOTE: It is assumed that clean up functions do not panic (otherwise, they may not all run!).

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

	// UserMetadata user-defined metadata
	UserMetadata StringMap `xml:"UserMetadata,omitempty"`
}

Object container for object metadata

type ObjectAlreadyExists

type ObjectAlreadyExists GenericError

ObjectAlreadyExists object already exists.

func (ObjectAlreadyExists) Error

func (e ObjectAlreadyExists) Error() string

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 unique entity tag of the object.
	ETag 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

	// Date and time at which the object is no longer able to be cached
	Expires time.Time
	// CacheStatus sets status of whether this is a cache hit/miss
	CacheStatus CacheStatusType
	// CacheLookupStatus sets whether a cacheable response is present in the cache
	CacheLookupStatus CacheStatusType

	// Specify object storage class
	StorageClass string

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

	// List of individual parts, maximum size of upto 10,000
	Parts []ObjectPartInfo `json:"-"`

	// Implements writer and reader used by CopyObject API
	Writer       io.WriteCloser `json:"-"`
	Reader       *hash.Reader   `json:"-"`
	PutObjReader *PutObjReader  `json:"-"`

	// ReplicaIndex provides guidance for the caller
	// about the object and its actual location at the backend
	ReplicaIndex int

	// Date and time when the object was last accessed.
	AccTime time.Time
	// contains filtered or unexported fields
}

ObjectInfo - represents object metadata.

func FromMinioClientObjectInfo

func FromMinioClientObjectInfo(bucket string, oi minio.ObjectInfo, replicaIdx int) ObjectInfo

FromMinioClientObjectInfo converts minio ObjectInfo to radio ObjectInfo

func (ObjectInfo) GetActualSize

func (o ObjectInfo) GetActualSize() int64

GetActualSize - read the decompressed size from the meta json.

func (ObjectInfo) IsCacheable

func (o ObjectInfo) IsCacheable() bool

IsCacheable returns if the object should be saved in the cache.

type ObjectLayer

type ObjectLayer interface {
	// Locking operations on object.
	NewNSLock(ctx context.Context, bucket string, object string) RWLocker

	// Bucket operations.
	GetBucketInfo(ctx context.Context, bucket string) (bucketInfo BucketInfo, err error)
	ListBuckets(ctx context.Context) (buckets []BucketInfo, err error)
	ListObjects(ctx context.Context, bucket, prefix, marker, delimiter string, maxKeys int) (result ListObjectsInfo, err error)
	ListObjectsV2(ctx context.Context, bucket, prefix, continuationToken, delimiter string, maxKeys int, fetchOwner bool, startAfter string) (result ListObjectsV2Info, err error)

	// GetObjectNInfo returns a GetObjectReader that satisfies the
	// ReadCloser interface. The Close method unlocks the object
	// after reading, so it must always be called after usage.
	//
	// IMPORTANTLY, when implementations return err != nil, this
	// function MUST NOT return a non-nil ReadCloser.
	GetObjectNInfo(ctx context.Context, bucket, object string, rs *HTTPRangeSpec, h http.Header, lockType LockType, opts ObjectOptions) (reader *GetObjectReader, err error)
	GetObject(ctx context.Context, bucket, object string, startOffset int64, length int64, writer io.Writer, etag string, opts ObjectOptions) (err error)
	GetObjectInfo(ctx context.Context, bucket, object string, opts ObjectOptions) (objInfo ObjectInfo, err error)
	PutObject(ctx context.Context, bucket, object string, data *PutObjReader, opts ObjectOptions) (objInfo ObjectInfo, err error)
	CopyObject(ctx context.Context, srcBucket, srcObject, destBucket, destObject string, srcInfo ObjectInfo, srcOpts, dstOpts ObjectOptions) (objInfo ObjectInfo, err error)
	DeleteObject(ctx context.Context, bucket, object string) error
	DeleteObjects(ctx context.Context, bucket string, objects []string) ([]error, error)

	// Multipart operations.
	ListMultipartUploads(ctx context.Context, bucket, prefix, keyMarker, uploadIDMarker, delimiter string, maxUploads int) (result ListMultipartsInfo, err error)
	NewMultipartUpload(ctx context.Context, bucket, object string, opts ObjectOptions) (uploadID string, err error)
	CopyObjectPart(ctx context.Context, srcBucket, srcObject, destBucket, destObject string, uploadID string, partID int,
		startOffset int64, length int64, srcInfo ObjectInfo, srcOpts, dstOpts ObjectOptions) (info PartInfo, err error)
	PutObjectPart(ctx context.Context, bucket, object, uploadID string, partID int, data *PutObjReader, opts ObjectOptions) (info PartInfo, err error)
	ListObjectParts(ctx context.Context, bucket, object, uploadID string, partNumberMarker int, maxParts int, opts ObjectOptions) (result ListPartsInfo, err error)
	AbortMultipartUpload(ctx context.Context, bucket, object, uploadID string) error
	CompleteMultipartUpload(ctx context.Context, bucket, object, uploadID string, uploadedParts []CompletePart, opts ObjectOptions) (objInfo ObjectInfo, 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 ObjectNamePrefixAsSlash

type ObjectNamePrefixAsSlash GenericError

ObjectNamePrefixAsSlash - object name has a slash as prefix.

func (ObjectNamePrefixAsSlash) Error

func (e ObjectNamePrefixAsSlash) Error() string

Return string an error formatted as the given text.

type ObjectNameTooLong

type ObjectNameTooLong GenericError

ObjectNameTooLong - object name too long.

func (ObjectNameTooLong) Error

func (e ObjectNameTooLong) 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 ObjectOptions

type ObjectOptions struct {
	ServerSideEncryption encrypt.ServerSide
	UserDefined          map[string]string
	CheckCopyPrecondFn   CheckCopyPreconditionFn
}

ObjectOptions represents object options for ObjectLayer operations

type ObjectPartInfo

type ObjectPartInfo struct {
	Number     int    `json:"number"`
	Name       string `json:"name"`
	ETag       string `json:"etag"`
	Size       int64  `json:"size"`
	ActualSize int64  `json:"actualSize"`
}

ObjectPartInfo Info of each part kept in the multipart metadata file after CompleteMultipartUpload() is called.

type ObjectTooLarge

type ObjectTooLarge GenericError

ObjectTooLarge error returned when the size of the object > max object size allowed (5G) per request.

func (ObjectTooLarge) Error

func (e ObjectTooLarge) Error() string

type ObjectTooSmall

type ObjectTooSmall GenericError

ObjectTooSmall error returned when the size of the object < what is expected.

func (ObjectTooSmall) Error

func (e ObjectTooSmall) Error() string

type ObjectVersion

type ObjectVersion struct {
	XMLName xml.Name `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Version" json:"-"`
	Object
	VersionID string `xml:"VersionId"`
	IsLatest  bool
}

ObjectVersion container for object version metadata

type OperationTimedOut

type OperationTimedOut struct {
	Path string
}

OperationTimedOut - a timeout occurred.

func (OperationTimedOut) Error

func (e OperationTimedOut) Error() string

type Owner

type Owner struct {
	ID          string
	DisplayName string
}

Owner - bucket owner/principal

type ParentIsObject

type ParentIsObject GenericError

ParentIsObject object access is denied.

func (ParentIsObject) Error

func (e ParentIsObject) Error() string

type Part

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

Part container for part metadata.

type PartInfo

type PartInfo struct {
	// Part number that identifies the part. This is a positive integer between
	// 1 and 10,000.
	PartNumber int

	// Date and time at which the part was uploaded.
	LastModified time.Time

	// Entity tag returned when the part was initially uploaded.
	ETag string

	// Size in bytes of the part.
	Size int64

	// Decompressed Size.
	ActualSize int64
}

PartInfo - represents individual part metadata.

func FromMinioClientObjectPart

func FromMinioClientObjectPart(op minio.ObjectPart) PartInfo

FromMinioClientObjectPart converts minio ObjectPart to PartInfo

type PartTooBig

type PartTooBig struct{}

PartTooBig returned if size of part is bigger than the allowed limit.

func (PartTooBig) Error

func (e PartTooBig) Error() string

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 []struct {
			Operator string
			Key      string
			Value    string
		}
		ContentLengthRange contentLengthRange
	}
}

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

type PostResponse

type PostResponse struct {
	Bucket   string
	Key      string
	ETag     string
	Location string
}

PostResponse container for POST object request when success_action_status is set to 201

type PreConditionFailed

type PreConditionFailed struct{}

PreConditionFailed - Check if copy precondition failed

func (PreConditionFailed) Error

func (e PreConditionFailed) Error() string

type PrefixAccessDenied

type PrefixAccessDenied GenericError

PrefixAccessDenied object access is denied.

func (PrefixAccessDenied) Error

func (e PrefixAccessDenied) Error() string

type ProtectionType

type ProtectionType string

ProtectionType different protection types

const (
	MirrorType  ProtectionType = "mirror"
	ErasureType ProtectionType = "erasure"
)

Different type of protection types.

type PutObjReader

type PutObjReader struct {
	*hash.Reader // actual data stream
	// contains filtered or unexported fields
}

PutObjReader is a type that wraps sio.EncryptReader and underlying hash.Reader in a struct

func NewPutObjReader

func NewPutObjReader(rawReader *hash.Reader, encReader *hash.Reader, encKey []byte) *PutObjReader

NewPutObjReader returns a new PutObjReader and holds reference to underlying data stream from client and the encrypted data reader

func (*PutObjReader) MD5CurrentHexString

func (p *PutObjReader) MD5CurrentHexString() string

MD5CurrentHexString returns the current MD5Sum or encrypted MD5Sum as a hex encoded string

func (*PutObjReader) Size

func (p *PutObjReader) Size() int64

Size returns the absolute number of bytes the Reader will return during reading. It returns -1 for unlimited data.

type RWLocker

type RWLocker interface {
	GetLock(timeout *dynamicTimeout) (timedOutErr error)
	Unlock()
	GetRLock(timeout *dynamicTimeout) (timedOutErr error)
	RUnlock()
}

RWLocker - locker interface to introduce GetRLock, RUnlock.

type Radio

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

Radio implements active/active radioted radio

func (*Radio) NewRadioLayer

func (g *Radio) NewRadioLayer() (ObjectLayer, error)

NewRadioLayer returns s3 ObjectLayer.

func (*Radio) Production

func (g *Radio) Production() bool

Production - radio radio is not yet production ready.

type RangeInfo

type RangeInfo struct {
	Range string
	File  string
	Size  int64
}

RangeInfo has the range, file and range length information for a cached range.

func (*RangeInfo) Empty

func (r *RangeInfo) Empty() bool

Empty returns true if this is an empty struct

type SealMD5CurrFn

type SealMD5CurrFn func([]byte) []byte

SealMD5CurrFn seals md5sum with object encryption key and returns sealed md5sum

type ServerConnStats

type ServerConnStats struct {
	TotalInputBytes  uint64 `json:"transferred"`
	TotalOutputBytes uint64 `json:"received"`
	Throughput       uint64 `json:"throughput,omitempty"`
	S3InputBytes     uint64 `json:"transferredS3"`
	S3OutputBytes    uint64 `json:"receivedS3"`
}

ServerConnStats holds transferred bytes from/to the server

type ServerHTTPAPIStats

type ServerHTTPAPIStats struct {
	APIStats map[string]int `json:"apiStats"`
}

ServerHTTPAPIStats holds total number of HTTP operations from/to the server, including the average duration the call was spent.

type ServerHTTPStats

type ServerHTTPStats struct {
	CurrentS3Requests ServerHTTPAPIStats `json:"currentS3Requests"`
	TotalS3Requests   ServerHTTPAPIStats `json:"totalS3Requests"`
	TotalS3Errors     ServerHTTPAPIStats `json:"totalS3Errors"`
}

ServerHTTPStats holds all type of http operations performed to/from the server including their average execution time.

type SignatureDoesNotMatch

type SignatureDoesNotMatch struct{}

SignatureDoesNotMatch - when content md5 does not match with what was sent from client.

func (SignatureDoesNotMatch) Error

func (e SignatureDoesNotMatch) Error() string

type SlowDown

type SlowDown struct{}

SlowDown too many file descriptors open or backend busy .

func (SlowDown) Error

func (e SlowDown) Error() string

type StatInfo

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

StatInfo - alias for statInfo

type StorageFull

type StorageFull struct{}

StorageFull storage ran out of space.

func (StorageFull) Error

func (e StorageFull) Error() string

type StringMap

type StringMap map[string]string

StringMap is a map[string]string.

func (StringMap) MarshalXML

func (s StringMap) MarshalXML(e *xml.Encoder, start xml.StartElement) error

MarshalXML - StringMap marshals into XML.

type UnsupportedDelimiter

type UnsupportedDelimiter struct {
	Delimiter string
}

UnsupportedDelimiter - unsupported delimiter.

func (UnsupportedDelimiter) Error

func (e UnsupportedDelimiter) Error() string

type UnsupportedMetadata

type UnsupportedMetadata struct{}

UnsupportedMetadata - unsupported metadata

func (UnsupportedMetadata) Error

func (e UnsupportedMetadata) 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 VerifyFileError

type VerifyFileError string

VerifyFileError represents error generated by VerifyFile posix call.

func (VerifyFileError) Error

func (h VerifyFileError) Error() string

Error method for the hashMismatchError

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.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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