bucket

package
v0.2.19-0...-0e46f23 Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2018 License: GPL-3.0 Imports: 27 Imported by: 1

Documentation

Index

Constants

View Source
const (
	ProfilePath string = "backrunner.profile"

	PainNoFreeSpaceSoft float64 = 5000000000.0
	PainNoFreeSpaceHard float64 = 50000000000000.0

	// pain for read-only groups
	PainStatRO float64 = PainNoFreeSpaceHard / 2

	// this is randomly selected error gain for buckets where upload has failed
	BucketWriteErrorPain float64 = PainNoFreeSpaceHard / 2

	// pain for group without statistics
	PainNoStats float64 = PainNoFreeSpaceHard / 2

	// pain for group where statistics contains error field
	PainStatError float64 = PainNoFreeSpaceHard / 2

	// pain for bucket which do not have its group in stats
	PainNoGroup float64 = PainNoFreeSpaceHard / 2

	PainDiscrepancy float64 = 1000.0
)
View Source
const (
	// a placeholder for /get/ request which doesn't enforce additional checks besides auth check,
	// i.e. it is not admin, it is not modification
	BucketAuthEmpty uint64 = 0

	// when ACL contains this flag, no further auth checks are ever performed for given user
	BucketAuthNoToken uint64 = 1

	// ACL must contain this flag to allow user to upload data
	BucketAuthWrite uint64 = 2

	// currently unused ACL flag which was introduced to split admin role (bucket modification) from usual writers
	// it is unused since backrunner doesn't support bucket modification or creation,
	// there is special tool @bmeta for this
	BucketAuthAdmin uint64 = 4
)
View Source
const BucketNamespace string = "bucket"

Variables

This section is empty.

Functions

func FreeSpaceRatio

func FreeSpaceRatio(st *elliptics.StatBackend, content_length uint64) float64

func URIOffsetSize

func URIOffsetSize(req *http.Request) (offset uint64, size uint64, err error)

Types

type BctlStat

type BctlStat struct {
	Buckets  map[string]*BucketStat
	StatTime string
}

type Bucket

type Bucket struct {
	Name  string
	Group map[uint32]*elliptics.StatGroup

	Meta BucketMsgpack
}

func NewBucket

func NewBucket(name string) *Bucket

func ReadBucket

func ReadBucket(ell *etransport.Elliptics, name string) (bucket *Bucket, err error)

func WriteBucket

func WriteBucket(ell *etransport.Elliptics, meta *BucketMsgpack) (bucket *Bucket, err error)

type BucketACL

type BucketACL struct {
	Version int32  `json:"-"`
	User    string `json:"user"`
	Token   string `json:"token"`
	Flags   uint64 `json:"flags"`
}

type BucketCtl

type BucketCtl struct {
	sync.RWMutex

	Conf *config.ProxyConfig
	// after config has been locally updated via HTTP request,
	// it disables automatic config update for time period specified in config
	DisableConfigUpdateUntil time.Time

	BucketTimer     *time.Timer
	BucketStatTimer *time.Timer

	// time when previous statistics update has been performed
	StatTime time.Time

	// time when backrunner proxy started
	StartTime time.Time

	// time when the last time config update was done
	ConfigTime time.Time

	// buckets used for automatic write bucket selection,
	// i.e. when client doesn't provide bucket name and we select it
	// according to its performance and capacity
	Bucket []*Bucket

	// buckets used by clients directly, i.e. when client explicitly says
	// he wants to work with bucket named 'X'
	BackBucket []*Bucket
	// contains filtered or unexported fields
}

func NewBucketCtl

func NewBucketCtl(ell *etransport.Elliptics, bucket_path, proxy_config_path string) (bctl *BucketCtl, err error)

func (*BucketCtl) AllBuckets

func (bctl *BucketCtl) AllBuckets() []*Bucket

func (*BucketCtl) BucketStatUpdate

func (bctl *BucketCtl) BucketStatUpdate() (err error)

func (*BucketCtl) BucketStatUpdateNolock

func (bctl *BucketCtl) BucketStatUpdateNolock(stat *elliptics.DnetStat) (err error)

func (*BucketCtl) BucketUpload

func (bctl *BucketCtl) BucketUpload(bucket_name, key string, req *http.Request) (reply *reply.LookupResult, bucket *Bucket, err error)

func (*BucketCtl) BulkDelete

func (bctl *BucketCtl) BulkDelete(bname string, keys []string, req *http.Request) (reply map[string]interface{}, err error)

func (*BucketCtl) Delete

func (bctl *BucketCtl) Delete(bname, key string, req *http.Request) (err error)

