setup

package
v0.2.10 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2023 License: Apache-2.0 Imports: 31 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateDatabases added in v0.2.4

func CreateDatabases(t *testing.T, s *Server, dbNames []string, dbsIndex map[string]*types.DBIndex)

func CreateUsers added in v0.2.4

func CreateUsers(t *testing.T, s *Server, users []*types.UserWrite)

func UpdateUser added in v0.2.8

func UpdateUser(t *testing.T, s *Server, operatingUserId string, userRead *types.UserRead, userWrite *types.UserWrite, userDelete *types.UserDelete) error

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) AddNewServerToCluster added in v0.2.4

func (c *Cluster) AddNewServerToCluster(server *Server)

func (*Cluster) AgreedHeight added in v0.2.2

func (c *Cluster) AgreedHeight(t *testing.T, expectedBlockHeight uint64, activeServers ...int) bool

func (*Cluster) AgreedLeader added in v0.2.2

func (c *Cluster) AgreedLeader(t *testing.T,
	activeServers ...int) int

func (*Cluster) CreateAdditionalUserCryptoMaterials added in v0.2.4

func (c *Cluster) CreateAdditionalUserCryptoMaterials(user string, certRootCA []byte, caPrivKey []byte) error

func (*Cluster) CreateUserCerts added in v0.2.3

func (c *Cluster) CreateUserCerts(user string, keyPair tls.Certificate) error

func (*Cluster) GetKeyAndCA added in v0.2.4

func (c *Cluster) GetKeyAndCA() ([]byte, []byte)

func (*Cluster) GetLogger added in v0.2.3

func (c *Cluster) GetLogger() *logger.SugarLogger

func (*Cluster) GetServerByID added in v0.2.2

func (c *Cluster) GetServerByID(serverID string) (*Server, int)

func (*Cluster) GetSigner added in v0.2.3

func (c *Cluster) GetSigner(userID string) (crypto.Signer, error)

func (*Cluster) GetUser added in v0.2.4

func (c *Cluster) GetUser(user string) ([]byte, []byte, error)

func (*Cluster) GetUserCertDir added in v0.2.3

func (c *Cluster) GetUserCertDir() string

func (*Cluster) GetUserCertKeyPath added in v0.2.3

func (c *Cluster) GetUserCertKeyPath(userID string) (string, string)

func (*Cluster) GetX509KeyPair added in v0.2.3

func (c *Cluster) GetX509KeyPair() (tls.Certificate, error)

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

func (*Cluster) UpdateServersAdmin added in v0.2.4

func (c *Cluster) UpdateServersAdmin(newAdmin string, newAdminKeyPath string, newAdminCertPath string) error

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
	ClusterTLSEnabled        bool
	BlockCreationOverride    *config.BlockCreationConf
	ServersQueryLimit        uint64
	DisableProvenanceServers []int
	DisableStateMPTrie       bool
}

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, method string, queryLimit uint64) (*Server, error)

NewServer creates a new blockchain database server

func (*Server) AdminCertPath added in v0.2.4

func (s *Server) AdminCertPath() string

func (*Server) AdminID

func (s *Server) AdminID() string

func (*Server) AdminKeyPath added in v0.2.4

func (s *Server) AdminKeyPath() string

func (*Server) AdminSigner

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

func (*Server) BootstrapFilePath added in v0.2.4

func (s *Server) BootstrapFilePath() string

func (*Server) ConfigDir added in v0.2.3

func (s *Server) ConfigDir() string

func (*Server) ConfigFilePath added in v0.2.4

func (s *Server) ConfigFilePath() string

func (*Server) CreateConfigFile added in v0.2.4

func (s *Server) CreateConfigFile(conf *config.LocalConfiguration) error

func (*Server) CreateCryptoMaterials added in v0.2.4

func (s *Server) CreateCryptoMaterials(rootCAPemCert, caPrivKey []byte) error

func (*Server) CreateNewCryptoMaterials added in v0.2.5

func (s *Server) CreateNewCryptoMaterials(rootCAPemCert, caPrivKey []byte) (string, string, string, error)

func (*Server) CreateUsers added in v0.2.3

func (s *Server) CreateUsers(t *testing.T, users []*types.UserWrite) (*types.TxReceipt, error)

func (*Server) DeleteDataTx added in v0.2.5

func (s *Server) DeleteDataTx(t *testing.T, db, key string) (string, *types.TxReceipt, *types.DataTxEnvelope, error)

func (*Server) ExecuteJSONQuery added in v0.2.4

func (s *Server) ExecuteJSONQuery(t *testing.T, userID, dbName, query string) (*types.DataQueryResponseEnvelope, error)

func (*Server) GetAllValues added in v0.2.4

func (s *Server) GetAllValues(t *testing.T, db, key, userID string) (*types.GetHistoricalDataResponseEnvelope, error)

func (*Server) GetDBIndex added in v0.2.3

func (s *Server) GetDBIndex(t *testing.T, dbName string, userID string) (*types.GetDBIndexResponseEnvelope, error)

func (*Server) GetDBStatus added in v0.2.3

func (s *Server) GetDBStatus(t *testing.T, dbName string) (*types.GetDBStatusResponseEnvelope, error)

func (*Server) GetDataProof added in v0.2.5

func (s *Server) GetDataProof(t *testing.T, db, key, userID string, blockNumber uint64, isDeleted bool) (*types.GetDataProofResponseEnvelope, error)

func (*Server) GetDeletedValues added in v0.2.4

func (s *Server) GetDeletedValues(t *testing.T, db, key, userID string) (*types.GetHistoricalDataResponseEnvelope, error)

