config

package
v0.2.4 Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2022 License: Apache-2.0 Imports: 10 Imported by: 4

README

It holds the design and user document

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AdminConf

type AdminConf struct {
	ID              string
	CertificatePath string
}

AdminConf holds the credentials of the blockchain database cluster admin such as the ID and path to the x509 certificate

type BlockCreationConf

type BlockCreationConf struct {
	MaxBlockSize                uint64
	MaxTransactionCountPerBlock uint32
	BlockTimeout                time.Duration
}

BlockCreationConf holds the block creation parameters. TODO consider moving this to shared-config if we want to have it consistent across nodes

type BootstrapConf

type BootstrapConf struct {
	// Method specifies how to use the bootstrap file:
	// - 'genesis' means to load it as the initial configuration that will be converted into the ledger's genesis block and
	//   loaded into the database when the server starts with an empty ledger.
	// - 'join' means to load it as a temporary configuration that will be used to connect to existing cluster members
	//   and on-board by fetching the ledger from them, rebuilding the database in the process (not supported yet).
	// - 'none' means the server will not load any bootstrap file. This appropriate for servers that already have a
	//   database with a valid shared configuration in them.
	Method string
	// File contains the path to initial configuration that will be used to bootstrap the node,
	// as specified by the`Method`.
	File string
}

BootstrapConf specifies the method of starting a new node with an empty ledger and database.

type CAConfiguration

type CAConfiguration struct {
	RootCACertsPath         []string
	IntermediateCACertsPath []string
}

CAConfiguration holds the path to the x509 certificates of the certificate authorities who issues all certificates.

func (*CAConfiguration) WriteBundle

func (c *CAConfiguration) WriteBundle(filePath string) error

type Configurations

type Configurations struct {
	LocalConfig  *LocalConfiguration
	SharedConfig *SharedConfiguration
	JoinBlock    *types.Block
}

Configurations holds the complete configuration of a database node.

func Read

func Read(configFilePath string) (*Configurations, error)

Read reads configurations from the config file and returns the config

type ConsensusConf

type ConsensusConf struct {
	// The consensus algorithm, currently only "raft" is supported.
	Algorithm string
	// Peers that take part in consensus.
	Members []*PeerConf
	// Peers that are allowed to connect and fetch the ledger from members, but do not take part in consensus.
	Observers []*PeerConf
	// Raft protocol parameters.
	RaftConfig *RaftConf
}

type DatabaseConf

type DatabaseConf struct {
	Name            string
	LedgerDirectory string
}

DatabaseConf holds the name of the state database and the path where the data is stored.

type IdentityConf

type IdentityConf struct {
	// A unique name that identifies the node within the cluster.
	// This corresponds to NodeConf.NodeID, and links the local server to one of the nodes defined
	// in SharedConfiguration.Nodes.
	ID string
	// Path to the certificate used to authenticate communication with clients,
	// and to verify the server's signature on blocks and request responses.
	CertificatePath string
	// Path to the private key used to authenticate communication with clients,
	// and to sign blocks and request responses.
	KeyPath string
}

IdentityConf holds the ID, path to x509 certificate and the private key associated with the database node.

type LocalConfiguration

type LocalConfiguration struct {
	Server        ServerConf
	BlockCreation BlockCreationConf
	Replication   ReplicationConf
	Bootstrap     BootstrapConf
}

LocalConfiguration holds the local configuration of the server. These definitions may vary from server to server, and are defined independently for each server.

type NetworkConf

type NetworkConf struct {
	Address string
	Port    uint32
}

NetworkConf holds the listen address and port of an endpoint. See `net.Listen(network, address string)`. The `address` parameter will be the `Address`:`Port` defined below.

type NodeConf

type NodeConf struct {
	NodeID          string
	Host            string
	Port            uint32
	CertificatePath string
}

NodeConf carry the identity, endpoint, and certificate of a database node that serves to clients. The NodeID correlates the node definition here with the peer definition in the SharedConfiguration.Consensus. The Host and Port are those that are accessible from clients. The certificate is the one used to authenticate with clients and validate the server;s signature on blocks and transaction/query responses.

type PeerConf