func (*BucketCtl) DumpProfile

func (bctl *BucketCtl) DumpProfile(out io.Writer, types []string)

func (*BucketCtl) DumpProfileFile

func (bctl *BucketCtl) DumpProfileFile(add_time bool)

func (*BucketCtl) DumpProfileSingle

func (bctl *BucketCtl) DumpProfileSingle(out io.Writer, name string)

func (*BucketCtl) EllipticsReadBackrunnerConfig

func (bctl *BucketCtl) EllipticsReadBackrunnerConfig(conf *config.ProxyConfig, conf_key string) (err error)

func (*BucketCtl) EllipticsReadBucketList

func (bctl *BucketCtl) EllipticsReadBucketList() (data []byte, err error)

func (*BucketCtl) FindBucket

func (bctl *BucketCtl) FindBucket(name string) (bucket *Bucket, err error)

func (*BucketCtl) FindBucketRO

func (bctl *BucketCtl) FindBucketRO(name string) *Bucket

func (*BucketCtl) GetBucket

func (bctl *BucketCtl) GetBucket(key string, req *http.Request) (bucket *Bucket)

func (*BucketCtl) Lookup

func (bctl *BucketCtl) Lookup(bname, key string, req *http.Request) (reply *reply.LookupResult, err error)

func (*BucketCtl) NewBucketCtlStat

func (bctl *BucketCtl) NewBucketCtlStat() *BucketCtlStat

func (*BucketCtl) ReadBucketConfig

func (bctl *BucketCtl) ReadBucketConfig() (err error)

func (*BucketCtl) ReadBucketsMetaNolock

func (bctl *BucketCtl) ReadBucketsMetaNolock(names []string) (new_buckets []*Bucket, err error)

func (*BucketCtl) ReadConfig

func (bctl *BucketCtl) ReadConfig() (err error)

func (*BucketCtl) ReadProxyConfig

func (bctl *BucketCtl) ReadProxyConfig() error

func (*BucketCtl) SetContentType

func (bctl *BucketCtl) SetContentType(key string, w http.ResponseWriter)

func (*BucketCtl) SetGroupsTimeout

func (bctl *BucketCtl) SetGroupsTimeout(s *elliptics.Session, bucket *Bucket, key string)

func (*BucketCtl) Stat

func (bctl *BucketCtl) Stat(req *http.Request, bnames []string) (reply *BctlStat, err error)

func (*BucketCtl) Stream

func (bctl *BucketCtl) Stream(bname, key string, w http.ResponseWriter, req *http.Request) (err error)

func (*BucketCtl) UpdateMetadata

func (bctl *BucketCtl) UpdateMetadata(key string, jsi interface{}) (err error)

func (*BucketCtl) Upload

func (bctl *BucketCtl) Upload(key string, req *http.Request) (reply *reply.LookupResult, bucket *Bucket, err error)

type BucketCtlStat

type BucketCtlStat struct {
	StartTime       int64
	StartTimeString string

	StatTime       int64
	StatTimeString string

	ConfigTime       int64
	ConfigTimeString string

	CurrentTime       int64
	CurrentTimeString string

	BucketNum             int
	Hostname              string
	ConfigUpdateInterval  int
	StatUpdateInterval    int
	BuildDate             string
	LastCommit            string
	EllipticsGoLastCommit string

	ProxyConfig config.ProxyConfig
}

type BucketMsgpack

type BucketMsgpack struct {
	Version   int32                `json:"-"`
	Name      string               `json:"-"`
	Acl       map[string]BucketACL `json:"-"`
	Groups    []uint32             `json:"groups"`
	Flags     uint64               `json:"flags"`
	MaxSize   uint64               `json:"max-size"`
	MaxKeyNum uint64               `json:"max-key-num"`
	// contains filtered or unexported fields
}

func NewBucketMsgpack

func NewBucketMsgpack(name string) *BucketMsgpack

func (*BucketMsgpack) ExtractJson

func (meta *BucketMsgpack) ExtractJson(iface interface{}) (err error)

func (*BucketMsgpack) ExtractMsgpack

func (meta *BucketMsgpack) ExtractMsgpack(out []interface{}) (err error)

func (*BucketMsgpack) PackMsgpack

func (meta *BucketMsgpack) PackMsgpack() (interface{}, error)

func (*BucketMsgpack) String

func (meta *BucketMsgpack) String() string

type BucketStat

type BucketStat struct {
	Group map[string]*elliptics.StatGroupData
	Meta  *BucketMsgpack
}

Jump to

Keyboard shortcuts

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