api

package
v0.4.33 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2021 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const VERSION = "1"

VERSION of config data

Variables

This section is empty.

Functions

This section is empty.

Types

type AppConfig

type AppConfig struct {
	AppName    string
	Version    string
	Config     string
	Components []ComponentConfig
}

AppConfig identifier has application name , config version

func (AppConfig) IsValid

func (ac AppConfig) IsValid() errors.Error

IsValid appconfig

type ComponentConfig added in v0.2.0

type ComponentConfig struct {
	Name    string
	Config  string
	Version string
	TxID    string
}

ComponentConfig represents app component

func (ComponentConfig) IsValid added in v0.2.0

func (cc ComponentConfig) IsValid() errors.Error

IsValid ComponentConfig

type ConfigClient

type ConfigClient interface {
	Get(stub shim.ChaincodeStubInterface, configKey *ConfigKey) (viper *viper.Viper, err error)
}

ConfigClient is used to publish messages

type ConfigKV

type ConfigKV struct {
	Key   ConfigKey
	Value []byte
}

ConfigKV represents key value struct for managing configurations

type ConfigKey

type ConfigKey struct {
	MspID            string
	PeerID           string
	AppName          string
	AppVersion       string
	ComponentName    string
	ComponentVersion string
}

ConfigKey contain mspID,peerID,appname,appversion,componentname,componentversion

func (*ConfigKey) String added in v0.2.2

func (configKey *ConfigKey) String() string

String return string value for config key

type ConfigManager

type ConfigManager interface {
	//Save configuration - The submited payload should be in form of ConfigMessage
	Save(config []byte) errors.Error
	//Get configuration - Gets configuration based on config key.
	//For the valid config key retuned array will have only one element.
	//For the config key containing only MspID all configurations for that MspID will be returned
	Get(configKey ConfigKey) ([]*ConfigKV, errors.Error)
	//Delete configuration -
	//For the valid config one config message will be deleted
	//For the config key containing only MspID all configurations for that MspID will be deleted
	Delete(configKey ConfigKey) errors.Error
}

ConfigManager is used to manage configuration in ledger(save,get,delete)

type ConfigMessage

type ConfigMessage struct {
	MspID string
	Peers []PeerConfig
	Apps  []AppConfig
}

ConfigMessage - has MSP identifier and collection of peers

func (ConfigMessage) IsValid

func (cm ConfigMessage) IsValid() errors.Error

IsValid validates config message

type ConfigService

type ConfigService interface {
	//Get returns the config bytes along with dirty flag for the given channel and config key.
	// dirty flag bool returns true only if config is updated since its last retrieval
	Get(channelID string, configKey ConfigKey) ([]byte, bool, errors.Error)
	//GetViper returns a Viper instance along with dirty fla that wraps the config for the given channel and config key.
	// If the config key doesn't exist then nil is returned.
	//dirty flag bool returns true only if config is updated since its last retrieval
	GetViper(channelID string, configKey ConfigKey, configType ConfigType) (*viper.Viper, bool, errors.Error)
}

ConfigService configuration service interface

type ConfigType added in v0.1.2

type ConfigType string

ConfigType indicates the type (format) of the configuration

const (
	// YAML indicates that the configuration is in YAML format
	YAML ConfigType = "YAML"

	// JSON indicates that the configuration is in JSON format
	JSON ConfigType = "JSON"
)

type PeerConfig

type PeerConfig struct {
	PeerID string
	App    []AppConfig
}

PeerConfig identifier has peer identifier and collection of application configurations

func (PeerConfig) IsValid

func (pc PeerConfig) IsValid() errors.Error

IsValid validates config messagegetIndexKey

Jump to

Keyboard shortcuts

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