objectnode

package
v2.5.0-rc.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2021 License: Apache-2.0 Imports: 40 Imported by: 2

Documentation

Index

Constants

View Source
const (
	//Permission Value
	ReadPermission        Permission = "READ"
	WritePermission                  = "WRITE"
	ReadACPPermission                = "READ_ACP"
	WriteACPPermission               = "WRITE_ACP"
	FullControlPermission            = "FULL_CONTROL"
)
View Source
const (
	PrivateACL                StandardACL = "private"
	PublicReadACL                         = "public-read"
	PubliceReadWriteACL                   = "public-read-write"
	AwsExecReadACL                        = "aws-exec-read"
	AuthenticatedReadACL                  = "authenticated-read"
	BucketOwnerReadACL                    = "bucket-owner-read"
	BucketOwnerFullControlACL             = "bucket-owner-full-control"
	LogDeliveryWriteACL                   = "log-delivery-write"
)
View Source
const (
	XMLNS    = "http://www.w3.org/2001/XMLSchema-instance"
	XSI_TYPE = "CanonicalUser" //

)
View Source
const (
	ContextKeyRequestID     = "ctx_request_id"
	ContextKeyRequestAction = "ctx_request_action"
	ContextKeyStatusCode    = "status_code"
	ContextKeyErrorMessage  = "error_message"
)
View Source
const (
	SignatrueV2 AuthType = "signature_v2"
	SignatrueV4          = "signature_v4"
	PresignedV2          = "presigned_v2"
	PresignedV4          = "presigned_v4"
)
View Source
const (
	RequestHeaderV2Authorization       = "Authorization"
	RequestHeaderV2AuthorizationScheme = "AWS"
	RequestHeaderV2XAmzDate            = "X-Amz-Date"
)
View Source
const (
	SignatureExpires    = time.Hour * 24 * 7     // Signature is valid for seven days after the specified date.
	MaxPresignedExpires = 3 * 365 * 24 * 60 * 60 //10years
	DateFormatISO8601   = "20060102T150405Z"     //"yyyyMMddTHHmmssZ"
	MaxSkewTime         = 15 * time.Minute

	XAmzContentSha256 = "X-Amz-Content-Sha256"
	XAmzCredential    = "X-Amz-Credential"
	XAmzSignature     = "X-Amz-Signature" //
	XAmzSignedHeaders = "X-Amz-SignedHeaders"
	XAmzAlgorithm     = "X-Amz-Algorithm"
	XAmzDate          = "X-Amz-Date"
	XAmzExpires       = "X-Amz-Expires"

	SignatureV4Algorithm = "AWS4-HMAC-SHA256"
	SignatureV4Request   = "aws4-request"
	SignedHeaderHost     = "host"
	UnsignedPayload      = "UNSIGNED-PAYLOAD"
	PresignedV4QueryAuth = "Authorization"
)
View Source
const (
	HeaderNameServer             = "Server"
	HeaderNameHost               = "Host"
	HeaderNameLastModified       = "Last-Modified"
	HeaderNameETag               = "ETag"
	HeaderNameDate               = "Date"
	HeaderNameContentMD5         = "Content-MD5"
	HeaderNameContentEnc         = "Content-Encoding"
	HeaderNameContentType        = "Content-Type"
	HeaderNameContentLength      = "Content-Length"
	HeaderNameContentRange       = "Content-Range"
	HeaderNameContentDisposition = "Content-Disposition"
	HeaderNameAuthorization      = "Authorization"
	HeaderNameAcceptRange        = "Accept-Ranges"
	HeaderNameRange              = "Range"
	HeaderNameExpect             = "Expect"
	HeaderNameXForwardedExpect   = "X-Forwarded-Expect"
	HeaderNameLocation           = "Location"
	HeaderNameCacheControl       = "Cache-Control"
	HeaderNameExpires            = "Expires"

	// Headers for CORS validation
	Origin                                = "Origin"
	HeaderNameAccessControlRequestMethod  = "Access-Control-Request-Method"
	HeaderNameAccessControlRequestHeaders = "Access-Control-Request-Headers"
	HeaderNameAccessControlAllowOrigin    = "Access-Control-Allow-Origin"
	HeaderNameAccessControlMaxAge         = "Access-Control-Max-Age"
	HeaderNameAccessControlAllowMethods   = "Access-Control-Allow-Methods"
	HeaderNameAccessControlAllowHeaders   = "Access-Control-Allow-Headers"
	HeaderNamrAccessControlExposeHeaders  = "Access-Control-Expose-Headers"

	HeaderNameXAmzStartDate           = "x-amz-date"
	HeaderNameXAmzRequestId           = "x-amz-request-id"
	HeaderNameXAmzContentHash         = "x-amz-content-sha256"
	HeaderNameXAmzCopySource          = "x-amz-copy-source"
	HeaderNameXAmzCopyMatch           = "x-amz-copy-source-if-match"
	HeaderNameXAmzCopyNoneMatch       = "x-amz-copy-source-if-none-match"
	HeaderNameXAmzCopyModified        = "x-amz-copy-source-if-modified-since"
	HeaderNameXAmzCopyUnModified      = "x-amz-copy-source-if-unmodified-since"
	HeaderNameXAmzDecodeContentLength = "x-amz-decoded-content-length"
	HeaderNameXAmzTagging             = "x-amz-tagging"
	HeaderNameXAmzMetaPrefix          = "x-amz-meta-"
	HeaderNameXAmzDownloadPartCount   = "x-amz-mp-parts-count"
	HeaderNameXAmzMetadataDirective   = "x-amz-metadata-directive"
	HeaderNameXAmzBucketRegion        = "x-amz-bucket-region"
	HeaderNameXAmzTaggingCount        = "x-amz-tagging-count"

	HeaderNameIfMatch           = "If-Match"
	HeaderNameIfNoneMatch       = "If-None-Match"
	HeaderNameIfModifiedSince   = "If-Modified-Since"
	HeaderNameIfUnmodifiedSince = "If-Unmodified-Since"
)
View Source
const (
	HeaderValueServer               = "ChubaoFS"
	HeaderValueAcceptRange          = "bytes"
	HeaderValueTypeStream           = "application/octet-stream"
	HeaderValueContentTypeXML       = "application/xml"
	HeaderValueContentTypeDirectory = "application/directory"
)
View Source
const (
	SubObjectDelete    = "delete"
	SubMultipartUpload = "uploads"
)
View Source
const (
	ParamUploadId   = "uploadId"
	ParamPartNumber = "partNumber"
	ParamKeyMarker  = "key-marker"
	ParamMarker     = "marker"
	ParamPrefix     = "prefix"
	ParamContToken  = "continuation-token"
	ParamFetchOwner = "fetch-owner"
	ParamMaxKeys    = "max-keys"
	ParamStartAfter = "start-after"
	ParamKey        = "key"

	ParamMaxParts       = "max-parts"
	ParamUploadIdMarker = "upload-id-marker"
	ParamPartNoMarker   = "part-number-marker"
	ParamPartMaxUploads = "max-uploads"
	ParamPartDelimiter  = "delimiter"
	ParamEncodingType   = "encoding-type"

	ParamResponseCacheControl       = "response-cache-control"
	ParamResponseContentType        = "response-content-type"
	ParamResponseContentDisposition = "response-content-disposition"
	ParamResponseExpires            = "response-expires"
)
View Source
const (
	MaxKeys    = 1000
	MaxParts   = 1000
	MaxUploads = 1000
)
View Source
const (
	XAttrKeyOSSETag         = "oss:etag"
	XAttrKeyOSSTagging      = "oss:tagging"
	XAttrKeyOSSPolicy       = "oss:policy"
	XAttrKeyOSSACL          = "oss:acl"
	XAttrKeyOSSMIME         = "oss:mime"
	XAttrKeyOSSDISPOSITION  = "oss:disposition"
	XAttrKeyOSSCORS         = "oss:cors"
	XAttrKeyOSSCacheControl = "oss:cache"
	XAttrKeyOSSExpires      = "oss:expires"

	// Deprecated
	XAttrKeyOSSETagDeprecated = "oss:tag"
)

