cmd

package
v0.0.0-...-a0291a8 Latest Latest
Warning

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

Go to latest
Published: May 13, 2022 License: MIT Imports: 34 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GlobalMinCDNDefaultPort = "9006"

	GlobalImgeContentTypePrefix  = "image/"
	GlobalDefaultImgeContentType = "image/jpeg"

	GlobalMemoryCacheSize = 1 * humanize.GiByte
)
View Source
const SlashSeparator = "/"

Variables

View Source
var GlobalContext context.Context
View Source
var GlobalFlags = []cli.Flag{
	cli.BoolFlag{
		Name:  "UseEtcd",
		Usage: "use etcd to register minCDN service",
	},
	cli.StringFlag{
		Name:   "EtcdAddress",
		Usage:  "etcd Address",
		EnvVar: "MINCDN_ETCD_ADDRESS",
	},
	cli.StringFlag{
		Name:   "address",
		Value:  ":" + GlobalMinCDNDefaultPort,
		Usage:  "bind to service address",
		EnvVar: "MINCDN_ADDRESS",
	},
	cli.StringFlag{
		Name:  "MinioEndpoint",
		Usage: "MininEndpoint",
	},
	cli.StringFlag{
		Name:  "MinioAccessID",
		Usage: "MinioAccessID",
	},
	cli.StringFlag{
		Name:  "MinioSecret",
		Usage: "MinioSecret",
	},
	cli.IntFlag{
		Name:  "MemoryCacheSize",
		Usage: "Set Memory Cache Size",
		Value: GlobalMemoryCacheSize,
	},
}

Functions

func Main

func Main(args []string)

func UTCNow

func UTCNow() time.Time

Types

type GetObjectReader

type GetObjectReader struct {
	io.Reader
	ObjInfo ResObjectInfo
}

type LRWMutex

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

A LRWMutex is a mutual exclusion lock with timeouts.

func NewLRWMutex

func NewLRWMutex() *LRWMutex

NewLRWMutex - initializes a new lsync RW mutex.

func (*LRWMutex) DRLocker

func (lm *LRWMutex) DRLocker() sync.Locker

DRLocker returns a sync.Locker interface that implements the Lock and Unlock methods by calling drw.RLock and drw.RUnlock.

func (*LRWMutex) ForceUnlock

func (lm *LRWMutex) ForceUnlock()

ForceUnlock will forcefully clear a write or read lock.

func (*LRWMutex) GetLock

func (lm *LRWMutex) GetLock(ctx context.Context, id string, source string, timeout time.Duration) (locked bool)

GetLock tries to get a write lock on lm before the timeout occurs.

func (*LRWMutex) GetRLock

func (lm *LRWMutex) GetRLock(ctx context.Context, id string, source string, timeout time.Duration) (locked bool)

GetRLock tries to get a read lock on lm before the timeout occurs.

func (*LRWMutex) Lock

func (lm *LRWMutex) Lock()

Lock holds a write lock on lm.

If the lock is already in use, the calling go routine blocks until the mutex is available.

func (*LRWMutex) RLock

func (lm *LRWMutex) RLock()

RLock holds a read lock on lm.

If one or more read lock are already in use, it will grant another lock. Otherwise the calling go routine blocks until the mutex is available.

func (*LRWMutex) RUnlock

func (lm *LRWMutex) RUnlock()

RUnlock releases a read lock held on lm.

It is a run-time error if lm is not locked on entry to RUnlock.

func (*LRWMutex) Unlock

func (lm *LRWMutex) Unlock()

Unlock unlocks the write lock.

It is a run-time error if lm is not locked on entry to Unlock.

type LockContext

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

func (LockContext) Cancel

func (l LockContext) Cancel()

func (LockContext) Context

func (l LockContext) Context() context.Context

type LockType

type LockType int

type MinIOObjects

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

func (*MinIOObjects) GetResInfo

func (fs *MinIOObjects) GetResInfo(ctx context.Context, bucket, object, resUri string, h http.Header, lockType LockType, clientObjInfo ResObjectInfo) (resBuffer *bufio.Reader, statusCode int, err error)

func (*MinIOObjects) NewNSLock

func (fs *MinIOObjects) NewNSLock(recUri string) RWLocker

type ObjectLayer

type ObjectLayer interface {
	NewNSLock(recUri string) RWLocker
	GetResInfo(ctx context.Context, bucket, object, resUri string, h http.Header, lockType LockType, clientObjInfo ResObjectInfo) (resBuffer *bufio.Reader, statusCode int, err error)
}

func NewMinIOObjectLayer

func NewMinIOObjectLayer(endPoint, accessKeyID, secretAccessKey string, useSSL bool) (ObjectLayer, error)

type OperationTimedOut

type OperationTimedOut struct {
}

func (OperationTimedOut) Error

func (e OperationTimedOut) Error() string

type RWLocker

type RWLocker interface {
	GetLock(ctx context.Context, timeout *dynamicTimeout) (lkCtx LockContext, timedOutErr error)
	Unlock(cancel context.CancelFunc)
	GetRLock(ctx context.Context, timeout *dynamicTimeout) (lkCtx LockContext, timedOutErr error)
	RUnlock(cancel context.CancelFunc)
}

type ResObject

type ResObject struct {
	ByteData []byte
	ObjInfo  ResObjectInfo
}

type ResObjectInfo

type ResObjectInfo struct {
	Etag        string
	LastModify  time.Time
	ContentType string
}

Jump to

Keyboard shortcuts

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