Documentation
¶
Index ¶
- Constants
- func AsOssError(err error) *oss.ServiceError
- func IsObjectNotFoundErr(err error) bool
- type Alioss
- func (a *Alioss) GetHeadSHA1() (string, error)
- func (a *Alioss) PathToKey(path string) string
- func (a *Alioss) PeekLog() (*LogInfo, error)
- func (a *Alioss) PushLog(info LogInfo) error
- func (a *Alioss) Sync(sha1 string, uploads []string, deletes []string) (uploaded []string, deleted []string, err error)
- type Bucket
- type JSONTime
- type LockInfo
- type LogInfo
- type Options
- type UploadedFile
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
View Source
const LockMaxAge = time.Minute * 5
LockMaxAge lock max age
Variables ¶
This section is empty.
Functions ¶
func AsOssError ¶
func AsOssError(err error) *oss.ServiceError
AsOssError try to convert to oss service error
func IsObjectNotFoundErr ¶
IsObjectNotFoundErr object not found err
Types ¶
type Alioss ¶
type Alioss struct {
// contains filtered or unexported fields
}
Alioss alioss contrib
func (*Alioss) GetHeadSHA1 ¶
GetHeadSHA1 get head sha1 from alioss contrib
type Bucket ¶
type Bucket interface { GetObject(key string, options ...oss.Option) (io.ReadCloser, error) PutObject(key string, reader io.Reader, options ...oss.Option) error DeleteObject(key string, options ...oss.Option) error IsObjectExist(key string, options ...oss.Option) (bool, error) PutSymlink(symObjectKey string, targetObjectKey string, options ...oss.Option) error }
Bucket bucket interface to interact with alioss
type JSONTime ¶
JSONTime jsonable of time.Time
func (JSONTime) MarshalJSON ¶
MarshalJSON stringify from time.Time
func (*JSONTime) UnmarshalJSON ¶
UnmarshalJSON parse to time.Time
type LockInfo ¶
type LockInfo struct { Mutex lockType `json:"Mutex"` Date JSONTime `json:"Date"` ExpireDate JSONTime `json:"ExpireDate"` LockID string `json:"LockID"` }
LockInfo lock info
type LogInfo ¶
type LogInfo struct { SHA1 string `json:"SHA1"` RefSHA1 string `json:"RefSHA1"` Date JSONTime `json:"Date"` Uploaded []UploadedFile `json:"Uploaded"` Deleted []string `json:"Deleted"` }
LogInfo log info
type Options ¶
type Options interface { Endpoint() string AccessKeyID() string AccessKeySecret() string Bucket() string Base() string }
Options alioss Options
type UploadedFile ¶
type UploadedFile struct { Path string `json:"Path"` Size int64 `json:"Size"` SHA1 string `json:"SHA1"` }
UploadedFile uploaded file to log
Source Files
¶
Click to show internal directories.
Click to hide internal directories.