XAttr keys for ObjectNode compatible feature

View Source
const (
	AMZTimeFormat = "2006-01-02T15:04:05.000Z"
	RFC1123Format = "Mon, 02 Jan 2006 15:04:05 GMT"
	RFC850Format  = "Monday, 02-Jan-06 15:04:05 GMT"
	ANSICFormat   = "Mon Jan  2 15:04:05 2006"
)
View Source
const (
	DefaultFileMode = 0644
	DefaultDirMode  = DefaultFileMode | os.ModeDir
)
View Source
const (
	SplitFileRangeBlockSize     = 10 * 1024 * 1024 // 10MB
	ParallelDownloadPartSize    = 10 * 1024 * 1024
	MinParallelDownloadFileSize = 2 * ParallelDownloadPartSize
)
View Source
const (
	MetadataDirectiveCopy    = "COPY"
	MetadataDirectiveReplace = "REPLACE"
)
View Source
const (
	TaggingCounts         = 10
	TaggingKeyMaxLength   = 128
	TaggingValueMaxLength = 256
)
View Source
const (
	PolicyDefaultVersion  = "2012-10-17"
	BucketPolicyLimitSize = 20 * 1024 //Bucket policies are limited to 20KB
	ArnSplitToken         = ":"
)

https://docs.aws.amazon.com/AmazonS3/latest/dev/example-bucket-policies.html

View Source
const (
	IpAddress                ConditionType = "IpAddress"
	NotIpAddress                           = "NotIpAddress"
	StringLike                             = "StringLike"
	StringNotLike                          = "StringNotLike"
	StringEquals                           = "StringEquals"
	StringNotEquals                        = "StringNotEquals"
	Bool                                   = "Bool"
	DateEquals                             = "DateEquals"
	DateNotEquals                          = "DateNotEquals"
	DateLessThan                           = "DateLessThan"
	DateLessThanEquals                     = "DateLessThanEquals"
	DateGreaterThan                        = "DateGreaterThan"
	DateGreaterThanEquals                  = "DateGreaterThanEquals"
	NumericEquals                          = "NumericEquals"
	NumericNotEquals                       = "NumericNotEquals"
	NumericLessThan                        = "NumericLessThan"
	NumericLessThanEquals                  = "NumericLessThanEquals"
	NumericGreaterThan                     = "NumericGreaterThan"
	NumericGreaterThanEquals               = "NumericGreaterThanEquals"
	ArnEquals                              = "ArnEquals"
	ArnLike                                = "ArnLike" //
	ArnNotEquals                           = "ArnNotEquals"
	ArnNotLike                             = "ArnNotLike" //
)

https://docs.aws.amazon.com/zh_cn/IAM/latest/UserGuide/reference_policies_elements_condition_operators.html

View Source
const (
	AwsCurrentTime            ConditionKey = "aws:CurrentTime"
	AwsEpochTime                           = "aws:EpochTime"
	AwsMultiFactorAuthPresent              = "aws:MultiFactorAuthPresent"
	AwsPrincipalAccount                    = "aws:PrincipalAccount"
	AwsPrincipalArn                        = "aws:PrincipalArn"
	AwsPrincipalOrgID                      = "aws:PrincipalOrgID"
	AwsPrincipalTag                        = "aws:PrincipalTag"
	AwsPrincipalType                       = "aws:PrincipalType"
	AwsReferer                             = "aws:Referer"
	AwsRequestRegion                       = "aws:RequestRegion"
	AwsRequestTagKey                       = "aws:RequestTag/tag-key"
	AwsResourceTagKey                      = "aws:ResourceTag/tag-key"
	AwsSecureTransport                     = "aws:SecureTransport"
	AwsSourceAccout                        = "aws:AwsSourceAccout"
	AwsSourceArn                           = "aws:SourceArn"
	AwsSourceIp                            = "aws:SourceIp"
	AwsSourceVpc                           = "aws:SourceVpc"
	AwsSourceVpce                          = "aws:SourceVpce"
	AwsTagKeys                             = "aws:TagKeys"
	AwsTokenIssueTime                      = "aws:TokenIssueTime"
	AwsUserAgent                           = "aws:UserAgent"
	AwsUserId                              = "aws:userid"
	AwsUserName                            = "aws:username"
	AwsVpcSourceIp                         = "aws:VpcSourceIp"
)

https://docs.aws.amazon.com/zh_cn/IAM/latest/UserGuide/reference_policies_condition-keys.html

View Source
const (
	EmptyContentMD5String = "d41d8cd98f00b204e9800998ecf8427e"
)
View Source
const (
	LogDeliveryRole = "LogDelivery"
)
View Source
const (
	META_OSS_VOLUME = ".oss_meta"
)
View Source
const (
	MaxCopyObjectSize = 5 * 1024 * 1024 * 1024
)
View Source
const (
	MaxRetry = 3
)
View Source
const (
	OSSMetaUpdateDuration = time.Duration(time.Second * 30)
)
View Source
const (
	StorageClassStandard = "Standard"
)

Variables

