types

package
Version: v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2020 License: Apache-2.0 Imports: 22 Imported by: 0

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

View Source
const (
	FIELD_NAME_BODY       = "body"
	FIELD_NAME_USAGE      = "usage"
	FIELD_NAME_FILECOUNTS = "file_counts"
)
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
)
View Source
const (
	SYNC_EVENT_BUCKET_USAGE_PREFIX = "sync_bucket_usage_"
)

Variables

View Source
var (
	XXTEA_KEY         = []byte("hehehehe")
	SSE_S3_MASTER_KEY = []byte("hehehehehehehehehehehehehehehehe") // 32 bytes to select AES-256
)
View Source
var (
	StorageClassIndexMap = map[StorageClass]string{
		utils.Tier1:   "STANDARD",
		utils.Tier99:  "STANDARD_IA",
		utils.Tier999: "GLACIER",
	}

	StorageClassStringMap = map[string]StorageClass{
		"STANDARD":    utils.Tier1,
		"STANDARD_IA": utils.Tier99,
		"GLACIER":     utils.Tier999,
	}
)

Functions

func GetMultipartUploadIdForTidb

func GetMultipartUploadIdForTidb(uploadtime uint64) string

Types

type Bucket

type Bucket struct {
	*pb.Bucket
}

func (*Bucket) Deserialize

func (b *Bucket) Deserialize(fields map[string]string) (interface{}, error)

func (Bucket) GetCreateSql

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

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) Serialize

func (b *Bucket) Serialize() (map[string]interface{}, error)

implements the Serializable interface

func (*Bucket) String

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

type BucketUsageEvent

type BucketUsageEvent struct {
	Usage      int64
	BucketName string
}

type Cluster

type Cluster struct {
	Fsid   string
	Pool   string
	Weight int
}

func (*Cluster) Deserialize

func (c *Cluster) Deserialize(fields map[string]string) (interface{}, error)

func (*Cluster) GetValues

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

func (*Cluster) Serialize

func (c *Cluster) Serialize() (map[string]interface{}, error)

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

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

func (*Multipart) GetValuesForDelete

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

type MultipartMetadata

type MultipartMetadata struct {
	InitiatorId   string //TenantId
	TenantId      string
	UserId        string
	ContentType   string
	Location      string
	Pool          string
	Acl           s3.Acl
	SseRequest    datatype.SseRequest
	EncryptionKey []byte
	CipherKey     []byte
	Attrs         map[string]string
	Tier          int32
}

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 {
	*pb.Object
}

func (*Object) Deserialize

func (o *Object) Deserialize(fields map[string]string) (interface{}, error)

func (*Object) GetCreateSql

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

func (*Object) GetUpdateMetaSql

func (o *Object) GetUpdateMetaSql() (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

func (o *Object) ObjectTypeToString() string

func (*Object) Serialize

func (o *Object) Serialize() (map[string]interface{}, error)

func (*Object) String

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

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

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

Jump to

Keyboard shortcuts

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