command

package
v1.7.6 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2024 License: GPL-3.0 Imports: 31 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DebugCommandPrefix             = "gfsp-cli-debug-"
	DefaultMaxSegmentPieceSize     = 16 * 1024 * 1024
	DefaultRedundantDataChunkNum   = 4
	DefaultRedundantParityChunkNum = 2
)
View Source
const (
	MaxRecoveryTime = 50

	MaxRecoveryJob            = 1000
	MaxCurrentRecoveryObjects = 500
	FullQueueWaitTime         = 5 * time.Second
	RecoveryJobSyncTime       = 30 * time.Second
)
View Source
const (
	ProcessStatus_Recovering = "Recovering"
	ProcessStatus_Verifying  = "Verifying"
	ProcessStatus_Complete   = "Successful"
)
View Source
const (
	DefaultConfigFile = "./config.toml"
)
View Source
const (
	GfSpCliUserName = "gfsp-cli"
)

Variables

View Source
var CancelSwapInCmd = &cli.Command{
	Action: CancelSwapInAction,
	Name:   "cancelSwapIn",
	Usage:  "cancel swap in",
	Flags: []cli.Flag{
		utils.ConfigFileFlag,
		gvgIDFlag,
		vgfIDFlag,
	},
	Category: swapInCommands,
}
View Source
var ChallengePieceCmd = &cli.Command{
	Action: CW.challengePieceAction,
	Name:   "challenge.piece",
	Usage:  "Challenge piece integrity hash",
	Flags: []cli.Flag{
		utils.ConfigFileFlag,
		objectIDFlag,
		redundancyIdxFlag,
		segmentIdxFlag,
	},
	Category:    queryCommands,
	Description: `The challenge.piece command send rpc request to downloader, get integrity meta and check the piece checksums.`,
}
View Source
var CompleteSPExitCmd = &cli.Command{
	Name:  "sp.complete.exit",
	Usage: "Only used in debugging scenarios, online use not allowed. Used for sp complete exits from the Greenfield storage network.",
	Description: `Using this command, it will send an transaction to Greenfield blockchain to tell this SP is prepared ` +
		`to complete exit from Greenfield storage network.`,
	Category: migrateCommands,
	Action:   CW.completeSPExit,
	Flags: []cli.Flag{
		spOperatorAddressFlag,
	},
}
View Source
var CompleteSpExitCmd = &cli.Command{
	Action: CompleteSpExitAction,
	Name:   "completeSpExit",
	Usage:  "complete sp exit",
	Flags: []cli.Flag{
		utils.ConfigFileFlag,
	},
	Category:    spExitCommands,
	Description: `When Successor has recovered all resources, you can use this CMD to complete the exit`,
}
View Source
var CompleteSwapInCmd = &cli.Command{
	Action: CompleteSwapInAction,
	Name:   "completeSwapIn",
	Usage:  "complete swap in",
	Flags: []cli.Flag{
		utils.ConfigFileFlag,
		gvgIDFlag,
		vgfIDFlag,
	},
	Category:    swapInCommands,
	Description: `After confirming that the recover resource is complete, send a complete swap in to the chain using the completeSwapIn command`,
}
View Source
var CompleteSwapOutCmd = &cli.Command{
	Name:  "sp.complete.swapout",
	Usage: "Only used in debugging scenarios, online use not allowed. Used for swap out from the Greenfield storage network.",
	Description: `Using this command, it will send an transaction to Greenfield blockchain to tell this SP is prepared ` +
		`to swap out from Greenfield storage network.`,
	Category: migrateCommands,
	Action:   CW.completeSwapOut,
	Flags: []cli.Flag{
		spOperatorAddressFlag,
		swapOutFamilyID,
		swapOutGVGIDList,
	},
}
View Source
var ConfigDumpCmd = &cli.Command{
	Action:      dumpConfigAction,
	Name:        "config.dump",
	Usage:       "Dump default configuration to the './config.toml' file for editing",
	Category:    "CONFIG COMMANDS",
	Description: `The config.dump command writes default configuration values to ./config.toml file for editing.`,
}

ConfigDumpCmd is used to dump default config.toml template.

