common

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2020 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ConfigSCC is the name of the ledger configuration system chaincode
	ConfigSCC = "configscc"
)

Variables

This section is empty.

Functions

func FormatJSON

func FormatJSON(jsonBytes []byte) ([]byte, error)

FormatJSON transforms the given JSON into a displayable format

Types

type App

type App struct {
	// Name is the name of the application
	AppName string
	// Version is the version of the config
	Version string
	// Format describes the format of the data
	Format Format
	// Config contains the actual configuration
	Config string
	// Tags contains optional tags that describe the data
	Tags []string `json:",omitempty"`
	// Components zero or more component configs
	Components []*Component `json:",omitempty"`
}

App contains the configuration for an application and/or multiple sub-components.

type BaseCommand

type BaseCommand struct {
	common.Command

	FactoryProvider FactoryProvider
}

BaseCommand is the base for all commands

func NewBaseCmd

func NewBaseCmd(settings *environment.Settings, p FactoryProvider) *BaseCommand

NewBaseCmd returns a BaseCommand

func (*BaseCommand) Channel

func (c *BaseCommand) Channel() (fabric.Channel, error)

Channel returns a new SDK channel

func (*BaseCommand) Context

func (c *BaseCommand) Context() *environment.Context

Context returns the current context

func (*BaseCommand) Fprintln

func (c *BaseCommand) Fprintln(arg ...interface{}) error

Fprintln displays the given args to the configured output stream

func (*BaseCommand) FprintlnOrPanic

func (c *BaseCommand) FprintlnOrPanic(arg ...interface{})

FprintlnOrPanic displays the given args to the configured output stream. If an error occurs then this function panics.

func (*BaseCommand) Prompt

func (c *BaseCommand) Prompt() string

Prompt waits for the user to enter a string and returns the string

type Component

type Component struct {
	// Name is the name of the component
	Name string
	// Version is the version of the config
	Version string
	// Format describes the format of the data
	Format Format
	// Config contains the actual configuration
	Config string
	// Tags contains optional tags that describe the data
	Tags []string `json:",omitempty"`
}

Component contains the configuration for an application component.

type Config

type Config struct {
	// MspID is the ID of the MSP
	MspID string
	// Peers contains configuration for zero or more peers
	Peers []*Peer `json:",omitempty"`
	// Apps contains configuration for zero or more application
	Apps []*App `json:",omitempty"`
}

Config contains zero or more application configurations and zero or more peer-specific application configurations

type Criteria

type Criteria struct {
	// MspID is the ID of the MSP that owns the data
	MspID string `json:",omitempty"`

	// PeerID is the ID of the peer with which the data is associated
	PeerID string `json:",omitempty"`

	// AppName is the name of the application that owns the data
	AppName string `json:",omitempty"`

	// AppVersion is the version of the application config
	AppVersion string `json:",omitempty"`

	// ComponentName is the name of the application component
	ComponentName string `json:",omitempty"`

	// ComponentVersion is the version of the application component config
	ComponentVersion string `json:",omitempty"`
}

Criteria is used for configuration searches

type CriteriaBaseCommand

type CriteriaBaseCommand struct {
	*BaseCommand
	// contains filtered or unexported fields
}

CriteriaBaseCommand may be used as a BaseCommand for commands that use search criteria

func NewCriteriaBaseCommand

func NewCriteriaBaseCommand(settings *environment.Settings, p FactoryProvider, cmd *cobra.Command) *CriteriaBaseCommand

NewCriteriaBaseCommand returns a CriteriaBaseCommand

func (*CriteriaBaseCommand) GetConfig

func (c *CriteriaBaseCommand) GetConfig(criteria []byte) ([]byte, error)

GetConfig returns the config according to the given criteria

func (*CriteriaBaseCommand) GetCriteriaBytes

func (c *CriteriaBaseCommand) GetCriteriaBytes() ([]byte, error)

GetCriteriaBytes returns the Criteria marshalled as JSON

func (*CriteriaBaseCommand) Validate

func (c *CriteriaBaseCommand) Validate() error

Validate validates the flags

type FactoryProvider

type FactoryProvider func(config *environment.Config) (fabric.Factory, error)

FactoryProvider creates a new Factory

type Format

type Format string

Format specifies the format of the configuration

type Peer

type Peer struct {
	// PeerID is the unique ID of the peer
	PeerID string
	// Apps contains configuration for one or more application
	Apps []*App
}

Peer contains a collection of application configurations for a given peer

Jump to

Keyboard shortcuts

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