Documentation
¶
Overview ¶
Copyright 2019 The OpenSDS Authors.
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.
Index ¶
- Constants
- Variables
- func GetMultipartUploadIdForTidb(uploadtime uint64) string
- type Bucket
- func (b *Bucket) Deserialize(fields map[string]string) (interface{}, error)
- func (b Bucket) GetCreateSql() (string, []interface{})
- func (b *Bucket) GetValues() (values map[string]map[string][]byte, err error)
- func (b *Bucket) Serialize() (map[string]interface{}, error)
- func (b *Bucket) String() (s string)
- type BucketUsageEvent
- type Cluster
- type GarbageCollection
- type Multipart
- type MultipartMetadata
- type ObjMap
- type Object
- func (o *Object) Deserialize(fields map[string]string) (interface{}, error)
- func (o *Object) GetCreateSql() (string, []interface{})
- func (o *Object) GetUpdateMetaSql() (string, []interface{})
- func (o *Object) GetValues() (values map[string]map[string][]byte, err error)
- func (o *Object) GetValuesForDelete() (values map[string]map[string][]byte)
- func (o *Object) GetVersionId() string
- func (o *Object) GetVersionNumber() (uint64, error)
- func (o *Object) ObjectTypeToString() string
- func (o *Object) Serialize() (map[string]interface{}, error)
- func (o *Object) String() (s string)
- type ObjectType
- type Part
- type PartTooSmall
- type SimpleIndex
- type StorageClass
Constants ¶
const ( FIELD_NAME_BODY = "body" FIELD_NAME_USAGE = "usage" FIELD_NAME_FILECOUNTS = "file_counts" )
const ( CREATE_TIME_LAYOUT = "2006-01-02T15:04:05.000Z" TIME_LAYOUT_TIDB = "2006-01-02 15:04:05" INITIALIZATION_VECTOR_LENGTH = 16 // 12 bytes is best performance for GCM, but for CTR ObjectNameEnding = ":" ObjectNameSeparator = "\n" ObjectNameSmallestStr = " " ResponseNumberOfRows = 1024 )
const ( BUCKET_TABLE = "buckets" BUCKET_COLUMN_FAMILY = "b" BUCKET_ACL_COLUMN_FAMILY = "a" BUCKET_CORS_COLUMN_FAMILY = "c" USER_TABLE = "users" USER_COLUMN_FAMILY = "u" OBJECT_TABLE = "objects" OBJECT_COLUMN_FAMILY = "o" OBJECT_PART_COLUMN_FAMILY = "p" GARBAGE_COLLECTION_TABLE = "garbageCollection" GARBAGE_COLLECTION_COLUMN_FAMILY = "gc" GARBAGE_COLLECTION_PART_COLUMN_FAMILY = "p" LIFE_CYCLE_TABLE = "lifeCycle" LIFE_CYCLE_COLUMN_FAMILY = "lc" MULTIPART_TABLE = "multiparts" MULTIPART_COLUMN_FAMILY = "m" CLUSTER_TABLE = "cluster" CLUSTER_COLUMN_FAMILY = "c" OBJMAP_TABLE = "objMap" OBJMAP_COLUMN_FAMILY = "om" )
const ( ObjectTypeNormal = iota ObjectTypeAppendable ObjectTypeMultipart )
const (
SYNC_EVENT_BUCKET_USAGE_PREFIX = "sync_bucket_usage_"
)
Variables ¶
var ( XXTEA_KEY = []byte("hehehehe") SSE_S3_MASTER_KEY = []byte("hehehehehehehehehehehehehehehehe") // 32 bytes to select AES-256 )
Functions ¶
Types ¶
type Bucket ¶
func (*Bucket) Deserialize ¶
func (Bucket) GetCreateSql ¶
func (*Bucket) GetValues ¶
Learn from this, http://stackoverflow.com/questions/33587227/golang-method-sets-pointer-vs-value-receiver If you have a T and it is addressable you can call methods that have a receiver type of *T as well as methods that have a receiver type of T
type BucketUsageEvent ¶
type GarbageCollection ¶
type GarbageCollection struct {
Rowkey string // rowkey cache
BucketName string
ObjectName string
Location string
ObjectId string
Status string // status of this entry, in Pending/Deleting
StorageMeta string // meta data used by storage driver, different storage driver may have different information
MTime time.Time // last modify time of status
Parts map[int]*Part
TriedTimes int
}
func (GarbageCollection) GetRowkey ¶
func (gc GarbageCollection) GetRowkey() (string, error)
Rowkey format: bigEndian(unixNanoTimestamp) + BucketName + ObjectName
func (GarbageCollection) GetValues ¶
func (gc GarbageCollection) GetValues() (values map[string]map[string][]byte, err error)
func (GarbageCollection) GetValuesForDelete ¶
func (gc GarbageCollection) GetValuesForDelete() map[string]map[string][]byte
type Multipart ¶
type Multipart struct {
BucketName string
ObjectKey string
InitialTime time.Time
UploadId string // upload id cache
ObjectId string
StorageMeta string
Metadata MultipartMetadata
Parts map[int]*Part
}
func (*Multipart) GetUploadId ¶
type MultipartMetadata ¶
type ObjMap ¶
type ObjMap struct {
Rowkey []byte // Rowkey cache
Name string
BucketName string
NullVerNum uint64
NullVerId string
}
type Object ¶
func (*Object) Deserialize ¶
func (*Object) GetCreateSql ¶
func (*Object) GetUpdateMetaSql ¶
func (*Object) GetValuesForDelete ¶
func (*Object) GetVersionId ¶
func (*Object) GetVersionNumber ¶
func (*Object) ObjectTypeToString ¶
type ObjectType ¶
type ObjectType string
type Part ¶
type Part struct {
PartNumber int
Size int64
ObjectId string
// offset of this part in whole object, calculated when moving parts from
// `multiparts` table to `objects` table
Offset int64
Etag string
LastModified string // time string of format "2006-01-02T15:04:05.000Z"
InitializationVector []byte
}
type PartTooSmall ¶
PartTooSmall - error if part size is less than 5MB.
func (PartTooSmall) Error ¶
func (e PartTooSmall) Error() string
type SimpleIndex ¶
type SimpleIndex struct {
Index []int64
}
func (*SimpleIndex) SearchLowerBound ¶
func (array *SimpleIndex) SearchLowerBound(key int64) int
func (*SimpleIndex) SearchUpperBound ¶
func (array *SimpleIndex) SearchUpperBound(key int64) int
type StorageClass ¶
type StorageClass int32
func MatchStorageClassIndex ¶
func MatchStorageClassIndex(storageClass string) (StorageClass, error)
func (StorageClass) ToString ¶
func (s StorageClass) ToString() string