View Source
var DebugCreateBucketApprovalCmd = &cli.Command{
	Action: CW.createBucketApproval,
	Name:   "debug.create.bucket.approval",
	Usage:  "Create random CreateBucketApproval and send to approver for debugging and testing",
	Flags: []cli.Flag{
		utils.ConfigFileFlag,
	},
	Category: debugCommands,
	Description: `The debug.create.bucket.approval command create a random CreateBucketApproval request and send it ` +
		`to approver for debugging and testing the approver on Dev Env.`,
}
View Source
var DebugCreateObjectApprovalCmd = &cli.Command{
	Action: CW.createObjectApproval,
	Name:   "debug.create.object.approval",
	Usage:  "Create random CreateObjectApproval and send to approver for debugging and testing",
	Flags: []cli.Flag{
		utils.ConfigFileFlag,
	},
	Category: debugCommands,
	Description: `The debug.create.object.approval command create a random CreateObjectApproval request and send it ` +
		`to approver for debugging and testing the approver on Dev Env.`,
}
View Source
var DebugPutObjectCmd = &cli.Command{
	Action: CW.putObjectAction,
	Name:   "debug.put.object",
	Usage:  "Create random ObjectInfo and send to uploader for debugging and testing uploading primary sp",
	Flags: []cli.Flag{
		utils.ConfigFileFlag,
		fileFlag,
	},
	Category: debugCommands,
	Description: `The debug.put.object command create a random ObjectInfo and send it to uploader for debugging and ` +
		`testing upload primary sp on Dev Env.`,
}
View Source
var DebugReplicateApprovalCmd = &cli.Command{
	Action: CW.replicatePieceApprovalAction,
	Name:   "debug.replicate.approval",
	Usage:  "Create random ObjectInfo and send to p2p for debugging and testing p2p protocol network",
	Flags: []cli.Flag{
		utils.ConfigFileFlag,
		numberFlag,
	},
	Category: debugCommands,
	Description: `The debug.ask.replicate.approval command create a random ObjectInfo and send it to p2p node for ` +
		`debugging and testing p2p protocol network on Dev Env.`,
}
View Source
var GetObjectCmd = &cli.Command{
	Action: CW.getObjectAction,
	Name:   "get.object",
	Usage:  "Get object payload data",
	Flags: []cli.Flag{
		utils.ConfigFileFlag,
		objectIDFlag,
	},
	Category:    queryCommands,
	Description: `The get.object command send rpc request to downloader server to get object payload data.`,
}
View Source
var GetSegmentIntegrityCmd = &cli.Command{
	Action: CW.getSegmentIntegrityAction,
	Name:   "get.piece.integrity",
	Usage:  "Get piece integrity hash and signature",
	Flags: []cli.Flag{
		utils.ConfigFileFlag,
		objectIDFlag,
	},
	Category:    queryCommands,
	Description: `The get.segment.integrity command send rpc request to spdb, get integrity hash and signature.`,
}
View Source
var ListErrorsCmd = &cli.Command{
	Action:      listErrorsAction,
	Name:        "list.errors",
	Usage:       "List the predefine errors in greenfield storage provider",
	Category:    queryCommands,
	Description: `The list command output the services in greenfield storage provider.`,
}
View Source
var ListGlobalVirtualGroupsBySecondarySPCmd = &cli.Command{
	Action: ListGlobalVirtualGroupsBySecondarySPAction,
	Name:   "query-gvg-by-sp",
	Usage:  "get GlobalVirtualGroups List By SecondarySP",
	Flags: []cli.Flag{
		utils.ConfigFileFlag,
		targetSPIDFlag,
	},
	Category:    swapInCommands,
	Description: `get GlobalVirtualGroups List By SecondarySP`,
}
View Source
var ListModulesCmd = &cli.Command{
	Action:      listModulesAction,
	Name:        "list.modules",
	Usage:       "List the modules in greenfield storage provider",
	Category:    queryCommands,
	Description: `The list command output the services in greenfield storage provider.`,
}
View Source
var ListVirtualGroupFamiliesBySpIDCmd = &cli.Command{
	Action: ListVirtualGroupFamiliesBySpIDAction,
	Name:   "query-vgf-by-sp",
	Usage:  "get VirtualGroupFamily List By SpID",
	Flags: []cli.Flag{
		utils.ConfigFileFlag,
		targetSPIDFlag,
	},
	Category:    swapInCommands,
	Description: `get VirtualGroupFamily List By SpID`,
}
View Source
var P2PCreateKeysCmd = &cli.Command{
	Action: p2pCreateKeysAction,
	Name:   "p2p.create.key",
	Usage:  "Create Secp256k1 key pairs for encrypting p2p protocol msg and identifying p2p node",
	Flags: []cli.Flag{
		numberFlag,
	},
	Category: "P2P COMMANDS",
	Description: `The p2p.create.key creates 'n' sets of Secp256k1 key pairs, each key pair contains a private key and ` +
		`a node id, the private key is used to encrypt p2p protocol msg, and the node id is use to public to other p2p ` +
		`nodes for communication by p2p protocol.`,
}
View Source
var QueryBucketMigrateCmd = &cli.Command{
	Action: CW.getBucketMigrateAction,
	Name:   "query.bucket.migrate",
	Usage:  "Query bucket migrate plan and status",
	Flags: []cli.Flag{
		utils.ConfigFileFlag,
		endpointFlag,
	},
	Category:    queryCommands,
	Description: `The query.bucket.migrate command send rpc request to manager get plan and status.`,
}
View Source
var QueryPrimarySPIncomeCmd = &cli.Command{
	Action: CW.getPrimarySPIncomeAction,
	Name:   "query.primary.sp.income",
	Usage:  "Query primary sp income details",
	Flags: []cli.Flag{
		utils.ConfigFileFlag,
		spIDFlag,
	},
	Category:    queryCommands,
	Description: `The query.primary.sp.income command send rpc request to metadata, get the primary sp incomes details for the current timestamp`,
}
View Source
var QueryRecoverProcessCmd = &cli.Command{
	Action: QueryRecoverProcessAction,
	Name:   "query-recover-p",
	Usage:  "query recover process",
	Flags: []cli.Flag{
		utils.ConfigFileFlag,
		gvgIDFlag,
		vgfIDFlag,
	},
	Category:    swapInCommands,
	Description: `It is used to query the recovery resource progress. The progress is displayed in std and recover_process.json`,
}
View Source
var QuerySPExitCmd = &cli.Command{
	Action: CW.getSPExitAction,
	Name:   "query.sp.exit",
	Usage:  "Query sp exit swap plan and migrate gvg task status",
	Flags: []cli.Flag{
		utils.ConfigFileFlag,
		endpointFlag,
	},
	Category:    queryCommands,
	Description: `The query.sp.exit command send rpc request to manager, get sp exit swap plan and migrate gvg task status.`,
}
View Source
var QuerySecondarySPIncomeCmd = &cli.Command{
	Action: CW.getSecondarySPIncomeAction,
	Name:   "query.secondary.sp.income",
	Usage:  "Query secondary sp income details",
	Flags: []cli.Flag{
		utils.ConfigFileFlag,
		spIDFlag,
	},
	Category:    queryCommands,
	Description: `The query.secondary.sp.income command send rpc request to metadata, get the secondary sp incomes details for the current timestamp`,
}
View Source
var QueryTaskCmd = &cli.Command{
	Action:   CW.queryTasksAction,
	Name:     "query.task",
	Usage:    "Query running tasks in modules by task sub key",
	Category: queryCommands,
	Flags: []cli.Flag{
		utils.ConfigFileFlag,
		endpointFlag,
		keyFlag,
	},
	Description: `Query running tasks in modules by task sub key, show the tasks that task key contains the inout key detail info`,
}
View Source
var RecoverGVGCmd = &cli.Command{
	Action: RecoverGVGAction,
	Name:   "recover-gvg",
	Usage:  "recover object in gvg",
	Flags: []cli.Flag{
		utils.ConfigFileFlag,
		gvgIDFlag,
	},
	Category: swapInCommands,
	Description: `After determining a successful successor you can use the "recover-gvg" CMD` +
		`This command notifies sp and causes sp to recover resource` +
		`Resources include all resources that exit sp serves as the secondary sp in gvg`,
}
View Source
var RecoverObjectCmd = &cli.Command{
	Action: recoverObjectAction,
	Name:   "recover.object",
	Usage:  "Generate recover piece data tasks to recover the object data",

	Flags: []cli.Flag{
		utils.ConfigFileFlag,
		bucketFlag,
		objectFlag,
		objectListFlag,
	},
	Category:    recoveryCommands,
	Description: `The recover.object command is used to recover the object data on the primarySP or the secondary SP.`,
}
View Source
var RecoverPieceCmd = &cli.Command{
	Action: recoverPieceAction,
	Name:   "recover.piece",
	Usage:  "Generate recover piece data task to recover the object piece",
	Flags: []cli.Flag{
		utils.ConfigFileFlag,
		bucketFlag,
		objectFlag,
		segmentIdxFlag,
	},
	Category:    recoveryCommands,
	Description: `The recover.piece command is used to recover the object piece data on the primarySP or the secondary SP.`,
}
View Source
var RecoverVGFCmd = &cli.Command{
	Action: RecoverVGFAction,
	Name:   "recover-vgf",
	Usage:  "recover objects in vgf",
	Flags: []cli.Flag{
		utils.ConfigFileFlag,
		vgfIDFlag,
	},
	Category: swapInCommands,
	Description: `After determining a successful successor you can use the "recover-gvg" CMD` +
		`This command notifies sp and causes sp to recover resource` +
		`Resources include all resources that exit sp serves as the primary sp in gvg family`,
}
View Source
var SPExitCmd = &cli.Command{
	Name:  "sp.exit",
	Usage: "Used for sp exits from the Greenfield storage network",
	Description: `Using this command, it will send an transaction to Greenfield blockchain to tell this SP is prepared ` +
		`to exit from Greenfield storage network.`,
	Category: migrateCommands,
	Action:   CW.spExit,
	Flags: []cli.Flag{
		spOperatorAddressFlag,
	},
}
View Source
var SetQuotaCmd = &cli.Command{
	Action: updateFreeQuotaAction,
	Name:   "update.quota",
	Usage:  "Update the free quota of the SP",
	Flags: []cli.Flag{
		utils.ConfigFileFlag,
		freeQuotaFlag,
	},
	Category: "QUOTA COMMANDS",
	Description: `The update.quota command is used to update the free quota of the SP on greenfield chain, it will ` +
		`send a txn to the chain to finish the updating.`,
}
View Source
var SpExitCmd = &cli.Command{
	Action: SpExitAction,
	Name:   "spExit",
	Usage:  "sp exit",
	Flags: []cli.Flag{
		utils.ConfigFileFlag,
	},
	Category:    spExitCommands,
	Description: `Running this command sends exit tx to the chain and cannot be canceled after execution`,
}
View Source
var SwapInCmd = &cli.Command{
	Action: SwapInAction,
	Name:   "swapIn",
	Usage:  "Successor swap in GVG/VGF",
	Flags: []cli.Flag{
		utils.ConfigFileFlag,
		gvgIDFlag,
		vgfIDFlag,
		targetSPIDFlag,
	},
	Category: swapInCommands,
	Description: `You can use this command if you know that an sp is exiting and are ready to take over` +
		`This command is for the transaction that sends a Swap In the chain`,
}