func (*Server) GetMostRecentValueAtOrBelow added in v0.2.4

func (s *Server) GetMostRecentValueAtOrBelow(t *testing.T, db, key, userID string, ver *types.Version) (*types.GetHistoricalDataResponseEnvelope, error)

func (*Server) GetNextValues added in v0.2.4

func (s *Server) GetNextValues(t *testing.T, db, key, userID string, ver *types.Version) (*types.GetHistoricalDataResponseEnvelope, error)

func (*Server) GetPreviousValues added in v0.2.4

func (s *Server) GetPreviousValues(t *testing.T, db, key, userID string, ver *types.Version) (*types.GetHistoricalDataResponseEnvelope, error)

func (*Server) GetReaders added in v0.2.4

func (s *Server) GetReaders(t *testing.T, dbName, key, userID string) (*types.GetDataReadersResponseEnvelope, error)

func (*Server) GetTxIDsSubmittedBy added in v0.2.4

func (s *Server) GetTxIDsSubmittedBy(t *testing.T, userID, targetUserId string) (*types.GetTxIDsSubmittedByResponseEnvelope, error)

func (*Server) GetTxProof added in v0.2.4

func (s *Server) GetTxProof(t *testing.T, userID string, blockNumber, txIndex uint64) (*types.GetTxProofResponseEnvelope, error)

func (*Server) GetValueAt added in v0.2.4

func (s *Server) GetValueAt(t *testing.T, db, key, userID string, ver *types.Version) (*types.GetHistoricalDataResponseEnvelope, error)

func (*Server) GetValuesDeletedByUser added in v0.2.4

func (s *Server) GetValuesDeletedByUser(t *testing.T, userID string, targetUserId string) (*types.GetDataProvenanceResponseEnvelope, error)

func (*Server) GetValuesReadByUser added in v0.2.4

func (s *Server) GetValuesReadByUser(t *testing.T, userID, targetUserId string) (*types.GetDataProvenanceResponseEnvelope, error)

func (*Server) GetValuesWrittenByUser added in v0.2.4

func (s *Server) GetValuesWrittenByUser(t *testing.T, userID string, targetUserId string) (*types.GetDataProvenanceResponseEnvelope, error)

func (*Server) GetWriters added in v0.2.4

func (s *Server) GetWriters(t *testing.T, dbName, key, userID string) (*types.GetDataWritersResponseEnvelope, error)

func (*Server) ID added in v0.2.2

func (s *Server) ID() string

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) QueryAugmentedBlockHeader added in v0.2.4

func (s *Server) QueryAugmentedBlockHeader(t *testing.T, number uint64, user string) (*types.GetAugmentedBlockHeaderResponseEnvelope, error)

func (*Server) QueryBlockHeader added in v0.2.4

func (s *Server) QueryBlockHeader(t *testing.T, number uint64, forceParam bool, user string) (*types.GetBlockResponseEnvelope, error)

func (*Server) QueryClusterStatus added in v0.2.2

func (s *Server) QueryClusterStatus(t *testing.T) (*types.GetClusterStatusResponseEnvelope, error)

func (*Server) QueryConfig

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

func (*Server) QueryConfigBlockStatus added in v0.2.4

func (s *Server) QueryConfigBlockStatus(t *testing.T) (*types.GetConfigBlockResponseEnvelope, error)

func (*Server) QueryData

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

func (*Server) QueryDataRange added in v0.2.5

func (s *Server) QueryDataRange(t *testing.T, userID, dbName, startKey, endKey string, limit uint64) (*types.GetDataRangeResponseEnvelope, error)

func (*Server) QueryLastBlockStatus added in v0.2.4

func (s *Server) QueryLastBlockStatus(t *testing.T) (*types.GetBlockResponseEnvelope, error)

func (*Server) QueryLedgerPath added in v0.2.4

func (s *Server) QueryLedgerPath(t *testing.T, startNum, endNum uint64, user string) (*types.GetLedgerPathResponseEnvelope, error)

func (*Server) QueryTxReceipt added in v0.2.5

func (s *Server) QueryTxReceipt(t *testing.T, txID, user string) (*types.TxReceiptResponseEnvelope, error)

func (*Server) QueryUser added in v0.2.3

func (s *Server) QueryUser(t *testing.T, userID, targetUserId string) (*types.GetUserResponseEnvelope, error)

func (*Server) SetAdmin added in v0.2.4

func (s *Server) SetAdmin(newAdminID string, newAdminCertPath string, newAdminKeyPath string, newAdminSigner crypto.Signer)

func (*Server) SetAdminSigner added in v0.2.4

func (s *Server) SetAdminSigner(newAdminSigner crypto.Signer)

func (*Server) SetConfigTx added in v0.2.3

func (s *Server) SetConfigTx(t *testing.T, newConfig *types.ClusterConfig, version *types.Version, signer crypto.Signer, user string) (string, *types.TxReceipt, error)

func (*Server) Signer added in v0.2.3

func (s *Server) Signer(userID string) (crypto.Signer, error)

func (*Server) SubmitTransaction added in v0.2.3

func (s *Server) SubmitTransaction(t *testing.T, urlPath string, tx interface{}) (*types.TxReceipt, error)

func (*Server) SubmitTransactionAsync added in v0.2.5

func (s *Server) SubmitTransactionAsync(t *testing.T, urlPath string, tx interface{}) error

func (*Server) URL

func (s *Server) URL() string

func (*Server) UserWriteDataTx added in v0.2.6

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

func (*Server) WriteDataTx

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

func (*Server) WriteDataTxAsync added in v0.2.5

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

Jump to

Keyboard shortcuts

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