task

package
v0.0.0-...-1791fcb Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2022 License: GPL-3.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FileEventNeedDownload = "file:download"
	FileEventDownloaded   = "file:downloaded"
)

Variables

View Source
var (
	ReplayFilesKey = []byte("task:replay")

	ReservedFields = []string{"GO", "AS", "TO", "OR", "AND", "XOR", "USE", "SET", "FROM", "WHERE", "MATCH", "INSERT", "YIELD", "RETURN", "DESCRIBE", "DESC", "VERTEX", "VERTICES", "EDGE", "EDGES", "UPDATE", "UPSERT", "WHEN", "DELETE", "FIND", "LOOKUP", "ALTER", "STEPS", "STEP", "OVER", "UPTO", "REVERSELY", "INDEX", "INDEXES", "REBUILD", "BOOL", "INT8", "INT16", "INT32", "INT64", "INT", "FLOAT", "DOUBLE", "STRING", "FIXED_STRING", "TIMESTAMP", "DATE", "TIME", "DATETIME", "TAG", "TAGS", "UNION", "INTERSECT", "MINUS", "NO", "OVERWRITE", "SHOW", "ADD", "CREATE", "DROP", "REMOVE", "IF", "NOT", "EXISTS", "WITH", "CHANGE", "GRANT", "REVOKE", "ON", "BY", "IN", "NOT_IN", "DOWNLOAD", "GET", "OF", "ORDER", "INGEST", "COMPACT", "FLUSH", "SUBMIT", "ASC", "ASCENDING", "DESCENDING", "DISTINCT", "FETCH", "PROP", "BALANCE", "STOP", "LIMIT", "OFFSET", "IS", "NULL", "RECOVER", "EXPLAIN", "PROFILE", "FORMAT", "CASE"}
)
View Source
var (
	DownloadFilesKey = []byte("task:download")
)
View Source
var (
	RetrieveFilesKey = []byte("task:retrieve")
)

Functions

func RecordKey

func RecordKey(expert string) []byte

Types

type Code

type Code struct {
	Code    int64  `json:"code"`
	Message string `json:"message"`
}

type FileRef

type FileRef struct {
	ID    string `json:"id,omitempty"`
	Index int64  `json:"index,omitempty"`

	Count    int64  `json:"count,omitempty"`
	FileSize int64  `json:"file_size,omitempty"`
	CheckSum string `json:"check_sum,omitempty"`

	Expert string `json:"expert,omitempty"`

	// file saved path on node machine
	Path      string `json:"path,omitempty"`
	LocalPath string `json:"local_path,omitempty"`

	// file info
	RootCID   cid.Cid `json:"root_cid,omitempty"`
	PieceCID  cid.Cid `json:"piece_cid,omitempty"`
	PieceSize uint64  `json:"piece_size,omitempty"`

	// file download url
	Url string `json:"url,omitempty"`

	Status Status `json:"status,omitempty"`
}

func (*FileRef) Marshal

func (f *FileRef) Marshal() ([]byte, error)

func (*FileRef) Unmarshal

func (f *FileRef) Unmarshal(bytes []byte) error

type ListData

type ListData struct {
	Id       string `json:"id"`
	Expert   string `json:"expert"`
	Index    int64  `json:"index"`
	FileName string `json:"file_name"`
	FileUrl  string `json:"file_url"`
	Status   string `json:"status"`
	Count    int64  `json:"count"`
	FileSize int64  `json:"file_size"` //文件大小
	CheckSum string `json:"check_sum"` //文件md5
}

type ListResponse

type ListResponse struct {
	Code            ResponseCode
	List            []ListData
	Callback        string `json:"callback"`
	OnchainCallback string `json:"onchain_callback"`
}

type ResponseCode

type ResponseCode struct {
	Code    int64
	Message string
}

type Status

type Status uint64
const (
	FileStatusNew Status = iota

	FileStatusDownloading

	FileStatusDownloaded

	FileStatusImporting

	FileStatusImported

	FileStatusRegistering

	FileStatusRegistered

	FileStatusNeedStorage

	FileStatusStoraging

	FileStatusStoraged

	FileStatusReplaied
)

type Task

type Task interface {
	// Start tasks
	Start(context.Context) error

	// Stop tasks
	Stop(context.Context) error
}

Taskinterface

func NewTask

func NewTask(conf config.Config, st storage.Storage, bus EventBus.Bus) (Task, error)

type TaskManager

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

func (*TaskManager) Start

func (t *TaskManager) Start(ctx context.Context) error

func (*TaskManager) Stop

func (t *TaskManager) Stop(ctx context.Context) error

type WriteRecord

type WriteRecord struct {
	Domain  string
	Index   int64
	Line    int64
	History map[int64]string
}

Jump to

Keyboard shortcuts

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