Documentation
¶
Index ¶
- func WriteConfigAsYaml(configObject interface{}, configYamlFile string) error
- func WriteLocalConfig(localConfig *config.LocalConfiguration, localConfigYamlFile string) error
- func WriteSharedConfig(sharedConfig *config.SharedConfiguration, sharedConfigYamlFile string) error
- type Cluster
- func (c *Cluster) AgreedHeight(t *testing.T, expectedBlockHeight uint64, activeServers ...int) bool
- func (c *Cluster) AgreedLeader(t *testing.T, activeServers ...int) int
- func (c *Cluster) CreateUserCerts(user string, keyPair tls.Certificate) error
- func (c *Cluster) GetLogger() *logger.SugarLogger
- func (c *Cluster) GetServerByID(serverID string) (*Server, int)
- func (c *Cluster) GetSigner(userID string) (crypto.Signer, error)
- func (c *Cluster) GetUserCertDir() string
- func (c *Cluster) GetUserCertKeyPath(userID string) (string, string)
- func (c *Cluster) GetX509KeyPair() (tls.Certificate, error)
- func (c *Cluster) Restart() error
- func (c *Cluster) RestartServer(s *Server) error
- func (c *Cluster) Shutdown() error
- func (c *Cluster) ShutdownAndCleanup() error
- func (c *Cluster) ShutdownServer(s *Server) error
- func (c *Cluster) Start() error
- func (c *Cluster) StartServer(s *Server) error
- type Config
- type Server
- func (s *Server) AdminID() string
- func (s *Server) AdminSigner() crypto.Signer
- func (s *Server) ConfigDir() string
- func (s *Server) CreateUsers(t *testing.T, users []*types.UserWrite) (*types.TxReceipt, error)
- func (s *Server) GetDBIndex(t *testing.T, dbName string, userID string) (*types.GetDBIndexResponseEnvelope, error)
- func (s *Server) GetDBStatus(t *testing.T, dbName string) (*types.GetDBStatusResponseEnvelope, error)
- func (s *Server) ID() string
- func (s *Server) NewRESTClient(checkRedirect func(req *http.Request, via []*http.Request) error) (*mock.Client, error)
- func (s *Server) QueryBlockStatus(t *testing.T) (*types.GetBlockResponseEnvelope, error)
- func (s *Server) QueryClusterStatus(t *testing.T) (*types.GetClusterStatusResponseEnvelope, error)
- func (s *Server) QueryConfig(t *testing.T) (*types.GetConfigResponseEnvelope, error)
- func (s *Server) QueryData(t *testing.T, db, key string) (*types.GetDataResponseEnvelope, error)
- func (s *Server) QueryUser(t *testing.T, userID string) (*types.GetUserResponseEnvelope, error)
- func (s *Server) SetConfigTx(t *testing.T, newConfig *types.ClusterConfig, version *types.Version, ...) (string, *types.TxReceipt, error)
- func (s *Server) Signer(userID string) (crypto.Signer, error)
- func (s *Server) SubmitTransaction(t *testing.T, urlPath string, tx interface{}) (*types.TxReceipt, error)
- func (s *Server) URL() string
- func (s *Server) WriteDataTx(t *testing.T, db, key string, value []byte) (string, *types.TxReceipt, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WriteConfigAsYaml ¶
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 ¶
Cluster holds bcdb servers present in a blockchainDB cluster
func NewCluster ¶
NewCluster creates a new cluster environment for the blockchain database
func (*Cluster) AgreedHeight ¶ added in v0.2.2
func (*Cluster) AgreedLeader ¶ added in v0.2.2
func (*Cluster) CreateUserCerts ¶ added in v0.2.3
func (c *Cluster) CreateUserCerts(user string, keyPair tls.Certificate) error
func (*Cluster) GetLogger ¶ added in v0.2.3
func (c *Cluster) GetLogger() *logger.SugarLogger
func (*Cluster) GetServerByID ¶ added in v0.2.2
func (*Cluster) GetUserCertDir ¶ added in v0.2.3
func (*Cluster) GetUserCertKeyPath ¶ added in v0.2.3
func (*Cluster) GetX509KeyPair ¶ added in v0.2.3
func (c *Cluster) GetX509KeyPair() (tls.Certificate, error)
func (*Cluster) Restart ¶
Restart restarts the cluster by shutting down and starting all servers in the cluster
func (*Cluster) RestartServer ¶
RestartServer restarts a given server present in the cluster by shutting down and restarting the server
func (*Cluster) Shutdown ¶
Shutdown shuts the cluster down by shutting down all servers in the cluster
func (*Cluster) ShutdownAndCleanup ¶
ShutdownAndCleanup shuts the cluster down by shutting down all servers in the cluster and removes all directories
func (*Cluster) ShutdownServer ¶
ShutdownServer shuts a given server present in the cluster down
func (*Cluster) StartServer ¶
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) AdminSigner ¶
func (*Server) CreateUsers ¶ added in v0.2.3
func (*Server) GetDBIndex ¶ added in v0.2.3
func (*Server) GetDBStatus ¶ added in v0.2.3
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