types

package
v1.2.2 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2019 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
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
)
View Source
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"
)
View Source
const (
	ObjectTypeNormal = iota
	ObjectTypeAppendable
	ObjectTypeMultipart
)

Variables

View Source
var (
	XXTEA_KEY         = []byte("hehehehe")
	SSE_S3_MASTER_KEY = []byte("hehehehehehehehehehehehehehehehe") // 32 bytes to select AES-256
)

Functions

func GetMultipartUploadIdForTidb

func GetMultipartUploadIdForTidb(uploadtime uint64) string

Types

type Bucket

type Bucket struct {
	Name string
	// Date and time when the bucket was created,
	// should be serialized into format "2006-01-02T15:04:05.000Z"
	CreateTime time.Time
	OwnerId    string
	CORS       datatype.Cors
	ACL        datatype.Acl
	LC         datatype.Lc
	Policy     policy.Policy
	Versioning string // actually enum: Disabled/Enabled/Suspended
	Usage      int64
}

func (Bucket) GetCreateSql

func (b Bucket) GetCreateSql() (string, []interface{})

func (Bucket) GetUpdateSql

func (b Bucket) GetUpdateSql() (string, []interface{})

Tidb related function

func (*Bucket) GetValues

func (b *Bucket) GetValues() (values map[string]map[string][]byte, err error)

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

func (*Bucket) String

func (b *Bucket) String() (s string)

type Cluster

type Cluster struct {
	Fsid   string
	Pool   string
	Weight int
}

func (Cluster) GetValues

func (c Cluster) GetValues() (values map[string]map[string][]byte, err error)

type CompleteMultipartUpload

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

completeMultipartUpload - represents input fields for completing multipart upload.

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 - completed part container.

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 GarbageCollection

