config

package
v0.0.0-...-e275e56 Latest Latest
Warning

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

Go to latest
Published: May 21, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrCfgBytesEmpty = errors.New("config bytes is empty")

	ErrAdminSKIEmpty          = "'adminSKI' is empty"
	ErrInvalidAdminSKI        = "'adminSKI' (index of args 0) is invalid - format found '%s' but expected hex encoded string"
	ErrValidatorsCountEmpty   = "'validatorsCount' is empty"
	ErrInvalidValidatorsCount = "'validatorsCount' (index of args 1) is invalid - format found '%s' but expected value with type int"
	ErrValidatorsEmpty        = "'validator #'%d'' is empty"
	ErrParsingArgsOld         = "init: parsing args old way: %s"
	ErrSavingConfig           = "init: saving config: %s"
	ErrArgsLessThanMin        = "minimum required args length is '%d', passed %d"
)

Functions

func GetConfig

func GetConfig(stub shim.ChaincodeStubInterface) (*proto.ACLConfig, error)

GetConfig returns config from state

func IsJSONConfig

func IsJSONConfig(args []string) bool

IsJSONConfig checks if the provided arguments represent a valid JSON configuration.

The function returns true if there is exactly one argument in the initialization args slice, and if the content of that argument is a valid JSON.

func ParseArgsArr

func ParseArgsArr(args []string) (*proto.ACLConfig, error)

ParseArgsArr parses positional initialization arguments and generates JSON-config of []byte type. Accepts the channel name (chaincode) and the list of positional initialization parameters. Only needed to maintain backward compatibility. Marked for deletion after all deploy tools will be switched to JSON-config initialization of chaincodes. ToDo - need to be deleted after switching to json-config initialization

func SaveConfig

func SaveConfig(stub shim.ChaincodeStubInterface, cfgBytes []byte) error

SaveConfig saves configuration data to the state using the provided State interface.

If the provided cfgBytes slice is empty, the function returns an ErrCfgBytesEmpty error.

If there is an error while saving the data to the state, an error is returned with additional information about the error.

func SetConfig

func SetConfig(stub shim.ChaincodeStubInterface) error

Types

This section is empty.

Jump to

Keyboard shortcuts

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