View Source
var (
	UnsupportedOperation                = &ErrorCode{ErrorCode: "UnsupportedOperation", ErrorMessage: "Operation is not supported", StatusCode: http.StatusBadRequest}
	AccessDenied                        = &ErrorCode{ErrorCode: "AccessDenied", ErrorMessage: "Access Denied", StatusCode: http.StatusForbidden}
	BadDigest                           = &ErrorCode{ErrorCode: "BadDigest", ErrorMessage: "The Content-MD5 you specified did not match what we received.", StatusCode: http.StatusBadRequest}
	BucketNotExisted                    = &ErrorCode{ErrorCode: "BucketNotExisted", ErrorMessage: "The requested bucket name is not existed.", StatusCode: http.StatusNotFound}
	BucketNotExistedForHead             = &ErrorCode{ErrorCode: "BucketNotExisted", ErrorMessage: "The requested bucket name is not existed.", StatusCode: http.StatusConflict}
	BucketNotEmpty                      = &ErrorCode{ErrorCode: "BucketNotEmpty", ErrorMessage: "The bucket you tried to delete is not empty.", StatusCode: http.StatusConflict}
	BucketNotOwnedByYou                 = &ErrorCode{ErrorCode: "BucketNotOwnedByYou", ErrorMessage: "The bucket is not owned by you.", StatusCode: http.StatusConflict}
	KeyTooLongError                     = &ErrorCode{ErrorCode: "KeyTooLongError", ErrorMessage: "", StatusCode: http.StatusBadRequest}
	InvalidKey                          = &ErrorCode{ErrorCode: "InvalidKey", ErrorMessage: "Object key is Illegal", StatusCode: http.StatusBadRequest}
	EntityTooSmall                      = &ErrorCode{ErrorCode: "EntityTooSmall", ErrorMessage: "Your proposed upload is smaller than the minimum allowed object size.", StatusCode: http.StatusBadRequest}
	EntityTooLarge                      = &ErrorCode{ErrorCode: "EntityTooLarge", ErrorMessage: "Your proposed upload exceeds the maximum allowed object size.", StatusCode: http.StatusBadRequest}
	IncorrectNumberOfFilesInPostRequest = &ErrorCode{ErrorCode: "IncorrectNumberOfFilesInPostRequest", ErrorMessage: "POST requires exactly one file upload per request.", StatusCode: http.StatusBadRequest}
	InvalidArgument                     = &ErrorCode{ErrorCode: "InvalidArgument", ErrorMessage: "Invalid Argument", StatusCode: http.StatusBadRequest}
	InvalidBucketName                   = &ErrorCode{ErrorCode: "InvalidBucketName", ErrorMessage: "The specified bucket is not valid.", StatusCode: http.StatusBadRequest}
	InvalidRange                        = &ErrorCode{ErrorCode: "InvalidRange", ErrorMessage: "The requested range cannot be satisfied.", StatusCode: http.StatusRequestedRangeNotSatisfiable}
	MissingContentLength                = &ErrorCode{ErrorCode: "MissingContentLength", ErrorMessage: "You must provide the Content-Length HTTP header.", StatusCode: http.StatusLengthRequired}
	NoSuchBucket                        = &ErrorCode{ErrorCode: "NoSuchBucket", ErrorMessage: "The specified bucket does not exist.", StatusCode: http.StatusNotFound}
	NoSuchKey                           = &ErrorCode{ErrorCode: "NoSuchKey", ErrorMessage: "The specified key does not exist.", StatusCode: http.StatusNotFound}
	PreconditionFailed                  = &ErrorCode{ErrorCode: "PreconditionFailed", ErrorMessage: "At least one of the preconditions you specified did not hold.", StatusCode: http.StatusPreconditionFailed}
	MaxContentLength                    = &ErrorCode{ErrorCode: "MaxContentLength", ErrorMessage: "Content-Length is bigger than 20KB.", StatusCode: http.StatusLengthRequired}
	DuplicatedBucket                    = &ErrorCode{ErrorCode: "CreateBucketFailed", ErrorMessage: "Duplicate bucket name.", StatusCode: http.StatusBadRequest}
	ObjectModeConflict                  = &ErrorCode{ErrorCode: "ObjectModeConflict", ErrorMessage: "Object already exists but file mode conflicts", StatusCode: http.StatusConflict}
	NotModified                         = &ErrorCode{ErrorCode: "MaxContentLength", ErrorMessage: "Not modified.", StatusCode: http.StatusNotModified}
	NoSuchUpload                        = &ErrorCode{ErrorCode: "NoSuchUpload", ErrorMessage: "The specified upload does not exist.", StatusCode: http.StatusNotFound}
	OverMaxRecordSize                   = &ErrorCode{ErrorCode: "OverMaxRecordSize", ErrorMessage: "The length of a record in the input or result is greater than maxCharsPerRecord of 1 MB.", StatusCode: http.StatusBadRequest}
	CopySourceSizeTooLarge              = &ErrorCode{ErrorCode: "InvalidRequest", ErrorMessage: "The specified copy source is larger than the maximum allowable size for a copy source: 5368709120", StatusCode: http.StatusBadRequest}
	InvalidPartOrder                    = &ErrorCode{ErrorCode: "InvalidPartOrder", ErrorMessage: "The list of parts was not in ascending order. Parts list must be specified in order by part number.", StatusCode: http.StatusBadRequest}
	InvalidPart                         = &ErrorCode{ErrorCode: "InvalidPart", ErrorMessage: "One or more of the specified parts could not be found. The part might not have been uploaded, or the specified entity tag might not have matched the part's entity tag.", StatusCode: http.StatusBadRequest}
	InvalidCacheArgument                = &ErrorCode{ErrorCode: "InvalidCacheArgument", ErrorMessage: "Invalid Cache-Control or Expires Argument", StatusCode: http.StatusBadRequest}
	TagsGreaterThen10                   = &ErrorCode{ErrorCode: "BadRequest", ErrorMessage: "Object tags cannot be greater than 10", StatusCode: http.StatusBadRequest}
	InvalidTagKey                       = &ErrorCode{ErrorCode: "InvalidTag", ErrorMessage: "The TagKey you have provided is invalid", StatusCode: http.StatusBadRequest}
	InvalidTagValue                     = &ErrorCode{ErrorCode: "InvalidTag", ErrorMessage: "The TagValue you have provided is invalid", StatusCode: http.StatusBadRequest}
)

Presets

