cmd

package
v1.4.5 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2021 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AllFilesWithPaths []string

AllFilesWithPaths is a list to store complete path of all the hash in the IPFS. It will be used for direct transfer of files from IPFS to Storj.

View Source
var AllHash []string

AllHash is a list to store hashes of all files to store from IPFS.

Functions

func ConnectToIpfs

func ConnectToIpfs(configIpfs ConfigIpfs) *shell.Shell

ConnectToIpfs will connect to an IPFS instance based on the read property from an external file. It returns a reference to shell with IPFS instance's information.

func ConnectToStorj

func ConnectToStorj(configStorj ConfigStorj, accesskey bool) (*uplink.Access, *uplink.Project)

ConnectToStorj reads Storj configuration from given file and connects to the desired Storj network. It then reads data property from an external file.

func Execute

func Execute()

Execute adds all child commands to the root command and sets flags appropriately. This is called by main.main(). It only needs to happen once to the rootCmd.

func GetHash

func GetHash(sh *shell.Shell, hash string, path string)

GetHash retrieve the hash with the exact file structure from IPFS to the System

func GetReader

func GetReader(sh *shell.Shell, path string) io.ReadCloser

GetReader returns a Reader of corresponding file whose path is specified. io.ReadCloser type of object returned is used to perform transfer of file to Storj.

func ShareAccess

func ShareAccess(access *uplink.Access, configStorj ConfigStorj)

ShareAccess generates and prints the shareable serialized access as per the restrictions provided by the user.

func UploadData

func UploadData(project *uplink.Project, configStorj ConfigStorj, uploadFileName string, reader io.Reader)

UploadData uploads the backup file to storj network.

Types

type ConfigIpfs

type ConfigIpfs struct {
	HostName string `json:"hostName"`
	Port     string `json:"port"`
	Hash     string `json:"hash"`
}

ConfigIpfs defines the variables and types for login.

func LoadIpfsProperty

func LoadIpfsProperty(fullFileName string) ConfigIpfs

LoadIpfsProperty reads and parses the JSON file that contains a IPFS instance's properties and returns all the properties as an object.

type ConfigStorj

type ConfigStorj struct {
	APIKey               string `json:"apikey"`
	Satellite            string `json:"satellite"`
	Bucket               string `json:"bucket"`
	UploadPath           string `json:"uploadPath"`
	EncryptionPassphrase string `json:"encryptionpassphrase"`
	SerializedAccess     string `json:"serializedAccess"`
	AllowDownload        string `json:"allowDownload"`
	AllowUpload          string `json:"allowUpload"`
	AllowList            string `json:"allowList"`
	AllowDelete          string `json:"allowDelete"`
	NotBefore            string `json:"notBefore"`
	NotAfter             string `json:"notAfter"`
}

ConfigStorj depicts keys to search for within the stroj_config.json file.

func LoadStorjConfiguration

func LoadStorjConfiguration(fullFileName string) ConfigStorj

LoadStorjConfiguration reads and parses the JSON file that contain Storj configuration information.

Jump to

Keyboard shortcuts

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