setup

package
v0.2.0-fix-docker Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2021 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WriteConfigAsYaml

func WriteConfigAsYaml(configObject interface{}, configYamlFile string) error

WriteConfigAsYaml writes the config object to a YAML file. Provide full path with .yml suffix.

func WriteLocalConfig

func WriteLocalConfig(localConfig *config.LocalConfiguration, localConfigYamlFile string) error

WriteLocalConfig writes the local config object to a YAML file. Provide full path with .yml suffix.

func WriteSharedConfig

func WriteSharedConfig(sharedConfig *config.SharedConfiguration, sharedConfigYamlFile string) error

WriteSharedConfig writes the shared config object to a YAML file. Provide full path with .yml suffix.

Types

type Cluster

type Cluster struct {
	Servers []*Server
	Users   []string
	// contains filtered or unexported fields
}

Cluster holds bcdb servers present in a blockchainDB cluster

func NewCluster

func NewCluster(conf *Config) (*Cluster, error)

NewCluster creates a new cluster environment for the blockchain database

func (*Cluster) Restart

func (c *Cluster) Restart() error

Restart restarts the cluster by shutting down and starting all servers in the cluster

func (*Cluster) RestartServer

func (c *Cluster) RestartServer(s *Server) error

RestartServer restarts a given server present in the cluster by shutting down and restarting the server

func (*Cluster) Shutdown

func (c *Cluster) Shutdown() error

Shutdown shuts the cluster down by shutting down all servers in the cluster

func (*Cluster) ShutdownAndCleanup

func (c *Cluster) ShutdownAndCleanup() error

ShutdownAndCleanup shuts the cluster down by shutting down all servers in the cluster and removes all directories

func (*Cluster) ShutdownServer

func (c *Cluster) ShutdownServer(s *Server) error

ShutdownServer shuts a given server present in the cluster down

func (*Cluster) Start

func (c *Cluster) Start() error

Start starts the cluster by starting all servers in the cluster

func (*Cluster) StartServer

func (c *Cluster) StartServer(s *Server) error

StartServer stars a given server present in the cluster

type Config

type Config struct {
	NumberOfServers     int
	TestDirAbsolutePath string
	BDBBinaryPath       string
	CmdTimeout          time.Duration
	BaseNodePort        uint32
	BasePeerPort        uint32
	CheckRedirectFunc   func(req *http.Request, via []*http.Request) error // rest client checks redirects
}

Config holds configuration detail needed to instantiate a cluster

type Server

type Server struct {
	// contains filtered or unexported fields
}

Server holds parameters related to the server

func NewServer

func NewServer(id uint64, clusterBaseDir string, baseNodePort, basePeerPort uint32, checkRedirect func(req *http.Request, via []*http.Request) error, logger *logger.SugarLogger) (*Server, error)

NewServer creates a new blockchain database server

func (*Server) AdminID

func (s *Server) AdminID() string

func (*Server) AdminSigner

func (s *Server) AdminSigner() crypto.Signer

func (*Server) NewRESTClient

func (s *Server) NewRESTClient(checkRedirect func(req *http.Request, via []*http.Request) error) (*mock.Client, error)

NewRESTClient creates a new REST client for the user to submit requests and transactions to the server

func (*Server) QueryConfig

func (s *Server) QueryConfig(t *testing.T) (*types.GetConfigResponseEnvelope, error)

func (*Server) QueryData

func (s *Server) QueryData(t *testing.T, db, key string) (*types.GetDataResponseEnvelope, error)

func (*Server) URL

func (s *Server) URL() string

func (*Server) WriteDataTx

func (s *Server) WriteDataTx(t *testing.T, db, key string, value []byte) (string, *types.TxReceipt, error)

Jump to

Keyboard shortcuts

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