cmd

package
v0.0.0-...-9e13da9 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2020 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

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 MatchAndRestore

func MatchAndRestore(project *uplink.Project, matchPattern string, backupPath string, latest bool, showProgress bool)

MatchAndRestore finds the databases corresponding the pattern entered by the user and restores the latest backup of each matching database.

func RestoreData

func RestoreData(project *uplink.Project, backupPath string, latest bool, showProgress bool)

RestoreData restores the latest backup correspoinding to the path provided

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, dbReader io.Reader, firstCollection string)

UploadData uploads the backup file to storj network.

Types

type ConfigMongoDB

type ConfigMongoDB struct {
	Hostname   string `json:"hostname"`
	Portnumber string `json:"port"`
	Username   string `json:"username"`
	Password   string `json:"password"`
	Database   string `json:"database"`
}

ConfigMongoDB defines the variables and types.

func LoadMongoProperty

func LoadMongoProperty(fullFileName string) ConfigMongoDB

LoadMongoProperty reads and parses the JSON file that contain a MongoDB instance's credentials. It returns all the properties embedded in a configuration 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.

type MongoReader

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

MongoReader implements an io.Reader interface

func ConnectToDB

func ConnectToDB(configMongoDB ConfigMongoDB) *MongoReader

ConnectToDB will connect to a MongoDB instance based on the specified credentials. It returns a reference to an io.Reader with MongoDB instance information

func (*MongoReader) Read

func (mongoReader *MongoReader) Read(buf []byte) (int, error)

Read reads collections' data as per the buffer capacity. It returns number of bytes (int) read and any error, if occurred. EOF error is returned after complete read.

Jump to

Keyboard shortcuts

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