View Source
var ALGORITHM = "HMAC-SHA256"
View Source
var AuthSignatureV4Headers = []string{
	PresignedV4QueryAuth,
	XAmzContentSha256,
}
View Source
var PresignedSignatureV2Queries = []string{
	"AWSAccessKeyId",
	"Signature",
}
View Source
var PresignedSignatureV4Queries = []string{
	XAmzCredential,
	XAmzSignature,
}
View Source
var SCHEME = "AWS4"
View Source
var SERVICE = "s3"
View Source
var SignatureV2WhiteQueries = map[string]struct{}{
	"acl":                          {},
	"delete":                       {},
	"lifecycle":                    {},
	"location":                     {},
	"logging":                      {},
	"notification":                 {},
	"partNumber":                   {},
	"policy":                       {},
	"requestPayment":               {},
	"response-cache-control":       {},
	"response-content-disposition": {},
	"response-content-encoding":    {},
	"response-content-language":    {},
	"response-content-type":        {},
	"response-expires":             {},
	"torrent":                      {},
	"uploadId":                     {},
	"uploads":                      {},
	"versionId":                    {},
	"versioning":                   {},
	"versions":                     {},
}
View Source
var TERMINATOR = "aws4_request"

Functions

func ActionFromRouteName

func ActionFromRouteName(name string) proto.Action

func ArnEqualsFunc

func ArnEqualsFunc(p *RequestParam, value ConditionValues) bool

func ArnLikeFunc

func ArnLikeFunc(p *RequestParam, value ConditionValues) bool

func ArnNotEqualsFunc

func ArnNotEqualsFunc(p *RequestParam, value ConditionValues) bool

func ArnNotLikeFunc

func ArnNotLikeFunc(p *RequestParam, value ConditionValues) bool

func BoolFunc

func BoolFunc(p *RequestParam, policyCondtion ConditionValues) bool

func DateEqualsFunc

func DateEqualsFunc(p *RequestParam, policyVals ConditionValues) bool

func DateGreaterThanEqualsFunc

func DateGreaterThanEqualsFunc(p *RequestParam, value ConditionValues) bool

func DateGreaterThanFunc

func DateGreaterThanFunc(p *RequestParam, value ConditionValues) bool

func DateLessThanEqualsFunc

func DateLessThanEqualsFunc(p *RequestParam, value ConditionValues) bool

func DateLessThanFunc

func DateLessThanFunc(p *RequestParam, value ConditionValues) bool

func DateNotEqualsFunc

func DateNotEqualsFunc(p *RequestParam, value ConditionValues) bool

func GetActionFromContext

func GetActionFromContext(r *http.Request) (action proto.Action)

func GetRequestID

func GetRequestID(r *http.Request) (id string)

func GetStatusCodeFromContext

func GetStatusCodeFromContext(r *http.Request) int

func IpAddressFunc

func IpAddressFunc(p *RequestParam, value ConditionValues) bool

func IsIntersectionActions

func IsIntersectionActions(actions proto.Actions, action proto.Action) bool

func IsMonitoredStatusCode

func IsMonitoredStatusCode(code int) bool

func MarshalXMLEntity

func MarshalXMLEntity(entity interface{}) ([]byte, error)

func NewClosableChunkedReader

func NewClosableChunkedReader(source io.ReadCloser) io.ReadCloser

NewClosableChunkedReader returns an instance of the io.ReadCloser interface used to parse chunk data.

func NotIpAddressFunc

func NotIpAddressFunc(p *RequestParam, values ConditionValues) bool

func NumericEqualsFunc

func NumericEqualsFunc(p *RequestParam, value ConditionValues) bool

func NumericGreaterThanEqualsFunc

func NumericGreaterThanEqualsFunc(p *RequestParam, value ConditionValues) bool

func NumericGreaterThanFunc

func NumericGreaterThanFunc(p *RequestParam, value ConditionValues) bool

func NumericLessThanEqualsFunc

func NumericLessThanEqualsFunc(p *RequestParam, value ConditionValues) bool

func NumericLessThanFunc

func NumericLessThanFunc(p *RequestParam, value ConditionValues) bool

func NumericNotEqualsFunc

func NumericNotEqualsFunc(p *RequestParam, value ConditionValues) bool

func ParseUserDefinedMetadata

func ParseUserDefinedMetadata(header http.Header) map[string]string

Checking and parsing user-defined metadata from request header. The optional user-defined metadata names must begin with "x-amz-meta-" to distinguish them from other HTTP headers. Notes: The PUT request header is limited to 8 KB in size. Within the PUT request header, the user-defined metadata is limited to 2 KB in size. The size of user-defined metadata is measured by taking the sum of the number of bytes in the UTF-8 encoding of each key and value. Reference: https://docs.aws.amazon.com/AmazonS3/latest/dev/UsingMetadata.html

func ReleaseUserInfoStore

func ReleaseUserInfoStore(store UserInfoStore)

func ServeInternalStaticErrorResponse

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

func SetRequestAction

func SetRequestAction(r *http.Request, action proto.Action)

func SetRequestID

func SetRequestID(r *http.Request, requestID string)

func SetResponseErrorMessage

func SetResponseErrorMessage(r *http.Request, message string)

func SetResponseStatusCode

func SetResponseStatusCode(r *http.Request, code ErrorCode)

func SplitFileRange

func SplitFileRange(size, blockSize int64) (ranges [][2]int64)

func StringEqualsFunc

func StringEqualsFunc(reqParam *RequestParam, storeCondVals ConditionValues) bool

func StringLikeFunc

func StringLikeFunc(reqParam *RequestParam, storeCondVals ConditionValues) bool

func StringNotEqualsFunc

func StringNotEqualsFunc(p *RequestParam, values ConditionValues) bool

func StringNotLikeFunc

func StringNotLikeFunc(p *RequestParam, values ConditionValues) bool

func TrimAwsPrefixKey

func TrimAwsPrefixKey(key string) string

func UnmarshalXMLEntity

func UnmarshalXMLEntity(bytes []byte, data interface{}) error

func ValidateCacheControl

func ValidateCacheControl(cacheControl string) bool

func ValidateCacheExpires

func ValidateCacheExpires(expires string) bool

Types

type AccessControlList

type AccessControlList struct {
	Grants []Grant `xml:"Grant,omitempty"`
}

access control list

func (*AccessControlList) IsEmpty

func (acl *AccessControlList) IsEmpty() bool

type AccessControlPolicy

type AccessControlPolicy struct {
	Xmlns string            `xml:"xmlns,attr"`
	Owner Owner             `xml:"Owner,omitempty"`
	Acl   AccessControlList `xml:"AccessControlList,omitempty"`
}

access control policy

func ParseACL

func ParseACL(bytes []byte, bucket string) (*AccessControlPolicy, error)

func (*AccessControlPolicy) IsAclEmpty

func (acp *AccessControlPolicy) IsAclEmpty() bool

func (*AccessControlPolicy) IsAllowed

func (acp *AccessControlPolicy) IsAllowed(param *RequestParam, isOwner bool) bool

func (*AccessControlPolicy) Marshal

func (acp *AccessControlPolicy) Marshal() ([]byte, error)

