upload

package
v1.0.6 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2020 License: GPL-3.0 Imports: 18 Imported by: 0

Documentation

Overview

upload implements the Archon upload protocol

Index

Constants

View Source
const (
	EncodingNone = "none"
	EncodingMxor = "mxor"
	EncodingRSa  = "RSa" // archive-optimized
	EncodingRSb  = "RSb" // browser-optimized
)

Variables

This section is empty.

Functions

func GetUploadSps

func GetUploadSps(needed int, acc interfaces.IAccount) (sps StorageProviders, err error)

GetUploadSps returns up to needed SP profiles, after marketplace filtering

func GetUploadSpsLocal

func GetUploadSpsLocal(acc interfaces.IAccount) (sps StorageProviders, err error)

GetUploadSpsLocal is for debugging only, using as SP on localhost

Types

type Messages

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

Messages collects completion messages (or errors) to be displayed at the end

func (*Messages) Add

func (m *Messages) Add(message string)

func (*Messages) Show

func (m *Messages) Show()

type Request

type Request struct {
	FilePath        string
	CloudDir        string
	Encoding        string
	NumTotal        int // needed only when EncodingRSx
	NumRequired     int // needed only when EncodingRSx
	Overwrite       bool
	HashUrl         bool // user wants a hash URL, not a named URL
	PreferHttp      bool // user prefers using http, if available
	UploaderAccount interfaces.IAccount
	Batch           bool // operate in batch mode - no user interaction
	// If 0, any payment is valid, otherwise in units of blockchain
	// Eth: Wei, Neo: Gas* (10**8)
	MaxPayment int64
}

func (*Request) IsValid

func (u *Request) IsValid() (err error)

func (*Request) TargetUrl

func (u *Request) TargetUrl(spUrl, txid string) string

func (*Request) Upload

func (u *Request) Upload() (downloadUrl string, price int64, err error)

Upload uploads the file (sharded or not) Returned price unit depends on the blockchain Eth=Wei, Neo=CGas*(10^8) The smallest unit of CGAS is 0.00000001

func (*Request) UploaderPath

func (u *Request) UploaderPath() string

Jump to

Keyboard shortcuts

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