Documentation ¶
Overview ¶
Package repository is interface and its implementation for different repositories
Index ¶
- Variables
- func GetContentLevelID(r *http.Request) (uint32, uint32, error)
- func GetFileSign(r *http.Request) (string, error)
- func GetMultipartUploadID(r *http.Request) (string, error)
- func GetPartNum(r *http.Request) (uint32, error)
- type BaseProvider
- type DecoratorInter
- type HAEnhancer
- type MetadataResponse
- type ObjectDownloader
- type ObjectMetadata
- type Provider
- type RepoCreated
- type SyncManager
- func (s *SyncManager) AckQueueName() string
- func (s *SyncManager) ParseQueueMsg(msg string) (uint32, string, error)
- func (s *SyncManager) PushToQueue(kt *kit.Kit, sign string) error
- func (s *SyncManager) QueueClient() bedis.Client
- func (s *SyncManager) QueueMsg(bizID uint32, sign string) string
- func (s *SyncManager) QueueName() string
- func (s *SyncManager) Sync(kt *kit.Kit, sign string) (skip bool, err error)
- type VariableCacher
Constants ¶
This section is empty.
Variables ¶
var ErrNoFileInMaster = errors.New("file not found in master")
ErrNoFileInMaster is error of no file in master
Functions ¶
func GetContentLevelID ¶
GetContentLevelID get content level id, including app id and template space id
func GetMultipartUploadID ¶
GetMultipartUploadID get multipart upload id
Types ¶
type BaseProvider ¶
type BaseProvider interface { ObjectDownloader Upload(kt *kit.Kit, sign string, body io.Reader) (*ObjectMetadata, error) InitMultipartUpload(kt *kit.Kit, sign string) (string, error) MultipartUpload(kt *kit.Kit, sign string, uploadID string, partNum uint32, body io.Reader) error CompleteMultipartUpload(kt *kit.Kit, sign string, uploadID string) (*ObjectMetadata, error) Download(kt *kit.Kit, sign string) (io.ReadCloser, int64, error) Metadata(kt *kit.Kit, sign string) (*ObjectMetadata, error) }
BaseProvider repo base provider interface
type DecoratorInter ¶
type DecoratorInter interface { Root() string RepoName() string Path(sign string) string RelativePath(sign string) string Url() string }
DecoratorInter ..
type HAEnhancer ¶
type HAEnhancer interface {
SyncManager() *SyncManager
}
HAEnhancer high availability enhancer interface
type MetadataResponse ¶
type MetadataResponse struct { Exists bool `json:"exists"` Metadata *ObjectMetadata `json:"metadata"` }
MetadataResponse 文件元数据响应
type ObjectDownloader ¶
type ObjectDownloader interface { DownloadLink(kt *kit.Kit, sign string, fetchLimit uint32) ([]string, error) AsyncDownload(kt *kit.Kit, sign string) (string, error) AsyncDownloadStatus(kt *kit.Kit, sign string, taskID string) (bool, error) URIDecorator(bizID uint32) DecoratorInter }
ObjectDownloader 文件下载
type ObjectMetadata ¶
type ObjectMetadata struct { ByteSize int64 `json:"byte_size"` Sha256 string `json:"sha256"` Md5 string `json:"md5"` }
ObjectMetadata 文件元数据
type Provider ¶
type Provider interface { BaseProvider HAEnhancer VariableCacher }
Provider repo provider interface
func NewProvider ¶
func NewProvider(conf cc.Repository) (Provider, error)
NewProvider init provider factory by storage type
type RepoCreated ¶
RepoCreated is the created repo data with lock to keep its concurrent security
type SyncManager ¶
type SyncManager struct {
// contains filtered or unexported fields
}
SyncManager is sync manager
func (*SyncManager) AckQueueName ¶
func (s *SyncManager) AckQueueName() string
AckQueueName returns name of ack queue
func (*SyncManager) ParseQueueMsg ¶
func (s *SyncManager) ParseQueueMsg(msg string) (uint32, string, error)
ParseQueueMsg parses msg of sync queue
func (*SyncManager) PushToQueue ¶
func (s *SyncManager) PushToQueue(kt *kit.Kit, sign string) error
PushToQueue pushes the file metadata msg to queue so that the master's write operations can be received by slave
func (*SyncManager) QueueClient ¶
func (s *SyncManager) QueueClient() bedis.Client
QueueClient returns client for sync queue
func (*SyncManager) QueueMsg ¶
func (s *SyncManager) QueueMsg(bizID uint32, sign string) string
QueueMsg returns msg for sync queue
func (*SyncManager) QueueName ¶
func (s *SyncManager) QueueName() string
QueueName returns name of sync queue
type VariableCacher ¶
type VariableCacher interface { // SetVariables sets template variables into cache, the variables extracted from repository file content SetVariables(kt *kit.Kit, sign string, checkSize bool) ([]string, error) // GetVariables gets template variables from the cache firstly; if not found, then get from the repository GetVariables(kt *kit.Kit, sign string, checkSize bool) ([]string, error) }
VariableCacher is used to set/get template variables with cache