cli

package
v0.2.10 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package cli builds the fxadmin command tree. fxadmin administers the configuration of Fabric-X: it pulls the current configuration from the running network, decodes it, computes and endorses a configuration update, wraps it into a submittable transaction, submits it, and follows the assembler ledger until the change is committed.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CLI

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

CLI is the fxadmin command-line application. It owns the kingpin command tree and a dispatch table mapping each command to a closure that invokes the corresponding Handlers method with the bound values.

func New

func New(handlers Handlers, version string) *CLI

New builds the fxadmin CLI around the given handlers. The version string is surfaced through the --version flag. No command is executed until Run is called.

func (*CLI) Run

func (c *CLI) Run(args []string) error

Run parses args and executes the selected command via its handler.

type DecodeHandler

type DecodeHandler interface {
	Run(blockPath, outputPath string) error
}

DecodeHandler executes `fxadmin decode`.

type FollowHandler

type FollowHandler interface {
	Run(configPath, currentBlockPath, outputPath string, timeout time.Duration) error
}

FollowHandler executes `fxadmin follow`.

type Handlers

type Handlers struct {
	Ledger LedgerHandler
	Decode DecodeHandler
	Update UpdateHandler
	Tx     TxHandler
	Follow FollowHandler
	Modify ModifyHandler
}

Handlers groups the per-command handlers the CLI dispatches to. It is assembled by the caller (main) from the per-command core packages.

type LedgerHandler

type LedgerHandler interface {
	Height(configPath, currentBlockPath string) error
	Block(configPath, currentBlockPath, reference, outputPath string) error
	Config(configPath, currentBlockPath, reference, outputPath string) error
}

LedgerHandler executes the `fxadmin ledger` subcommands.

type ModifyHandler added in v0.2.10

type ModifyHandler interface {
	AppAdd(orgPath, blockPath string) error
	AppRemove(org, blockPath string) error
	AppKnownCertsAdd(org string, certPaths []string, blockPath string) error
	AppKnownCertsRemove(org string, certPaths []string, blockPath string) error
	PartyAdd(partyPath, blockPath string) error
	PartyRemove(partyID uint32, blockPath string) error
	PartyNode(ch change.Node) error
	PartyCA(ch change.CA) error
}

ModifyHandler executes the `fxadmin modify` subcommands, which apply a structured configuration change directly to a config block file.

type TxHandler

type TxHandler interface {
	Endorse(inputPath, configPath, outputPath string) error
	Merge(inputPaths []string, outputPath string) error
	Prepare(inputPath, configPath, outputPath string) error
	Submit(inputPath, configPath, currentBlockPath string) error
	Send(inputPath, configPath, currentBlockPath, outputPath string) error
}

TxHandler executes the `fxadmin tx` subcommands.

type UpdateHandler

type UpdateHandler interface {
	Run(currentPath, modifiedPath, currentBlockPath, outputPath string) error
	RunFromBlocks(currentBlockPath, nextBlockPath, outputPath string) error
}

UpdateHandler executes `fxadmin compute-update` in its two modes: JSON mode (Run) diffs two decoded-config JSON files, block mode (RunFromBlocks, the --pb flag) diffs two config block files.

Jump to

Keyboard shortcuts

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