func (*AccessControlPolicy) SetBucketGrantACL

func (acp *AccessControlPolicy) SetBucketGrantACL(param *RequestParam, permission Permission)

func (*AccessControlPolicy) Validate

func (acp *AccessControlPolicy) Validate(bucket string) (bool, error)

type AclRole

type AclRole = string

type ActionType

type ActionType string

type Arn

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

arn:partition:service:region:account-id:resource-id arn:partition:service:region:account-id:resource-type/resource-id arn:partition:service:region:account-id:resource-type:resource-id

type AsyncTaskErrorFunc

type AsyncTaskErrorFunc func(err error)

AsyncTaskErrorFunc is a callback method definition for asynchronous tasks when an error occurs. It is mainly used to notify other objects when an error occurs during asynchronous task execution. These asynchronous tasks include periodic volume topology and metadata update tasks.

func (AsyncTaskErrorFunc) OnError

func (f AsyncTaskErrorFunc) OnError(err error)

OnError protects the call of AsyncTaskErrorFunc with null pointer access. Used to simplify caller code.

type AuthType

type AuthType string

type BucketOwner

type BucketOwner struct {
	XMLName     xml.Name `xml:"Owner"`
	ID          string   `xml:"ID"`
	DisplayName string   `xml:"DisplayName"`
}

func NewBucketOwner

func NewBucketOwner(volume *Volume) *BucketOwner

type CORSConfiguration

type CORSConfiguration struct {
	XMLName  xml.Name    `xml:"CORSConfiguration" json:"xml_name"`
	CORSRule []*CORSRule `xml:"CORSRule" json:"cors_rule"`
}

type CORSRule

type CORSRule struct {
	AllowedHeader []string `xml:"AllowedHeader" json:"allowed_header"`
	AllowedMethod []string `xml:"AllowedMethod" json:"allowed_method"`
	AllowedOrigin []string `xml:"AllowedOrigin" json:"allowed_origin"`
	ExposeHeader  []string `xml:"ExposeHeader" json:"expose_header"`
	MaxAgeSeconds uint16   `xml:"MaxAgeSeconds" json:"max_age_seconds"`
}

type CacheUserInfoLoader

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

func NewUserInfoLoader

func NewUserInfoLoader(mc *master.MasterClient) *CacheUserInfoLoader

func (*CacheUserInfoLoader) Close

func (us *CacheUserInfoLoader) Close()

func (*CacheUserInfoLoader) LoadUser

func (us *CacheUserInfoLoader) LoadUser(accessKey string) (*proto.UserInfo, error)

type CacheUserInfoStore

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

func (*CacheUserInfoStore) Close

func (s *CacheUserInfoStore) Close()

func (*CacheUserInfoStore) LoadUser

func (s *CacheUserInfoStore) LoadUser(accessKey string) (*proto.UserInfo, error)

type CheckFuncs

type CheckFuncs func(p *RequestParam) bool

type CommonPrefix

type CommonPrefix struct {
	XMLName xml.Name `xml:"CommonPrefixes"`
	Prefix  string
}

type CompleteMultipartResult

type CompleteMultipartResult struct {
	XMLName  xml.Name `xml:"CompleteMultipartUploadResult"`
	Location string   `xml:"Location"`
	Bucket   string   `xml:"Bucket"`
	Key      string   `xml:"Key"`
	ETag     string   `xml:"ETag"`
}

type CompleteMultipartUploadRequest

type CompleteMultipartUploadRequest struct {
	XMLName xml.Name       `xml:"CompleteMultipartUpload"`
	Parts   []*PartRequest `xml:"Part"`
}

type Condition

type Condition map[ConditionType]ConditionValues

type ConditionFunc

type ConditionFunc func(p *RequestParam, values ConditionValues) bool

type ConditionKey

type ConditionKey string

type ConditionType

type ConditionType string

type ConditionTypeSet

type ConditionTypeSet map[ConditionType]null

type Content

type Content struct {
	Key          string       `xml:"Key"`
	LastModified string       `xml:"LastModified"`
	ETag         string       `xml:"ETag"`
	Size         int          `xml:"Size"`
	StorageClass string       `xml:"StorageClass"`
	Owner        *BucketOwner `xml:"Owner,omitempty"`
}

type CopyObjectResult

type CopyObjectResult struct {
	XMLName      xml.Name `xml:"CopyObjectResult"`
	ETag         string   `xml:"ETag"`
	LastModified string   `xml:"LastModified"`
}

type CopyResult

type CopyResult struct {
	XMLName      xml.Name `xml:"CopyObjectResult"`
	LastModified string   `xml:"LastModified,omitempty"`
	ETag         string   `xml:"ETag,omitempty"`
}

type DeleteRequest

type DeleteRequest struct {
	XMLName xml.Name `xml:"Delete"`
	Objects []Object `xml:"Object"`
}

type DeleteResult

type DeleteResult struct {
	XMLName xml.Name  `json:"DeleteResult"`
	Deleted []Deleted `xml:"Deleted,omitempty"`
	Error   []Error   `xml:"Error,omitempty"`
}

type Deleted

type Deleted struct {
	XMLName               xml.Name `xml:"Deleted"`
	Key                   string   `xml:"Key"`
	VersionId             string   `xml:"VersionId,omitempty"`
	DeleteMarker          string   `xml:"DeleteMarker,omitempty"`
	DeleteMarkerVersionId string   `xml:"DeleteMarkerVersionId,omitempty"`
}

type ETagValue

type ETagValue struct {
	Value   string
	PartNum int
	TS      time.Time
}

func DirectoryETagValue

func DirectoryETagValue() ETagValue

func EmptyContentETagValue

func EmptyContentETagValue(ts time.Time) ETagValue

func NewRandomBytesETagValue

func NewRandomBytesETagValue(partNum int, ts time.Time) ETagValue

func NewRandomUUIDETagValue

func NewRandomUUIDETagValue(partNum int, ts time.Time) ETagValue

func ParseETagValue

func ParseETagValue(raw string) ETagValue

func (ETagValue) ETag

func (e ETagValue) ETag() string

func (ETagValue) Encode

func (e ETagValue) Encode() string

func (ETagValue) String

func (e ETagValue) String() string

func (ETagValue) TSUnix

func (e ETagValue) TSUnix() int64

func (ETagValue) Valid

func (e ETagValue) Valid() bool

type Effect

type Effect string
const (
	Allow Effect = "Allow"
	Deny         = "Deny"
)

type Error

type Error struct {
	XMLName   xml.Name `xml:"Error"`
	Key       string   `xml:"Key"`
	VersionId string   `xml:"VersionId,omitempty"`
	Code      string   `xml:"Code,omitempty"`
	Message   string   `xml:"Message,omitempty"`
}

