You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
225 lines
6.4 KiB
225 lines
6.4 KiB
10 years ago
|
/*
|
||
9 years ago
|
* Minio Cloud Storage, (C) 2016 Minio, Inc.
|
||
10 years ago
|
*
|
||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
|
* you may not use this file except in compliance with the License.
|
||
|
* You may obtain a copy of the License at
|
||
|
*
|
||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||
|
*
|
||
|
* Unless required by applicable law or agreed to in writing, software
|
||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
|
* See the License for the specific language governing permissions and
|
||
|
* limitations under the License.
|
||
|
*/
|
||
|
|
||
8 years ago
|
package cmd
|
||
10 years ago
|
|
||
9 years ago
|
import "time"
|
||
10 years ago
|
|
||
9 years ago
|
// StorageInfo - represents total capacity of underlying storage.
|
||
|
type StorageInfo struct {
|
||
9 years ago
|
// Total disk space.
|
||
|
Total int64
|
||
|
// Free available disk space.
|
||
|
Free int64
|
||
9 years ago
|
}
|
||
|
|
||
9 years ago
|
// BucketInfo - represents bucket metadata.
|
||
9 years ago
|
type BucketInfo struct {
|
||
9 years ago
|
// Name of the bucket.
|
||
|
Name string
|
||
|
|
||
|
// Date and time when the bucket was created.
|
||
9 years ago
|
Created time.Time
|
||
|
}
|
||
|
|
||
9 years ago
|
// ObjectInfo - represents object metadata.
|
||
9 years ago
|
type ObjectInfo struct {
|
||
9 years ago
|
// 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.
|
||
9 years ago
|
ContentEncoding string
|
||
9 years ago
|
|
||
|
// User-Defined metadata
|
||
|
UserDefined map[string]string
|
||
10 years ago
|
}
|
||
|
|
||
9 years ago
|
// ListPartsInfo - represents list of all parts.
|
||
9 years ago
|
type ListPartsInfo struct {
|
||
9 years ago
|
// 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.
|
||
10 years ago
|
NextPartNumberMarker int
|
||
|
|
||
9 years ago
|
// 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.
|
||
10 years ago
|
}
|
||
|
|
||
9 years ago
|
// ListMultipartsInfo - represnets bucket resources for incomplete multipart uploads.
|
||
9 years ago
|
type ListMultipartsInfo struct {
|
||
9 years ago
|
// 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.
|
||
10 years ago
|
NextUploadIDMarker string
|
||
9 years ago
|
|
||
|
// 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.
|
||
10 years ago
|
}
|
||
|
|
||
9 years ago
|
// ListObjectsInfo - container for list objects.
|
||
|
type ListObjectsInfo struct {
|
||
9 years ago
|
// 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.
|
||
9 years ago
|
IsTruncated bool
|
||
9 years ago
|
|
||
|
// 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
|
||
9 years ago
|
}
|
||
|
|
||
9 years ago
|
// partInfo - represents individual part metadata.
|
||
9 years ago
|
type partInfo struct {
|
||
9 years ago
|
// 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.
|
||
9 years ago
|
LastModified time.Time
|
||
9 years ago
|
|
||
|
// Entity tag returned when the part was initially uploaded.
|
||
|
ETag string
|
||
|
|
||
|
// Size in bytes of the part.
|
||
|
Size int64
|
||
9 years ago
|
}
|
||
|
|
||
9 years ago
|
// uploadMetadata - represents metadata in progress multipart upload.
|
||
9 years ago
|
type uploadMetadata struct {
|
||
9 years ago
|
// 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.
|
||
9 years ago
|
}
|
||
|
|
||
|
// completePart - completed part container.
|
||
|
type completePart struct {
|
||
9 years ago
|
// Part number identifying the part. This is a positive integer between 1 and
|
||
|
// 10,000
|
||
9 years ago
|
PartNumber int
|
||
9 years ago
|
|
||
|
// Entity tag returned when the part was uploaded.
|
||
|
ETag string
|
||
9 years ago
|
}
|
||
|
|
||
9 years ago
|
// completedParts - is a collection satisfying sort.Interface.
|
||
9 years ago
|
type completedParts []completePart
|
||
9 years ago
|
|
||
|
func (a completedParts) Len() int { return len(a) }
|
||
|
func (a completedParts) Swap(i, j int) { a[i], a[j] = a[j], a[i] }
|
||
|
func (a completedParts) Less(i, j int) bool { return a[i].PartNumber < a[j].PartNumber }
|
||
|
|
||
9 years ago
|
// completeMultipartUpload - represents input fields for completing multipart upload.
|
||
9 years ago
|
type completeMultipartUpload struct {
|
||
9 years ago
|
Parts []completePart `xml:"Part"`
|
||
9 years ago
|
}
|