models

package
v0.7.5 Latest Latest
Warning

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

Go to latest
Published: May 29, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

tracker models

Index

Constants

View Source
const StorageFileDb = "tracker_file_db"

StorageFileDb

Variables

View Source
var FileHashDB = "file_hash_db"
View Source
var GroupDB = "group_db"

GroupDB

View Source
var LinkDB = "link_db"

LinkDB

View Source
var UploadSessionDB = "upload_session_db"

k : block md5 , v :

Functions

This section is empty.

Types

type BlockStorage

type BlockStorage struct {
	ID   string
	Mark []Storage
}

func (BlockStorage) GetDB

func (BlockStorage) GetDB() string

func (BlockStorage) GetID

func (b BlockStorage) GetID() string

type File

type File struct {
	ID       string `json:"id"`
	PreID    string `json:"pre_id"`
	FileMeta `json:"file_meta"`
	Storage  *Storage  `json:"storage"`
	Backups  []Storage `json:"backups"`
	Name     string    `json:"name"`
	// 0: 正在上传 1:上传完成 -1:已经删除
	Status     int      `json:"status"`
	Path       string   `json:"path"`
	BlockSize  int64    `json:"block_size"`
	BlockMd5   []string `json:"block_md5"`
	Dir        bool     `json:"dir"`
	Link       *Link    `json:"link"`
	UpdataTime int64    `json:"updata_time"`
}

File

func (File) GetDB

func (d File) GetDB() string

func (File) GetID

func (d File) GetID() string

func (File) GetMd5

func (d File) GetMd5() string

func (File) GetName

func (d File) GetName() string

func (File) GetPath

func (d File) GetPath() string

type FileHash

type FileHash struct {
	ID  string `json:"id"`
	FID string `json:"fid"`
	Ok  bool   `json:"ok"`
}

func (FileHash) GetDB

func (f FileHash) GetDB() string

func (FileHash) GetID

func (f FileHash) GetID() string

type FileMeta

type FileMeta struct {
	Size    int64  `json:"size"`
	ModTime int64  `json:"modtime"`
	Md5     string `json:"md5"`
	Type    string `json:"type"`
}

type Group

type Group struct {
	Name     string             `json:"name"`
	Cap      int64              `json:"cap"`
	Status   string             `json:"status"`
	Storages map[string]Storage `json:"storages"`
}

Group

func (Group) GetDB

func (d Group) GetDB() string

func (Group) GetID

func (d Group) GetID() string

func (Group) GetLongLivedStorage

func (g Group) GetLongLivedStorage() (storage Storage)

func (Group) GetMinDelayStorage added in v0.7.5

func (g Group) GetMinDelayStorage() *Storage

func (Group) GetStorageByHash added in v0.7.5

func (g Group) GetStorageByHash(c *gin.Context) (*Storage, error)

func (Group) GetSyncStorages added in v0.7.5

func (g Group) GetSyncStorages(master *Storage) []Storage

func (Group) GetValidStorages

func (g Group) GetValidStorages() (storages []Storage)
type Link struct {
	Scheme     string         `json:"scheme"`
	Path       string         `json:"path"`
	Header     http.Header    `json:"header"` // needed header
	Data       io.ReadCloser  // return file reader directly
	Expiration *time.Duration // url expiration time
}

k : filemetaID v : Link

type MLink struct {
	Scheme    string
	Path      string
	Header    http.Header `json:"header"` // needed header
	ExpriedAt time.Time
}

MLink

func (MLink) GetHeader

func (l MLink) GetHeader() http.Header

func (MLink) GetPath

func (l MLink) GetPath() string

func (MLink) GetScheme

func (l MLink) GetScheme() string

type Storage

type Storage struct {
	Group        string `json:"group"`
	ServerAddr   string `json:"server_addr"`
	DownloadAddr string `json:"download_addr"`
	// work is good else is err info
	Status     string `json:"status"`
	Cap        int64  `json:"cap"`
	Delay      int64  `json:"delay"`
	UpdataTime int64  `json:"updata_time"`
}

Storage

func (Storage) GetClientKey

func (s Storage) GetClientKey() string

GetClientKey

@receiver s
@return string

type SyncDst added in v0.7.5

type SyncDst struct {
	Storage *Storage
	Status  string `json:"status"`
	Percent int    `json:"percent"`
}

type SyncSession added in v0.7.5

type SyncSession struct {
	ID  string    `json:"id"`
	Src *Storage  `json:"src"`
	Dst []SyncDst `json:"dst"`
	FID string    `json:"fid"`
	// 等待同步 ;正在同步;异常
	Status    string `json:"status"`
	CreatedAt int64  `json:"ctreated_at"`
	BeginAt   int64  `json:"begin_at"`
	UpdataAt  int64  `json:"upldata_at"`
}

func (SyncSession) GetDB added in v0.7.5

func (s SyncSession) GetDB() string

func (SyncSession) GetID added in v0.7.5

func (s SyncSession) GetID() string

func (SyncSession) GetTargets added in v0.7.5

func (s SyncSession) GetTargets() []string

type System

type System struct {
	BeginTime time.Time
}

System

type UploadSession

type UploadSession struct {
	ID          string  `json:"id"`
	FileID      string  `json:"file_id"`
	CreatedTime int64   `json:"cteated_time"`
	UpdataTime  int64   `json:"update_time"`
	Status      string  `json:"status"`
	BlockSize   int64   `json:"block_size"`
	Percent     float32 `json:"percent"`
}

UploadSession

func (UploadSession) GetDB

func (d UploadSession) GetDB() string

func (UploadSession) GetID

func (d UploadSession) GetID() string

func (*UploadSession) GetPercent

func (u *UploadSession) GetPercent() (float32, error)

func (*UploadSession) GetStatus

func (u *UploadSession) GetStatus() string

Jump to

Keyboard shortcuts

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