type PeerConf struct {
	// The node ID correlates the peer definition here with the NodeConfig.ID field.
	NodeId string
	// Raft ID must be >0 for members, or =0 for observers.
	RaftId uint64
	// The host name or IP address that is used by other peers to connect to this peer.
	PeerHost string
	// The port that is used by other peers to connect to this peer.
	PeerPort uint32
}

PeerConf defines a server that takes part in consensus, or an observer.

type QueryProcessingConf added in v0.2.4

type QueryProcessingConf struct {
	ResponseSizeLimitInBytes uint64
}

QueueProcessingConf holds the configuration associated with rich and range query processing

type QueueLengthConf

type QueueLengthConf struct {
	Transaction               uint32
	ReorderedTransactionBatch uint32
	Block                     uint32
}

QueueLengthConf holds the queue length of all queues within the node.

type RaftConf

type RaftConf struct {
	// Time interval between two Node.Tick invocations. e.g. 100ms.
	TickInterval string
	// The number of Node.Tick invocations that must pass  between elections.
	// That is, if a follower does not receive any
	// message from the leader of current term before ElectionTick has
	// elapsed, it will become candidate and start an election.
	// electionTicks must be greater than heartbeatTicks.
	ElectionTicks uint32
	// The number of Node.Tick invocations that must
	// pass between heartbeats. That is, a leader sends heartbeat
	// messages to maintain its leadership every HeartbeatTick ticks.
	HeartbeatTicks uint32
	// Limits the max number of in-flight blocks (i.e. Raft messages).
	MaxInflightBlocks uint32
	// Take a snapshot when cumulative data since last snapshot exceeds a certain size in bytes.
	SnapshotIntervalSize uint64
}

type ReplicationConf

type ReplicationConf struct {
	// WALDir defines the directory used to store the WAL of the consensus algorithm.
	WALDir string
	// SnapDir defines the directory used to store snapshots produced by the consensus algorithm.
	SnapDir string
	// AuxDir defines the directory used to store auxiliary and temporary files during replication.
	AuxDir string
	// Network defines the listen address and port used for server to server communication.
	Network NetworkConf
	// TLS defines TLS settings for server to server communication.
	TLS TLSConf
}

ReplicationConf provides local configuration parameters for replication and server to server communication.

type ServerConf

type ServerConf struct {
	// The identity of the local node.
	Identity IdentityConf
	// The network interface and port used to serve client requests.
	Network NetworkConf
	// The database configuration of the local node.
	Database DatabaseConf
	// The lengths of various queues that buffer between internal components.
	QueueLength QueueLengthConf
	// QueryProcessing holds limits associated with query responses
	QueryProcessing QueryProcessingConf
	// Server logging level.
	LogLevel string
	// Server TLS configuration, for secure communication with clients.
	TLS TLSConf
}

ServerConf holds the identity information of the local database server, along with network interface, as well as internal component configuration parameters.

type SharedConfiguration

type SharedConfiguration struct {
	// Nodes carry the identity, endpoint, and certificate of each database node that serves to clients.
	Nodes     []*NodeConf
	Consensus *ConsensusConf
	CAConfig  CAConfiguration
	Admin     AdminConf
}

SharedConfiguration holds the initial configuration that will be converted into the ledger's genesis block and loaded into the database when the server starts with an empty ledger and database.

This struct may also be used to bootstrap a new node into an existing cluster (not yet implemented).

This part of the configuration is replicated and is common to all nodes. After the initial bootstrap, this part of the configuration can change only through configuration transactions.

type TLSConf

type TLSConf struct {
	// Require server-side TLS.
	Enabled bool
	// Require client certificates / mutual TLS for inbound connections.
	ClientAuthRequired bool
	// X.509 certificate used for TLS server
	ServerCertificatePath string
	// Private key for TLS server
	ServerKeyPath string
	// X.509 certificate used for creating TLS client connections.
	ClientCertificatePath string
	// Private key used for creating TLS client connections.
	ClientKeyPath string
	// cluster.tls.caConfig defines the paths to the x509 certificates
	// of the root and intermediate certificate authorities that issued
	// all the certificates used for intra-cluster communication.
	CaConfig CAConfiguration
}

TLSConf holds TLS configuration settings.

Jump to

Keyboard shortcuts

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