usecase

package
v0.0.0-...-907d554 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2020 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BatchRequest

type BatchRequest struct {
	Objects []*ObjectRequest
}

BatchRequest is ...

type BatchResult

type BatchResult struct {
	Objects []*ObjectResult
}

BatchResult is ...

type BatchService

type BatchService interface {
	Batch(req *BatchRequest) (*BatchResult, error)
}

BatchService is ...

func NewBatchService

func NewBatchService(metaDataRepo MetaDataRepository, contentRepo ContentRepository) BatchService

NewBatchService is ...

type ContentRepository

type ContentRepository interface {
	Get(meta *entity.MetaData, w io.Writer, from int64, to int64) (int64, error)
	Put(meta *entity.MetaData, r io.Reader) error
	Exists(meta *entity.MetaData) bool
}

ContentRepository is ...

type LockListRequest

type LockListRequest struct {
	Repo    string
	Path    string
	Cursor  string
	Limit   int
	Refspec string
}

type LockListResult

type LockListResult struct {
	Locks      []*LockResult
	NextCursor string
}

type LockRepository

type LockRepository interface {
	Add(repo string, l ...entity.Lock) error
	Delete(repo string, user string, id string, force bool) (*entity.Lock, error)
	Fetch(repo string) ([]entity.Lock, error)
	FilteredFetch(repo string, path string, cursor string, limit string) (locks []entity.Lock, next string, err error)
	FetchAll() ([]entity.Lock, error)
}

LockRepository is ...

type LockRequest

type LockRequest struct {
	Repo    string
	User    string
	Path    string
	Refspec string
}

type LockResult

type LockResult struct {
	ID           string
	Path         string
	Owner        string
	LockedAt     int64 // UnixTime
	AlreadyExist bool
}

type LockService

type LockService interface {
	Lock(req *LockRequest) (*LockResult, error)
	Unlock(req *UnlockRequest) (*LockResult, error)
	List(req *LockListRequest) (*LockListResult, error)
	Verify(req *LockVerifyRequest) (*LockVerifyResult, error)
}

LockService is ...

func NewLockService

func NewLockService(lockRepo LockRepository) LockService

type LockVerifyRequest

type LockVerifyRequest struct {
	Repo    string
	User    string
	Path    string
	Cursor  string
	Limit   int
	Refspec string
}

type LockVerifyResult

type LockVerifyResult struct {
	Ours       []*LockResult
	Theirs     []*LockResult
	NextCursor string
}

type MetaDataRepository

type MetaDataRepository interface {
	Get(oid string) (*entity.MetaData, error)
	Put(oid string, size int64) (*entity.MetaData, error)
	Delete(oid string) error
	Objects() ([]*entity.MetaData, error)
}

MetaDataRepository is ...

type ObjectRequest

type ObjectRequest struct {
	Oid  string
	Size int64
	From int64
	To   int64
}

ObjectRequest is ...

type ObjectResult

type ObjectResult struct {
	Oid          string
	Size         int64
	MetaExists   bool
	ObjectExists bool
}

ObjectResult is ...

type TransferService

type TransferService interface {
	Download(req *ObjectRequest, w io.Writer) (int64, error)
	Upload(req *ObjectRequest, r io.Reader) error
	Exists(req *ObjectRequest) bool
	GetSize(req *ObjectRequest) int64
}

TransferService is ...

func NewTransferService

func NewTransferService(metaDataRepo MetaDataRepository, contentRepo ContentRepository) TransferService

NewTransferService is ...

type UnlockRequest

type UnlockRequest struct {
	Repo    string
	User    string
	ID      string
	Force   bool
	Refspec string
}

type UserRepository

type UserRepository interface {
	AddUser(user, pass string) error
	DeleteUser(user string) error
	Users() ([]*entity.User, error)
}

UserRepository is ...

Jump to

Keyboard shortcuts

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