network

package
v0.0.0-...-95e8c34 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2022 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CheckDownloadProgressArgs

type CheckDownloadProgressArgs struct {
	Id string `json:"id"`
}

type CheckDownloadProgressReply

type CheckDownloadProgressReply struct {
	Download
	ProgressPercent int `json:"progressPercent"`
}

type Download

type Download struct {
	FinalSizeBytes int64 `json:"finalSizeBytes"`
	ProgressBytes  int64 `json:"progressBytes"`
}

func NewDownload

func NewDownload(id string, finalSizeBytes int64) *Download

func (*Download) Update

func (download *Download) Update(bytesRead int)

type DownloadArgs

type DownloadArgs struct {
	Url            string `json:"url"`
	Path           string `json:"path"`
	Id             string `json:"id"`
	TimeoutSeconds int    `json:"timeoutSeconds"`
}

type DownloadProgress

type DownloadProgress = map[string]*Download

type DownloadProgressReader

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

func NewDownloadProgressReader

func NewDownloadProgressReader(r io.Reader, ctx *context.Context, service *NetworkService, downloadId string, finalSizeBytes int64) *DownloadProgressReader

func (*DownloadProgressReader) Read

func (dpr *DownloadProgressReader) Read(b []byte) (int, error)

type DownloadReply

type DownloadReply struct {
	Status DownloadStatus `json:"status"`
}

type DownloadStatus

type DownloadStatus string
const (
	DownloadStatusSuccess DownloadStatus = "success"
	DownloadStatusTimeout                = "timeout"
)

type GetArgs

type GetArgs struct {
	Url string `json:"url"`
}

type GetReply

type GetReply struct {
	Status int    `json:"status"`
	Data   string `json:"data"`
}

type NetworkService

type NetworkService struct {
	DownloadProgress
}

func NewNetworkService

func NewNetworkService() *NetworkService

func (*NetworkService) CheckDownloadProgress

func (service *NetworkService) CheckDownloadProgress(r *http.Request, req *CheckDownloadProgressArgs, res *CheckDownloadProgressReply) error

func (*NetworkService) Download

func (service *NetworkService) Download(r *http.Request, req *DownloadArgs, res *DownloadReply) error

func (*NetworkService) Get

func (service *NetworkService) Get(r *http.Request, req *GetArgs, res *GetReply) error

Jump to

Keyboard shortcuts

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