Functions

func CancelSwapInAction added in v1.3.0

func CancelSwapInAction(ctx *cli.Context) error

func CompleteSpExitAction added in v1.3.0

func CompleteSpExitAction(ctx *cli.Context) error

func CompleteSwapInAction added in v1.3.0

func CompleteSwapInAction(ctx *cli.Context) error

func ListGlobalVirtualGroupsBySecondarySPAction added in v1.3.0

func ListGlobalVirtualGroupsBySecondarySPAction(ctx *cli.Context) error

func ListVirtualGroupFamiliesBySpIDAction added in v1.3.0

func ListVirtualGroupFamiliesBySpIDAction(ctx *cli.Context) error

func QueryRecoverProcessAction added in v1.3.0

func QueryRecoverProcessAction(ctx *cli.Context) error

func RecoverGVGAction added in v1.3.0

func RecoverGVGAction(ctx *cli.Context) error

func RecoverVGFAction added in v1.3.0

func RecoverVGFAction(ctx *cli.Context) error

func SpExitAction added in v1.3.0

func SpExitAction(ctx *cli.Context) error

func SwapInAction added in v1.3.0

func SwapInAction(ctx *cli.Context) error

Types

type CMDWrapper added in v0.2.5

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

CMDWrapper defines cmd wrapper.

