Documentation
¶
Index ¶
- Constants
- Variables
- func CobraBool(v *viper.Viper, cmd *cobra.Command, c CobraFlag) error
- func CobraDuration(v *viper.Viper, cmd *cobra.Command, c CobraFlag) error
- func CobraInt(v *viper.Viper, cmd *cobra.Command, c CobraFlag) error
- func CobraString(v *viper.Viper, cmd *cobra.Command, c CobraFlag) error
- func CoordinatorCMD(use string) *cobra.Command
- func CreateConfigFromTemplate(t *testing.T, templateString, outputPath string, conf *SystemConfig)
- func CreateTempConfigFromTemplate(t *testing.T, cmdTemplate string, conf *SystemConfig) string
- func FullCommitterVersion() string
- func NewViperWithCoordinatorDefaults() *viper.Viper
- func NewViperWithLoadGenDefaults() *viper.Viper
- func NewViperWithLoggingDefault() *viper.Viper
- func NewViperWithQueryDefaults() *viper.Viper
- func NewViperWithServiceDefault(servicePort, monitoringPort int) *viper.Viper
- func NewViperWithSidecarDefaults() *viper.Viper
- func NewViperWithVCDefaults() *viper.Viper
- func NewViperWithVerifierDefaults() *viper.Viper
- func QueryCMD(use string) *cobra.Command
- func ReadCoordinatorYamlAndSetupLogging(v *viper.Viper, configPath string) (*coordinator.Config, error)
- func ReadLoadGenYamlAndSetupLogging(v *viper.Viper, configPath string) (*loadgen.ClientConfig, error)
- func ReadMockOrdererYamlAndSetupLogging(v *viper.Viper, configPath string) (*mock.OrdererConfig, error)
- func ReadQueryYamlAndSetupLogging(v *viper.Viper, configPath string) (*query.Config, error)
- func ReadSidecarYamlAndSetupLogging(v *viper.Viper, configPath string) (*sidecar.Config, error)
- func ReadVCYamlAndSetupLogging(v *viper.Viper, configPath string) (*vc.Config, error)
- func ReadVerifierYamlAndSetupLogging(v *viper.Viper, configPath string) (*verifier.Config, error)
- func ReadYamlAndSetupLogging(v *viper.Viper, configPath, servicePrefix string, c any) error
- func SetDefaultFlags(v *viper.Viper, cmd *cobra.Command, configPath *string) error
- func SidecarCMD(use string) *cobra.Command
- func UnitTestRunner(t *testing.T, cmd *cobra.Command, test CommandTest)
- func VcCMD(use string) *cobra.Command
- func VerifierCMD(use string) *cobra.Command
- func VersionCmd() *cobra.Command
- type CobraFlag
- type CommandTest
- type DatabaseConfig
- type ServiceEndpoints
- type SystemConfig
- type SystemEndpoints
Constants ¶
const ( CommitterVersion = "0.0.2" CommitterName = "Committer" SidecarName = "Sidecar" CoordinatorName = "Coordinator" VcName = "Validator-Committer" VerifierName = "Verifier" QueryName = "Query-Service" )
Service names and version.
Variables ¶
var ( //go:embed templates/coordinator.yaml TemplateCoordinator string //go:embed templates/mockorderingservice.yaml TemplateMockOrderer string //go:embed templates/queryexecutor.yaml TemplateQueryService string //go:embed templates/sidecar.yaml TemplateSidecar string //go:embed templates/validatorpersister.yaml TemplateVC string //go:embed templates/signatureverifier.yaml TemplateVerifier string TemplateLoadGenOnlyOrderer = templateLoadGenOnlyOrdererClient + templateLoadGenCommon TemplateLoadGenOrderer = templateLoadGenOrdererClient + templateLoadGenCommon TemplateLoadGenCommitter = templateLoadGenCommitterClient + templateLoadGenCommon TemplateLoadGenCoordinator = templateLoadGenCoordinatorClient + templateLoadGenCommon TemplateLoadGenVC = templateLoadGenVCClient + templateLoadGenCommon TemplateLoadGenVerifier = templateLoadGenVerifierClient + templateLoadGenCommon TemplateLoadGenDistributedLoadGenClient = templateLoadGenDistributedLoadGenClient + templateLoadGenCommon )
Config templates.
Functions ¶
func CobraDuration ¶
CobraDuration creates a flag of type Duration for the cmd parameter.
func CobraString ¶
CobraString creates a flag of type string for the cmd parameter.
func CoordinatorCMD ¶
CoordinatorCMD creates a coordinator command.
func CreateConfigFromTemplate ¶
func CreateConfigFromTemplate(t *testing.T, templateString, outputPath string, conf *SystemConfig)
CreateConfigFromTemplate creates a config file using template yaml and writes it to the outputPath.
func CreateTempConfigFromTemplate ¶
func CreateTempConfigFromTemplate(t *testing.T, cmdTemplate string, conf *SystemConfig) string
CreateTempConfigFromTemplate creates a temporary config file and returning the temporary output config path.
func FullCommitterVersion ¶
func FullCommitterVersion() string
FullCommitterVersion returns the committer version string.
func NewViperWithCoordinatorDefaults ¶
NewViperWithCoordinatorDefaults returns a viper instance with the coordinator default values.
func NewViperWithLoadGenDefaults ¶
NewViperWithLoadGenDefaults returns a viper instance with the load generator default values.
func NewViperWithLoggingDefault ¶
NewViperWithLoggingDefault returns a viper instance with the logging default values.
func NewViperWithQueryDefaults ¶
NewViperWithQueryDefaults returns a viper instance with the query-service default values.
func NewViperWithServiceDefault ¶
NewViperWithServiceDefault returns a viper instance with a service default values.
func NewViperWithSidecarDefaults ¶
NewViperWithSidecarDefaults returns a viper instance with the sidecar default values.
func NewViperWithVCDefaults ¶
NewViperWithVCDefaults returns a viper instance with the VC default values.
func NewViperWithVerifierDefaults ¶
NewViperWithVerifierDefaults returns a viper instance with the verifier default values.
func ReadCoordinatorYamlAndSetupLogging ¶
func ReadCoordinatorYamlAndSetupLogging(v *viper.Viper, configPath string) (*coordinator.Config, error)
ReadCoordinatorYamlAndSetupLogging reading the YAML config file of the coordinator.
func ReadLoadGenYamlAndSetupLogging ¶
func ReadLoadGenYamlAndSetupLogging(v *viper.Viper, configPath string) (*loadgen.ClientConfig, error)
ReadLoadGenYamlAndSetupLogging reading the YAML config file of the load generator.
func ReadMockOrdererYamlAndSetupLogging ¶
func ReadMockOrdererYamlAndSetupLogging(v *viper.Viper, configPath string) (*mock.OrdererConfig, error)
ReadMockOrdererYamlAndSetupLogging reading the YAML config file of the mock ordering service.
func ReadQueryYamlAndSetupLogging ¶
ReadQueryYamlAndSetupLogging reading the YAML config file of the query service.
func ReadSidecarYamlAndSetupLogging ¶
ReadSidecarYamlAndSetupLogging reading the YAML config file of the sidecar.
func ReadVCYamlAndSetupLogging ¶
ReadVCYamlAndSetupLogging reading the YAML config file of the VC.
func ReadVerifierYamlAndSetupLogging ¶
ReadVerifierYamlAndSetupLogging reading the YAML config file of the verifier.
func ReadYamlAndSetupLogging ¶
ReadYamlAndSetupLogging reading the YAML config file of a service.
func SetDefaultFlags ¶
SetDefaultFlags setting useful Cobra flags for the cmd parameter.
func UnitTestRunner ¶
func UnitTestRunner( t *testing.T, cmd *cobra.Command, test CommandTest, )
UnitTestRunner is a function that runs a unit test with the requested parameters passed in CommandTest structure.
func VerifierCMD ¶
VerifierCMD creates a verifier command.
Types ¶
type CommandTest ¶
type CommandTest struct {
Name string
Args []string
CmdLoggerOutputs []string
CmdStdOutput string
Err error
UseConfigTemplate string
System SystemConfig
}
CommandTest is a struct that represents a CMD unit test.
type DatabaseConfig ¶
type DatabaseConfig struct {
Name string
LoadBalance bool
Endpoints []*connection.Endpoint
}
DatabaseConfig represents the used DB.
type ServiceEndpoints ¶
type ServiceEndpoints struct {
Server *connection.Endpoint
Metrics *connection.Endpoint
}
ServiceEndpoints stores the server and metrics endpoints for a service.
type SystemConfig ¶
type SystemConfig struct {
// Instance endpoints.
ServiceEndpoints ServiceEndpoints
// System's resources.
Endpoints SystemEndpoints
DB DatabaseConfig
// Per service configurations.
BlockSize uint64 // orderer, loadgen
BlockTimeout time.Duration // orderer
ConfigBlockPath string // orderer, sidecar, loadgen
LedgerPath string // sidecar
Policy *workload.PolicyProfile // loadgen
LoadGenBlockLimit uint64 // loadgen
LoadGenTXLimit uint64 // loadgen
LoadGenWorkers uint64 // loadgen
Logging *logging.Config // for all
}
SystemConfig represents the configuration of the one of the committer's components.
func StartDefaultSystem ¶
func StartDefaultSystem(t *testing.T) SystemConfig
StartDefaultSystem starts a system with mocks for CMD testing.
func (*SystemConfig) WithEndpoint ¶
func (c *SystemConfig) WithEndpoint(e ServiceEndpoints) *SystemConfig
WithEndpoint creates a new SystemConfig with a modified ServerEndpoint and MetricsEndpoint.
type SystemEndpoints ¶
type SystemEndpoints struct {
Verifier []ServiceEndpoints
VCService []ServiceEndpoints
Orderer []ServiceEndpoints
Coordinator ServiceEndpoints
Sidecar ServiceEndpoints
Query ServiceEndpoints
LoadGen ServiceEndpoints
}
SystemEndpoints represents the endpoints of the system.