storageProvider

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: 37 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StorageRoot    = "www"
	ShardsFolder   = "shards"
	HashesFolder   = "hashes"
	LogFolder      = "log"
	ActivityFolder = "activity"
)

Variables

View Source
var PortsUsed []int
View Source
var SPAccount struct {
	Eth *account.EthAccount
	Neo *account.NeoAccount
}

The Storage Provider account

View Source
var StartTime time.Time

For info only

Functions

func AnnounceToDht

func AnnounceToDht(shard, layerId string) (err error)

func ApiPorts

func ApiPorts(conf *Configuration) (ports []int)

func ApiRouter

func ApiRouter() *mux.Router

ApiRouter sets up API routing

func GetAccount

func GetAccount(accT interfaces.AccountType) interfaces.IAccount

func GetActivityFolder

func GetActivityFolder() string

func GetDownloadUrlsForShard

func GetDownloadUrlsForShard(shard string) (mergedUrls []string, err error)

GetDownloadUrlsForShard returns download URLs that have store this shard. Ignores errors

func GetHashesFolder

func GetHashesFolder() string

func GetLogFilePath

func GetLogFilePath() string

func GetSPProfiles

func GetSPProfiles(layer pl.PermissionLayerID) (StorageProviders, error)

func GetShardsFolder

func GetShardsFolder() string

func InHashesFolder

func InHashesFolder(paths ...string) string

func InRootFolder

func InRootFolder(paths ...string) string

func InShardsFolder

func InShardsFolder(paths ...string) string

func ProcessArgs

func ProcessArgs()

func RecordActivity

func RecordActivity(a *ActivityInfo)

func RelativeToRoot

func RelativeToRoot(absPath string) string

func RunWebServer

func RunWebServer() (err error)

RunWebServer starts the web servers

func SetupAccountAndDht

func SetupAccountAndDht()

func StoredFilePath

func StoredFilePath(a *ArchonUrl, shardIndex int) string

StoredFilePath returns the path where the file is stored on the server If shardIndex is negative, this is a whole file

func VerifyPendingUploads

func VerifyPendingUploads()

VerifyPendingUploads checks previously uploaded files for validity and removes them if not valid

Types

type ActivityInfo

type ActivityInfo struct {
	Upload   bool
	Url      *ArchonUrl
	Client   string
	NumBytes int64
}

type Configuration

type Configuration struct {
	HttpPort      string `json:"http_port,omitempty"` // obsolete
	EthWalletPath string `json:"eth_wallet_path"`
	NeoWalletPath string `json:"neo_wallet_path"`
	Host          string `json:"host"` // DNS or IP
	Port          string `json:"port"` // the first of a consecutive range of 6 or more
	LogLevel      string `json:"log_level"`
	// The following can only be edited manually
	EthRpcUrls        []string `json:"eth_rpc_urls"`
	NeoRpcUrls        []string `json:"neo_rpc_urls"`
	BootstrapPeers    []string `json:"bootstrap_peers"`
	EthBootstrapPeers []string `json:"eth_bootstrap_peers"`
	NeoBootstrapPeers []string `json:"neo_bootstrap_peers"`
}

func GetSPConfiguration

func GetSPConfiguration() *Configuration

GetSPConfiguration returns the current configuration

func (*Configuration) String

func (c *Configuration) String() string

type RegisterCommand

type RegisterCommand struct {
}

func (*RegisterCommand) Execute

func (x *RegisterCommand) Execute(args []string) error

type StatsResponse

type StatsResponse struct {
	TotalStored string
	Eth         struct {
		TotalPledged string `json:",omitempty"`
	} `json:",omitempty"`
	Neo struct {
		TotalPledged string `json:",omitempty"`
	} `json:",omitempty"`
}

type UnregisterCommand

type UnregisterCommand struct {
}

func (*UnregisterCommand) Execute

func (x *UnregisterCommand) Execute(args []string) error

Jump to

Keyboard shortcuts

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