var CW CMDWrapper

type FailedRecoverObject added in v1.3.0

type FailedRecoverObject struct {
	ObjectId        uint64 `protobuf:"varint,1,opt,name=object_id,json=objectId,proto3" json:"object_id,omitempty"`
	VirtualGroupId  uint32 `protobuf:"varint,2,opt,name=virtual_group_id,json=virtualGroupId,proto3" json:"virtual_group_id,omitempty"`
	RedundancyIndex int32  `protobuf:"varint,3,opt,name=redundancy_index,json=redundancyIndex,proto3" json:"redundancy_index,omitempty"`
	RetryTime       int32  `protobuf:"varint,4,opt,name=retry_time,json=retryTime,proto3" json:"retry_time,omitempty"`
}

type ProcessResult added in v1.3.0

type ProcessResult struct {
	VirtualGroupId         uint32                 `json:"virtual_group_id"`
	VirtualGroupFamilyId   uint32                 `json:"virtual_group_family_id"`
	RedundancyIndex        int32                  `json:"redundancy_index"`
	StartAfter             uint64                 `json:"start_after"`
	Limit                  uint64                 `json:"limit"`
	Status                 string                 `json:"status"`
	ObjectCount            uint64                 `json:"object_count"`
	FailedObjectTotalCount uint64                 `json:"failed_object_total_count"`
	RecoverFailedObject    []*FailedRecoverObject `json:"recover_failed_object"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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