alioss

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2021 License: BSD-3-Clause Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// LockIdle unlock
	LockIdle lockType = 0b0000
	// LockReader reader lock type
	LockReader lockType = 0b0001
	// LockWriter writer lock type
	LockWriter lockType = 0b0010
	// LockRWriter reader and writer lock type
	LockRWriter lockType = LockReader | LockWriter
)
View Source
const (
	// ObjectLockFile lock file path
	ObjectLockFile = ".git-syncer/lockfile"

	// ObjectHeadLinkFile head log file path
	ObjectHeadLinkFile = ".git-syncer/head"

	// ObjectLogDir log dir path
	ObjectLogDir = ".git-syncer/logs"
)
View Source
const JSONTimeLayout = time.RFC3339

JSONTimeLayout time format

Variables

This section is empty.

Functions

func AsOssError

func AsOssError(err error) *oss.ServiceError

AsOssError try to convert to oss service error

func IsObjectNotFoundErr

func IsObjectNotFoundErr(err error) bool

IsObjectNotFoundErr object not found err

func NewContrib

func NewContrib(opt *Options, bkt bucket.Bucket) (contrib.Contrib, error)

NewContrib create alioss contrib

func NewContribFactory

func NewContribFactory() contrib.Factory

NewContribFactory create alioss contrib factory

Types

type Alioss

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

Alioss alioss contrib

func (*Alioss) GetHeadSHA1

func (a *Alioss) GetHeadSHA1() (string, error)

GetHeadSHA1 get head sha1 from alioss contrib

func (*Alioss) Sync

func (a *Alioss) Sync(reqx *contrib.SyncReq) (res contrib.SyncRes, err error)

Sync sync files to alioss contrib

type JSONTime

type JSONTime struct {
	time.Time
}

JSONTime jsonable of time.Time

func (JSONTime) MarshalJSON

func (t JSONTime) MarshalJSON() ([]byte, error)

MarshalJSON stringify from time.Time

func (JSONTime) UnmarshalJSON

func (t JSONTime) UnmarshalJSON(bs []byte) error

UnmarshalJSON parse to time.Time

type LockInfo

type LockInfo struct {
	Mutex     lockType `json:"Mutex"`
	Date      JSONTime `json:"Date"`
	Locker    string   `json:"Locker"`
	LockID    string   `json:"LockID"`
	WLockSHA1 string   `json:"WLockSHA1"`
}

LockInfo lock info

type LogInfo

type LogInfo struct {
	SHA1     string         `json:"SHA1"`
	RefSHA1  string         `json:"RefSHA1"`
	Executor string         `json:"Executor"`
	Date     JSONTime       `json:"Date"`
	Uploaded []UploadedFile `json:"Uploaded"`
	Deleted  []string       `json:"Deleted"`
}

LogInfo log info

type Options

type Options struct {
	repository.ConfigReader
}

Options alioss Options

func NewOptions

func NewOptions(r repository.ConfigReader) *Options

NewOptions new Options

func (*Options) AccessKeyID

func (o *Options) AccessKeyID() string

AccessKeyID access key id options

func (*Options) AccessKeySecret

func (o *Options) AccessKeySecret() string

AccessKeySecret access key secret options

func (*Options) Base

func (o *Options) Base() string

Base base options

func (*Options) Bucket

func (o *Options) Bucket() string

Bucket bucket options

func (*Options) Endpoint

func (o *Options) Endpoint() string

Endpoint endpoint options

func (*Options) UserEmail

func (o *Options) UserEmail() string

UserEmail user.email

func (*Options) UserName

func (o *Options) UserName() string

UserName user.name

type UploadedFile

type UploadedFile struct {
	Path string `json:"Path"`
	Size int64  `json:"Size"`
	SHA1 string `json:"SHA1"`
}

UploadedFile uploaded file to log

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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