type ErrorCode

type ErrorCode struct {
	ErrorCode    string
	ErrorMessage string
	StatusCode   int
}

func HttpStatusErrorCode

func HttpStatusErrorCode(code int) *ErrorCode

func InternalErrorCode

func InternalErrorCode(err error) *ErrorCode

func (ErrorCode) ServeResponse

func (code ErrorCode) ServeResponse(w http.ResponseWriter, r *http.Request) error

type FSFileInfo

type FSFileInfo struct {
	Path         string
	Size         int64
	Mode         os.FileMode
	ModifyTime   time.Time
	CreateTime   time.Time
	ETag         string
	Inode        uint64
	MIMEType     string
	Disposition  string
	CacheControl string
	Expires      string
	Metadata     map[string]string `graphql:"-"` // User-defined metadata
}

type FSPart

type FSPart struct {
	PartNumber   int
	LastModified string
	ETag         string
	Size         int
}

type FSUpload

type FSUpload struct {
	Key          string
	UploadId     string
	StorageClass string
	Initiated    string
}

type GetXAttrOutput

type GetXAttrOutput struct {
	XMLName xml.Name `xml:"GetXAttrOutput"`
	XAttr   *XAttr   `xml:"XAttr"`
}

type Grant

type Grant struct {
	Grantee    Grantee    `xml:"Grantee,omitempty"`
	Permission Permission `xml:"Permission,omitempty"`
}

grant

func (*Grant) IsAllowed

func (g *Grant) IsAllowed(param *RequestParam) bool

func (Grant) Validate

func (g Grant) Validate() bool

type Grantee

type Grantee struct {
	Xmlxsi       string `xml:"xmlns:xsi,attr"`
	Xmlns        string `xml:"xsi,attr"`
	XsiType      string `xml:"xsi:type,attr"`
	Type         string `xml:"type,attr"`
	Id           string `xml:"ID,omitempty"`
	URI          string `xml:"URI,omitempty"`
	DisplayName  string `xml:"DisplayName,omitempty"`
	EmailAddress string `xml:"EmailAddress,omitempty"`
}

grantee

type InitMultipartResult

type InitMultipartResult struct {
	XMLName  xml.Name `xml:"InitiateMultipartUploadResult"`
	Bucket   string   `xml:"Bucket"`
	Key      string   `xml:"Key"`
	UploadId string   `xml:"UploadId"`
}

type ListBucketResult

type ListBucketResult struct {
	XMLName        xml.Name        `xml:"ListBucketResult"`
	Bucket         string          `xml:"Name"`
	Prefix         string          `xml:"Prefix"`
	Marker         string          `xml:"Marker"`
	MaxKeys        int             `xml:"MaxKeys"`
	Delimiter      string          `xml:"Delimiter"`
	IsTruncated    bool            `xml:"IsTruncated"`
	NextMarker     string          `xml:"NextMarker,omitempty"`
	Contents       []*Content      `xml:"Contents"`
	CommonPrefixes []*CommonPrefix `xml:"CommonPrefixes"`
}

type ListBucketResultV2

type ListBucketResultV2 struct {
	XMLName        xml.Name        `xml:"ListBucketResult"`
	Name           string          `xml:"Name"`
	Prefix         string          `xml:"Prefix,omitempty"`
	Token          string          `xml:"ContinuationToken,omitempty"`
	NextToken      string          `xml:"NextContinuationToken,omitempty"`
	KeyCount       uint64          `xml:"KeyCount"`
	MaxKeys        uint64          `xml:"MaxKeys"`
	Delimiter      string          `xml:"Delimiter,omitempty"`
	IsTruncated    bool            `xml:"IsTruncated,omitempty"`
	Contents       []*Content      `xml:"Contents"`
	CommonPrefixes []*CommonPrefix `xml:"CommonPrefixes"`
}

type ListFilesV1Option

type ListFilesV1Option struct {
	Prefix    string
	Delimiter string
	Marker    string
	MaxKeys   uint64
}

type ListFilesV1Result

type ListFilesV1Result struct {
	Files          []*FSFileInfo
	NextMarker     string
	Truncated      bool
	CommonPrefixes []string
}

type ListFilesV2Option

type ListFilesV2Option struct {
	Delimiter  string
	MaxKeys    uint64
	Prefix     string
	ContToken  string
	FetchOwner bool
	StartAfter string
}

type ListFilesV2Result

type ListFilesV2Result struct {
	Files          []*FSFileInfo
	KeyCount       uint64
	NextToken      string
	Truncated      bool
	CommonPrefixes []string
}

type ListPartsResult

type ListPartsResult struct {
	XMLName          xml.Name     `xml:"ListPartsResult"`
	Bucket           string       `xml:"Bucket"`
	Key              string       `xml:"Key"`
	UploadId         string       `xml:"UploadId"`
	Owner            *BucketOwner `xml:"Owner"`
	StorageClass     string       `xml:"StorageClass"`
	PartNumberMarker int          `xml:"PartNumberMarker"`
	NextMarker       int          `xml:"NextPartNumberMarker"`
	MaxParts         int          `xml:"MaxParts"`
	IsTruncated      bool         `xml:"IsTruncated"`
	Parts            []*Part      `xml:"Parts"`
}

type ListUploadsResult

type ListUploadsResult struct {
	XMLName            xml.Name        `xml:"ListMultipartUploadsResult"`
	Bucket             string          `xml:"Bucket"`
	KeyMarker          string          `xml:"KeyMarker"`
	UploadIdMarker     string          `xml:"UploadIdMarker"`
	NextKeyMarker      string          `xml:"NextKeyMarker"`
	NextUploadIdMarker string          `xml:"NextUploadIdMarker"`
	Delimiter          string          `xml:"Delimiter"`
	Prefix             string          `xml:"Prefix"`
	MaxUploads         int             `xml:"MaxUploads"`
	IsTruncated        bool            `xml:"IsTruncated"`
	Uploads            []*Upload       `xml:"Uploads"`
	CommonPrefixes     []*CommonPrefix `xml:"CommonPrefixes"`
}

type ListXAttrsOutput

type ListXAttrsOutput struct {
	XMLName xml.Name `xml:"ListXAttrsResult"`
	Keys    []string `xml:"Keys"`
}

type MetaStore

type MetaStore interface {
}

type OSSMeta

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

OSSMeta is bucket policy and ACL metadata.

type Object

type Object struct {
	Key       string `xml:"Key"`
	VersionId string `xml:"VersionId,omitempty"`
}

type ObjectNode

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

func NewServer

func NewServer() *ObjectNode

func (*ObjectNode) Shutdown