type GarbageCollection struct {
	Rowkey     string // rowkey cache
	BucketName string
	ObjectName string
	Location   string
	Pool       string
	ObjectId   string
	Status     string    // status of this entry, in Pending/Deleting
	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 LifeCycle

type LifeCycle struct {
	BucketName string
	Status     string // status of this entry, in Pending/Deleting
}

func (LifeCycle) GetRowkey

func (lc LifeCycle) GetRowkey() (string, error)

func (LifeCycle) GetValues

func (lc LifeCycle) GetValues() (values map[string]map[string][]byte, err error)

func (LifeCycle) GetValuesForDelete

func (lc LifeCycle) GetValuesForDelete() map[string]map[string][]byte

type ListObjectsInfo

type ListObjectsInfo struct {
	// Indicates whether the returned list objects response is truncated. A
	// value of true indicates that the list was truncated. The list can be truncated
	// if the number of objects exceeds the limit allowed or specified
	// by max keys.
	IsTruncated bool

	// When response is truncated (the IsTruncated element value in the response
	// is true), you can use the key name in this field as marker in the subsequent
	// request to get next set of objects.
	//
	// NOTE: This element is returned only if you have delimiter request parameter
	// specified.
	NextMarker string

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

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

ListObjectsInfo - container for list objects.

type Multipart

type Multipart struct {
	BucketName  string
	ObjectName  string
	InitialTime time.Time
	UploadId    string // upload id cache
	Metadata    MultipartMetadata
	Parts       map[int]*Part
}

func (*Multipart) GetRowkey

func (m *Multipart) GetRowkey() (string, error)

Multipart table rowkey format: BucketName + bigEndian(uint16(count("/", ObjectName))) + ObjectName + bigEndian(unixNanoTimestamp)

func (*Multipart) GetUploadId

func (m *Multipart) GetUploadId() (string, error)

func (*Multipart) GetValues

func (m *Multipart) GetValues() (values map[string]map[string][]byte, err error)

func (*Multipart) GetValuesForDelete

func (m *Multipart) GetValuesForDelete() map[string]map[string][]byte

type MultipartMetadata

type MultipartMetadata struct {
	InitiatorId   string
	OwnerId       string
	ContentType   string
	Location      string
	Pool          string
	Acl           datatype.Acl
	SseRequest    datatype.SseRequest
	EncryptionKey []byte
	CipherKey     []byte
	Attrs         map[string]string
}

type ObjMap

type ObjMap struct {
	Rowkey     []byte // Rowkey cache
	Name       string
	BucketName string
	NullVerNum uint64
	NullVerId  string
}

func (*ObjMap) GetRowKey

func (om *ObjMap) GetRowKey() (string, error)

func (*ObjMap) GetValues

func (om *ObjMap) GetValues() (values map[string]map[string][]byte, err error)

func (*ObjMap) GetValuesForDelete

func (om *ObjMap) GetValuesForDelete() (values map[string]map[string][]byte)

type Object

type Object struct {
	Rowkey           []byte // Rowkey cache
	Name             string
	BucketName       string
	Location         string // which Ceph cluster this object locates
	Pool             string // which Ceph pool this object locates
	OwnerId          string
	Size             int64     // file size
	ObjectId         string    // object name in Ceph
	LastModifiedTime time.Time // in format "2006-01-02T15:04:05.000Z"
	Etag             string
	ContentType      string
	CustomAttributes map[string]string
	Parts            map[int]*Part
	PartsIndex       *SimpleIndex
	ACL              datatype.Acl
	NullVersion      bool   // if this entry has `null` version
	DeleteMarker     bool   // if this entry is a delete marker
	VersionId        string // version cache
	// type of Server Side Encryption, could be "SSE-KMS", "SSE-S3", "SSE-C"(custom), or ""(none),
	// KMS is not implemented yet
	SseType string
	// encryption key for SSE-S3, the key itself is encrypted with SSE_S3_MASTER_KEY,
	// in AES256-GCM
	EncryptionKey        []byte
	InitializationVector []byte
	// ObjectType include `Normal`, `Appendable`, 'Multipart'
	Type int
}

func (*Object) GetAddUsageSql added in v1.1.5

func (o *Object) GetAddUsageSql() (string, []interface{})

func (*Object) GetAppendSql added in v1.2.1

func (o *Object) GetAppendSql() (string, []interface{})

func (*Object) GetCreateSql

func (o *Object) GetCreateSql() (string, []interface{})

func (*Object) GetRowkey

func (o *Object) GetRowkey() (string, error)

Rowkey format: BucketName + ObjectNameSeparator + ObjectName + ObjectNameSeparator + bigEndian(uint64.max - unixNanoTimestamp)

func (*Object) GetSubUsageSql added in v1.1.5

func (o *Object) GetSubUsageSql() (string, []interface{})

func (*Object) GetUpdateAclSql added in v1.1.1

func (o *Object) GetUpdateAclSql() (string, []interface{})

func (*Object) GetUpdateAttrsSql added in v1.1.8

func (o *Object) GetUpdateAttrsSql() (string, []interface{})

func (*Object) GetValues

func (o *Object) GetValues() (values map[string]map[string][]byte, err error)

func (*Object) GetValuesForDelete

func (o *Object) GetValuesForDelete() (values map[string]map[string][]byte)

func (*Object) GetVersionId

func (o *Object) GetVersionId() string

func (*Object) GetVersionNumber

func (o *Object) GetVersionNumber() (uint64, error)

func (*Object) ObjectTypeToString added in v1.2.1

func (o *Object) ObjectTypeToString() string

func (*Object) String

func (o *Object) String() (s string)

type ObjectType added in v1.2.1

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
}

func (*Part) GetCreateGcSql

func (p *Part) GetCreateGcSql(bucketname, objectname string, version uint64) (string, []interface{})

func (*Part) GetCreateSql

func (p *Part) GetCreateSql(bucketname, objectname, version string) (string, []interface{})

func (*Part) GetValues

func (p *Part) GetValues() (values map[string]map[string][]byte, err error)

For scenario only one part is needed to insert

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 ScanLifeCycleResult

type ScanLifeCycleResult struct {
	Truncated  bool
	NextMarker string
	// List of LifeCycles info for this request.
	Lcs []LifeCycle
}

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 VersionedListObjectsInfo

type VersionedListObjectsInfo struct {
	IsTruncated         bool
	NextKeyMarker       string
	NextVersionIdMarker string
	Objects             []datatype.VersionedObject
	Prefixes            []string
}

Jump to

Keyboard shortcuts

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