common

package
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2021 License: Apache-2.0 Imports: 8 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 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 {
	*basecmd.Command
	// 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 basecmd.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 Format

type Format string

Format specifies the format of the configuration

type Key added in v0.1.3

type Key struct {
	// MspID is the ID of the MSP that owns the data
	MspID string
	// PeerID is the (optional) 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
	// AppVersion is the version of the application config
	AppVersion string
	// ComponentName is the (optional) name of the application component
	ComponentName string `json:",omitempty"`
	// ComponentVersion is the (optional) version of the application component config
	ComponentVersion string `json:",omitempty"`
}

Key is used to uniquely identify a specific application configuration and is used as the key when persisting to a state store.

func (*Key) String added in v0.1.3

func (k *Key) String() string

String returns a readable string for the key

type KeyValue added in v0.1.3

type KeyValue struct {
	*Key
	*Value
}

KeyValue contains the key and the value for the key

func (*KeyValue) String added in v0.1.3

func (kv *KeyValue) String() string

String returns a readable string for the key-value

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

type Value added in v0.1.3

type Value struct {
	// TxID is the ID of the transaction in which the config was stored/updated
	TxID string
	// Format describes the format (type) of the config data
	Format Format
	// Config contains the actual configuration
	Config string
	// Tags contains an optional set of tags that describe the data
	Tags []string
}

Value contains the configuration data and is persisted as a JSON document in the store.

func (*Value) String added in v0.1.3

func (v *Value) String() string

String returns a readable string for the value

Jump to

Keyboard shortcuts

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