func (o *ObjectNode) Shutdown()

func (*ObjectNode) Start

func (o *ObjectNode) Start(cfg *config.Config) (err error)

func (*ObjectNode) Sync

func (o *ObjectNode) Sync()

type Owner

type Owner struct {
	Id          string `xml:"ID"`
	DisplayName string `xml:"DisplayName"`
}

owner

type Part

type Part struct {
	XMLName      xml.Name `xml:"Part"`
	PartNumber   int      `xml:"PartNumber"`
	LastModified string   `xml:"LastModified"`
	ETag         string   `xml:"ETag"`
	Size         int      `xml:"Size"`
}

func NewParts

func NewParts(fsParts []*FSPart) []*Part

type PartRequest

type PartRequest struct {
	XMLName    xml.Name `xml:"Part"`
	PartNumber int      `xml:"PartNumber"`
	ETag       string   `xml:"ETag"`
}

type PathItem

type PathItem struct {
	Name        string
	IsDirectory bool
}

PathItem defines path node attribute information, including node name and whether it is a directory.

type PathIterator

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

PathIterator is a path iterator. Used to sequentially iterate each path node from a complete path.

func NewPathIterator

func NewPathIterator(path string) PathIterator

func (*PathIterator) HasNext

func (p *PathIterator) HasNext() bool

func (*PathIterator) Next

func (p *PathIterator) Next() PathItem

func (*PathIterator) Reset

func (p *PathIterator) Reset()

func (PathIterator) ToSlice

func (p PathIterator) ToSlice() []PathItem

type Permission

type Permission string

grant permission

type Policy

type Policy struct {
	Version    string      `json:"Version"`
	Id         string      `json:"Id,omitempty"`
	Statements []Statement `json:"Statement,omitempty"`
}

func ParsePolicy

func ParsePolicy(r io.Reader, bucket string) (*Policy, error)

func (*Policy) IsAllowed

func (p *Policy) IsAllowed(params *RequestParam, isOwner bool) bool

check policy is allowed for request https://docs.aws.amazon.com/zh_cn/IAM/latest/UserGuide/reference_policies_evaluation-logic.html

func (*Policy) IsEmpty

func (p *Policy) IsEmpty() bool

func (Policy) Validate

func (p Policy) Validate(bucket string) (bool, error)

type PrefixMap

type PrefixMap map[string]struct{}

func (PrefixMap) AddPrefix

func (m PrefixMap) AddPrefix(prefix string)

func (PrefixMap) Prefixes

func (m PrefixMap) Prefixes() Prefixes

type Prefixes

type Prefixes []string

type Principal

type Principal map[string]StringSet

type PutFileOption

type PutFileOption struct {
	MIMEType     string
	Disposition  string
	Tagging      *Tagging
	Metadata     map[string]string
	CacheControl string
	Expires      string
}

type PutXAttrRequest

type PutXAttrRequest struct {
	XMLName xml.Name `xml:"PutXAttrRequest"`
	XAttr   *XAttr   `xml:"XAttr"`
}

type RequestAuthInfo

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

type RequestParam

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

func ParseRequestParam

func ParseRequestParam(r *http.Request) *RequestParam

func (*RequestParam) AccessKey

func (p *RequestParam) AccessKey() string

func (*RequestParam) Action

func (p *RequestParam) Action() proto.Action

func (*RequestParam) Bucket

func (p *RequestParam) Bucket() string

func (*RequestParam) GetConditionVar

func (p *RequestParam) GetConditionVar(name string) []string

func (*RequestParam) GetVar

func (p *RequestParam) GetVar(name string) string

func (*RequestParam) Object

func (p *RequestParam) Object() string

type Resource

type Resource string

type ResourceType

type ResourceType string

type StandardACL

type StandardACL string

type Statement

type Statement struct {
	Sid          string    `json:"Sid,omitempty"`
	Effect       Effect    `json:"Effect"`
	Principal    Principal `json:"Principal"`
	Actions      StringSet `json:"Action,omitempty"`
	NotActions   StringSet `json:"NotAction,omitempty"`
	Resources    StringSet `json:"Resource,omitempty"`
	NotResources StringSet `json:"NotResource,omitempty"`
	Condition    Condition `json:"Condition,omitempty"`
}

func (Statement) IsAllowed

func (s Statement) IsAllowed(p *RequestParam) bool

func (*Statement) Validate

func (s *Statement) Validate(bucket string) (bool, error)

type Store

type Store interface {
	Init(vm *VolumeManager)
	Put(ns, obj, key string, data []byte) error
	Get(ns, obj, key string) (data []byte, err error)
	List(ns, obj string) (data [][]byte, err error)
	Delete(ns, obj, key string) error
}

MetaStore

type StrictUserInfoStore

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

func (*StrictUserInfoStore) LoadUser

func (s *StrictUserInfoStore) LoadUser(accessKey string) (*proto.UserInfo, error)

type StringSet

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

func (*StringSet) Contains

func (ss *StringSet) Contains(val string) bool

func (*StringSet) ContainsRegex

func (ss *StringSet) ContainsRegex(val string) bool

func (*StringSet) ContainsWild

func (ss *StringSet) ContainsWild(val string) bool

func (*StringSet) ContainsWithAny

func (ss *StringSet) ContainsWithAny(val string) bool

func (*StringSet) Empty

func (ss *StringSet) Empty() bool

func (*StringSet) Intersection

func (ss *StringSet) Intersection(set *StringSet) bool

func (StringSet) MarshalJSON

func (ss StringSet) MarshalJSON() ([]byte, error)

func (StringSet) String

func (ss StringSet) String() string

func (*StringSet) UnmarshalJSON

func (ss *StringSet) UnmarshalJSON(b []byte) error

type Tag

type Tag struct {
	Key   string `xml:"Key" json:"k"`
	Value string `xml:"Value" json:"v"`
}

type Tagging

type Tagging struct {
	XMLName xml.Name `json:"-"`
	TagSet  []Tag    `xml:"TagSet>Tag,omitempty" json:"ts"`
}

func NewTagging

func NewTagging() *Tagging

func ParseTagging

func ParseTagging(src string) (*Tagging, error)

func (Tagging) Encode

func (t Tagging) Encode() string

func (Tagging) Validate

func (t Tagging) Validate() (bool, *ErrorCode)

type Upload

type Upload struct {
	XMLName      xml.Name     `xml:"Upload"`
	Key          string       `xml:"Key"`
	UploadId     string       `xml:"UploadId"`
	StorageClass string       `xml:"StorageClass"`
	Initiated    string       `xml:"Initiated"`
	Owner        *BucketOwner `xml:"Owner"`
}

func NewUploads

func NewUploads(fsUploads []*FSUpload, accessKey string) []*Upload

type UserInfoStore

type UserInfoStore interface {
	LoadUser(accessKey string) (*proto.UserInfo, error)
}

func NewUserInfoStore

func NewUserInfoStore(masters []string, strict bool) UserInfoStore

type Volume

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

Volume is a high-level encapsulation of meta sdk and data sdk methods. A high-level approach that exposes the semantics of object storage to the outside world. Volume escapes high-level object storage semantics to low-level POSIX semantics.

func NewVolume

func NewVolume(config *VolumeConfig) (*Volume, error)

func (*Volume) AbortMultipart

func (v *Volume) AbortMultipart(path string, multipartID string) (err error)

func (*Volume) Close

func (v *Volume) Close() error

func (*Volume) CompleteMultipart

func (v *Volume) CompleteMultipart(path, multipartID string, multipartInfo *proto.MultipartInfo) (fsFileInfo *FSFileInfo, err error)

func (*Volume) CopyFile

func (v *Volume) CopyFile(sv *Volume, sourcePath, targetPath, metaDirective string, opt *PutFileOption) (info *FSFileInfo, err error)

func (*Volume) CreateTime

func (v *Volume) CreateTime() time.Time

func (*Volume) DeletePath

func (v *Volume) DeletePath(path string) (err error)

DeletePath deletes the specified path. If the target is a non-empty directory, it will return success without any operation. If the target does not exist, it returns success.

Notes: This method will only returns internal system errors. This method will not return syscall.ENOENT error

func (*Volume) DeleteXAttr

func (v *Volume) DeleteXAttr(path string, key string) (err error)

func (*Volume) GetXAttr

func (v *Volume) GetXAttr(path string, key string) (info *proto.XAttrInfo, err error)

func (*Volume) InitMultipart

func (v *Volume) InitMultipart(path string, opt *PutFileOption) (multipartID string, err error)

func (*Volume) ListFilesV1

func (v *Volume) ListFilesV1(opt *ListFilesV1Option) (result *ListFilesV1Result, err error)

ListFilesV1 returns file and directory entry list information that meets the parameters. It supports parameters such as prefix, delimiter, and paging. It is a data plane logical encapsulation of the object storage interface ListObjectsV1.

func (*Volume) ListFilesV2

func (v *Volume) ListFilesV2(opt *ListFilesV2Option) (result *ListFilesV2Result, err error)

ListFilesV2 returns file and directory entry list information that meets the parameters. It supports parameters such as prefix, delimiter, and paging. It is a data plane logical encapsulation of the object storage interface ListObjectsV2.

func (*Volume) ListMultipartUploads

func (v *Volume) ListMultipartUploads(prefix, delimiter, keyMarker string, multipartIdMarker string,
	maxUploads uint64) ([]*FSUpload, string, string, bool, []string, error)

func (*Volume) ListParts

func (v *Volume) ListParts(path, uploadId string, maxParts, partNumberMarker uint64) (parts []*FSPart, nextMarker uint64, isTruncated bool, err error)

func (*Volume) ListXAttrs

func (v *Volume) ListXAttrs(path string) (keys []string, err error)

func (*Volume) Name

func (v *Volume) Name() string

func (*Volume) OSSSecure

func (v *Volume) OSSSecure() (accessKey, secretKey string)

func (*Volume) ObjectMeta

func (v *Volume) ObjectMeta(path string) (info *FSFileInfo, err error)

func (*Volume) Owner

func (v *Volume) Owner() string

func (*Volume) PutObject

func (v *Volume) PutObject(path string, reader io.Reader, opt *PutFileOption) (fsInfo *FSFileInfo, err error)

WriteObject creates or updates target path objects and data. Differentiate whether a target is a file or a directory by identifying its MIME type. When the MIME type is "application/directory", the target object is a directory. During processing, conflicts may occur because the actual type of the target object is different from the expected type.

For example, create a directory called "backup", but a file called "backup" already exists. When a conflict occurs, the method returns an syscall.EINVAL error.

An syscall.EINVAL error is returned indicating that a part of the target path expected to be a file but actual is a directory. An syscall.EINVAL error is returned indicating that a part of the target path expected to be a directory but actual is a file.

func (*Volume) ReadFile

func (v *Volume) ReadFile(path string, writer io.Writer, offset, size uint64) error

func (*Volume) SetXAttr

func (v *Volume) SetXAttr(path string, key string, data []byte, autoCreate bool) error

func (*Volume) WritePart

func (v *Volume) WritePart(path string, multipartId string, partId uint16, reader io.Reader) (*FSFileInfo, error)

type VolumeConfig

type VolumeConfig struct {
	// Name of volume.
	// This is a required configuration item.
	Volume string

	// Master addresses or host names.
	// This is a required configuration item.
	Masters []string

	// Storage fro ACP management
	Store Store

	// Callback method for notifying when an error occurs in an asynchronous task.
	// Such as Volume topology and metadata update tasks.
	// This is a optional configuration item.
	OnAsyncTaskError AsyncTaskErrorFunc

	// Get OSSMeta from the MetaNode every time if it is set true.
	MetaStrict bool
}

VolumeConfig is the configuration used to initialize the Volume instance.

type VolumeLoader

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

func NewVolumeLoader

func NewVolumeLoader(masters []string, store Store, strict bool) *VolumeLoader

func (*VolumeLoader) Close

func (loader *VolumeLoader) Close()

Release all

func (*VolumeLoader) Release

func (loader *VolumeLoader) Release(volName string)

func (*VolumeLoader) Volume

func (loader *VolumeLoader) Volume(volName string) (*Volume, error)

type VolumeManager

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

func NewVolumeManager

func NewVolumeManager(masters []string, strict bool) *VolumeManager

func (*VolumeManager) Close

func (m *VolumeManager) Close()

Release all

func (*VolumeManager) Release

func (m *VolumeManager) Release(volName string)

func (*VolumeManager) Volume

func (m *VolumeManager) Volume(volName string) (*Volume, error)

type Wildcard added in v1.5.1

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

func NewWildcard added in v1.5.1

func NewWildcard(domain string) (*Wildcard, error)

func (*Wildcard) Parse added in v1.5.1

func (w *Wildcard) Parse(host string) (bucket string, is bool)

type Wildcards added in v1.5.1

type Wildcards []*Wildcard

func NewWildcards added in v1.5.1

func NewWildcards(domains []string) (Wildcards, error)

func (Wildcards) Parse added in v1.5.1

func (ws Wildcards) Parse(host string) (bucket string, is bool)

type XAttr

type XAttr struct {
	Key   string `xml:"Key"`
	Value string `xml:"Value"`
}

Jump to

Keyboard shortcuts

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