Documentation ¶
Index ¶
- func DefaultService(repository Repository, idService identity.Service) config.Service
- func NewAccount(ethAccountName string, c config.Configuration) (config.Account, error)
- func NewNodeConfig(c config.Configuration) config.Configuration
- func RetrieveConfig(dbOnly bool, ctx map[string]interface{}) (config.Configuration, error)
- func TempAccount(ethAccountName string, c config.Configuration) (config.Account, error)
- type Account
- func (acc *Account) FromJSON(data []byte) error
- func (acc *Account) GetCentChainAccount() config.CentChainAccount
- func (acc *Account) GetEthereumAccount() *config.AccountConfig
- func (acc *Account) GetEthereumContextWaitTimeout() time.Duration
- func (acc *Account) GetEthereumDefaultAccountName() string
- func (acc *Account) GetIdentityID() []byte
- func (acc *Account) GetKeys() (idKeys map[string]config.IDKey, err error)
- func (acc *Account) GetP2PKeyPair() (pub, priv string)
- func (acc *Account) GetPrecommitEnabled() bool
- func (acc *Account) GetReceiveEventNotificationEndpoint() string
- func (acc *Account) GetSigningKeyPair() (pub, priv string)
- func (acc *Account) ID() []byte
- func (acc *Account) JSON() ([]byte, error)
- func (acc *Account) SignMsg(msg []byte) (*coredocumentpb.Signature, error)
- func (acc *Account) Type() reflect.Type
- type Bootstrapper
- type KeyPair
- type NodeConfig
- func (nc *NodeConfig) FromJSON(data []byte) error
- func (nc *NodeConfig) Get(key string) interface{}
- func (nc *NodeConfig) GetAccountsKeystore() string
- func (nc *NodeConfig) GetBool(key string) bool
- func (nc *NodeConfig) GetBootstrapPeers() []string
- func (nc *NodeConfig) GetCentChainAccount() (config.CentChainAccount, error)
- func (nc *NodeConfig) GetCentChainAnchorLifespan() time.Duration
- func (nc *NodeConfig) GetCentChainIntervalRetry() time.Duration
- func (nc *NodeConfig) GetCentChainMaxRetries() int
- func (nc *NodeConfig) GetCentChainNodeURL() string
- func (nc *NodeConfig) GetConfigStoragePath() string
- func (nc *NodeConfig) GetContractAddress(contractName config.ContractName) common.Address
- func (nc *NodeConfig) GetContractAddressString(address string) string
- func (nc *NodeConfig) GetDuration(key string) time.Duration
- func (nc *NodeConfig) GetEthereumAccount(accountName string) (account *config.AccountConfig, err error)
- func (nc *NodeConfig) GetEthereumContextReadWaitTimeout() time.Duration
- func (nc *NodeConfig) GetEthereumContextWaitTimeout() time.Duration
- func (nc *NodeConfig) GetEthereumDefaultAccountName() string
- func (nc *NodeConfig) GetEthereumGasLimit(op config.ContractOp) uint64
- func (nc *NodeConfig) GetEthereumGasMultiplier() float64
- func (nc *NodeConfig) GetEthereumIntervalRetry() time.Duration
- func (nc *NodeConfig) GetEthereumMaxGasPrice() *big.Int
- func (nc *NodeConfig) GetEthereumMaxRetries() int
- func (nc *NodeConfig) GetEthereumNodeURL() string
- func (nc *NodeConfig) GetFloat(key string) float64
- func (nc *NodeConfig) GetIdentityID() ([]byte, error)
- func (nc *NodeConfig) GetInt(key string) int
- func (nc *NodeConfig) GetLowEntropyNFTTokenEnabled() bool
- func (nc *NodeConfig) GetNetworkID() uint32
- func (nc *NodeConfig) GetNetworkKey(k string) string
- func (nc *NodeConfig) GetNetworkString() string
- func (nc *NodeConfig) GetNumWorkers() int
- func (nc *NodeConfig) GetP2PConnectionTimeout() time.Duration
- func (nc *NodeConfig) GetP2PExternalIP() string
- func (nc *NodeConfig) GetP2PKeyPair() (pub, priv string)
- func (nc *NodeConfig) GetP2PPort() int
- func (nc *NodeConfig) GetP2PResponseDelay() time.Duration
- func (nc *NodeConfig) GetPrecommitEnabled() bool
- func (nc *NodeConfig) GetReceiveEventNotificationEndpoint() string
- func (nc *NodeConfig) GetServerAddress() string
- func (nc *NodeConfig) GetServerPort() int
- func (nc *NodeConfig) GetSigningKeyPair() (pub, priv string)
- func (nc *NodeConfig) GetStoragePath() string
- func (nc *NodeConfig) GetString(key string) string
- func (nc *NodeConfig) GetTaskValidDuration() time.Duration
- func (nc *NodeConfig) GetWorkerWaitTimeMS() int
- func (nc *NodeConfig) ID() ([]byte, error)
- func (nc *NodeConfig) IsDebugLogEnabled() bool
- func (nc *NodeConfig) IsPProfEnabled() bool
- func (nc *NodeConfig) IsSet(key string) bool
- func (nc *NodeConfig) JSON() ([]byte, error)
- func (nc *NodeConfig) Set(key string, value interface{})
- func (nc *NodeConfig) SetDefault(key string, value interface{})
- func (nc *NodeConfig) SetupSmartContractAddresses(network string, smartContractAddresses *config.SmartContractAddresses)
- func (nc *NodeConfig) Type() reflect.Type
- type ProtocolSetter
- type Repository
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultService ¶
func DefaultService(repository Repository, idService identity.Service) config.Service
DefaultService returns an implementation of the config.Service
func NewAccount ¶
NewAccount creates a new Account instance with configs
func NewNodeConfig ¶
func NewNodeConfig(c config.Configuration) config.Configuration
NewNodeConfig creates a new NodeConfig instance with configs
func RetrieveConfig ¶
func RetrieveConfig(dbOnly bool, ctx map[string]interface{}) (config.Configuration, error)
RetrieveConfig retrieves system config giving priority to db stored config
func TempAccount ¶
TempAccount creates a new Account without id validation, Must only be used for account creation.
Types ¶
type Account ¶
type Account struct { EthereumAccount *config.AccountConfig EthereumDefaultAccountName string EthereumContextWaitTimeout time.Duration ReceiveEventNotificationEndpoint string IdentityID []byte SigningKeyPair KeyPair P2PKeyPair KeyPair PrecommitEnabled bool CentChainAccount config.CentChainAccount // contains filtered or unexported fields }
Account exposes options specific to an account in the node
func (*Account) GetCentChainAccount ¶ added in v1.0.0
func (acc *Account) GetCentChainAccount() config.CentChainAccount
GetCentChainAccount gets CentChainAccount
func (*Account) GetEthereumAccount ¶
func (acc *Account) GetEthereumAccount() *config.AccountConfig
GetEthereumAccount gets EthereumAccount
func (*Account) GetEthereumContextWaitTimeout ¶
GetEthereumContextWaitTimeout gets EthereumContextWaitTimeout
func (*Account) GetEthereumDefaultAccountName ¶
GetEthereumDefaultAccountName gets EthereumDefaultAccountName
func (*Account) GetIdentityID ¶
GetIdentityID gets IdentityID
func (*Account) GetKeys ¶
GetKeys returns the keys of an account TODO remove GetKeys and add signing methods to account
func (*Account) GetP2PKeyPair ¶
GetP2PKeyPair gets P2PKeyPair
func (*Account) GetPrecommitEnabled ¶
GetPrecommitEnabled gets the enable pre commit value
func (*Account) GetReceiveEventNotificationEndpoint ¶
GetReceiveEventNotificationEndpoint gets ReceiveEventNotificationEndpoint
func (*Account) GetSigningKeyPair ¶
GetSigningKeyPair gets SigningKeyPair
type Bootstrapper ¶
type Bootstrapper struct{}
Bootstrapper implements bootstrap.Bootstrapper to initialise configstore package.
func (*Bootstrapper) Bootstrap ¶
func (*Bootstrapper) Bootstrap(context map[string]interface{}) error
Bootstrap takes the passed in config file, loads the config and puts the config back into context.
type NodeConfig ¶
type NodeConfig struct { MainIdentity Account StoragePath string AccountsKeystore string P2PPort int P2PExternalIP string P2PConnectionTimeout time.Duration P2PResponseDelay time.Duration ServerPort int ServerAddress string NumWorkers int WorkerWaitTimeMS int TaskValidDuration time.Duration EthereumNodeURL string EthereumContextReadWaitTimeout time.Duration EthereumContextWaitTimeout time.Duration EthereumIntervalRetry time.Duration EthereumMaxRetries int EthereumMaxGasPrice *big.Int EthereumGasLimits map[config.ContractOp]uint64 EthereumGasMultiplier float64 NetworkString string BootstrapPeers []string NetworkID uint32 SmartContractAddresses map[config.ContractName]common.Address SmartContractBytecode map[config.ContractName]string PprofEnabled bool LowEntropyNFTTokenEnabled bool DebugLogEnabled bool CentChainNodeURL string CentChainIntervalRetry time.Duration CentChainMaxRetries int CentChainAnchorLifespan time.Duration }
NodeConfig exposes configs specific to the node
func (*NodeConfig) FromJSON ¶
func (nc *NodeConfig) FromJSON(data []byte) error
FromJSON initialize the model with a json
func (*NodeConfig) GetAccountsKeystore ¶
func (nc *NodeConfig) GetAccountsKeystore() string
GetAccountsKeystore returns the accounts keystore path.
func (*NodeConfig) GetBool ¶
func (nc *NodeConfig) GetBool(key string) bool
GetBool refer the interface
func (*NodeConfig) GetBootstrapPeers ¶
func (nc *NodeConfig) GetBootstrapPeers() []string
GetBootstrapPeers refer the interface
func (*NodeConfig) GetCentChainAccount ¶ added in v1.0.0
func (nc *NodeConfig) GetCentChainAccount() (config.CentChainAccount, error)
GetCentChainAccount returns the Cent Chain account of the current node.
func (*NodeConfig) GetCentChainAnchorLifespan ¶ added in v1.0.0
func (nc *NodeConfig) GetCentChainAnchorLifespan() time.Duration
GetCentChainAnchorLifespan returns the default lifespan of an anchor.
func (*NodeConfig) GetCentChainIntervalRetry ¶ added in v1.0.0
func (nc *NodeConfig) GetCentChainIntervalRetry() time.Duration
GetCentChainIntervalRetry returns duration to wait between retries.
func (*NodeConfig) GetCentChainMaxRetries ¶ added in v1.0.0
func (nc *NodeConfig) GetCentChainMaxRetries() int
GetCentChainMaxRetries returns the max acceptable retries.
func (*NodeConfig) GetCentChainNodeURL ¶ added in v1.0.0
func (nc *NodeConfig) GetCentChainNodeURL() string
GetCentChainNodeURL returns the URL of the CentChain Node.
func (*NodeConfig) GetConfigStoragePath ¶
func (nc *NodeConfig) GetConfigStoragePath() string
GetConfigStoragePath refer the interface
func (*NodeConfig) GetContractAddress ¶
func (nc *NodeConfig) GetContractAddress(contractName config.ContractName) common.Address
GetContractAddress refer the interface
func (*NodeConfig) GetContractAddressString ¶
func (nc *NodeConfig) GetContractAddressString(address string) string
GetContractAddressString refer the interface
func (*NodeConfig) GetDuration ¶
func (nc *NodeConfig) GetDuration(key string) time.Duration
GetDuration refer the interface
func (*NodeConfig) GetEthereumAccount ¶
func (nc *NodeConfig) GetEthereumAccount(accountName string) (account *config.AccountConfig, err error)
GetEthereumAccount refer the interface
func (*NodeConfig) GetEthereumContextReadWaitTimeout ¶
func (nc *NodeConfig) GetEthereumContextReadWaitTimeout() time.Duration
GetEthereumContextReadWaitTimeout refer the interface
func (*NodeConfig) GetEthereumContextWaitTimeout ¶
func (nc *NodeConfig) GetEthereumContextWaitTimeout() time.Duration
GetEthereumContextWaitTimeout refer the interface
func (*NodeConfig) GetEthereumDefaultAccountName ¶
func (nc *NodeConfig) GetEthereumDefaultAccountName() string
GetEthereumDefaultAccountName refer the interface
func (*NodeConfig) GetEthereumGasLimit ¶
func (nc *NodeConfig) GetEthereumGasLimit(op config.ContractOp) uint64
GetEthereumGasLimit refer the interface
func (*NodeConfig) GetEthereumGasMultiplier ¶ added in v1.2.0
func (nc *NodeConfig) GetEthereumGasMultiplier() float64
GetEthereumGasMultiplier refer the interface
func (*NodeConfig) GetEthereumIntervalRetry ¶
func (nc *NodeConfig) GetEthereumIntervalRetry() time.Duration
GetEthereumIntervalRetry refer the interface
func (*NodeConfig) GetEthereumMaxGasPrice ¶
func (nc *NodeConfig) GetEthereumMaxGasPrice() *big.Int
GetEthereumMaxGasPrice refer the interface
func (*NodeConfig) GetEthereumMaxRetries ¶
func (nc *NodeConfig) GetEthereumMaxRetries() int
GetEthereumMaxRetries refer the interface
func (*NodeConfig) GetEthereumNodeURL ¶
func (nc *NodeConfig) GetEthereumNodeURL() string
GetEthereumNodeURL refer the interface
func (*NodeConfig) GetFloat ¶ added in v1.2.0
func (nc *NodeConfig) GetFloat(key string) float64
GetFloat refer the interface
func (*NodeConfig) GetIdentityID ¶
func (nc *NodeConfig) GetIdentityID() ([]byte, error)
GetIdentityID refer the interface
func (*NodeConfig) GetLowEntropyNFTTokenEnabled ¶
func (nc *NodeConfig) GetLowEntropyNFTTokenEnabled() bool
GetLowEntropyNFTTokenEnabled refer the interface
func (*NodeConfig) GetNetworkID ¶
func (nc *NodeConfig) GetNetworkID() uint32
GetNetworkID refer the interface
func (*NodeConfig) GetNetworkKey ¶
func (nc *NodeConfig) GetNetworkKey(k string) string
GetNetworkKey refer the interface
func (*NodeConfig) GetNetworkString ¶
func (nc *NodeConfig) GetNetworkString() string
GetNetworkString refer the interface
func (*NodeConfig) GetNumWorkers ¶
func (nc *NodeConfig) GetNumWorkers() int
GetNumWorkers refer the interface
func (*NodeConfig) GetP2PConnectionTimeout ¶
func (nc *NodeConfig) GetP2PConnectionTimeout() time.Duration
GetP2PConnectionTimeout refer the interface
func (*NodeConfig) GetP2PExternalIP ¶
func (nc *NodeConfig) GetP2PExternalIP() string
GetP2PExternalIP refer the interface
func (*NodeConfig) GetP2PKeyPair ¶
func (nc *NodeConfig) GetP2PKeyPair() (pub, priv string)
GetP2PKeyPair refer the interface
func (*NodeConfig) GetP2PPort ¶
func (nc *NodeConfig) GetP2PPort() int
GetP2PPort refer the interface
func (*NodeConfig) GetP2PResponseDelay ¶ added in v1.0.0
func (nc *NodeConfig) GetP2PResponseDelay() time.Duration
GetP2PResponseDelay refer the interface
func (*NodeConfig) GetPrecommitEnabled ¶
func (nc *NodeConfig) GetPrecommitEnabled() bool
GetPrecommitEnabled refer the interface
func (*NodeConfig) GetReceiveEventNotificationEndpoint ¶
func (nc *NodeConfig) GetReceiveEventNotificationEndpoint() string
GetReceiveEventNotificationEndpoint refer the interface
func (*NodeConfig) GetServerAddress ¶
func (nc *NodeConfig) GetServerAddress() string
GetServerAddress refer the interface
func (*NodeConfig) GetServerPort ¶
func (nc *NodeConfig) GetServerPort() int
GetServerPort refer the interface
func (*NodeConfig) GetSigningKeyPair ¶
func (nc *NodeConfig) GetSigningKeyPair() (pub, priv string)
GetSigningKeyPair refer the interface
func (*NodeConfig) GetStoragePath ¶
func (nc *NodeConfig) GetStoragePath() string
GetStoragePath refer the interface
func (*NodeConfig) GetString ¶
func (nc *NodeConfig) GetString(key string) string
GetString refer the interface
func (*NodeConfig) GetTaskValidDuration ¶ added in v1.0.0
func (nc *NodeConfig) GetTaskValidDuration() time.Duration
GetTaskValidDuration returns the time duration until which task is valid
func (*NodeConfig) GetWorkerWaitTimeMS ¶
func (nc *NodeConfig) GetWorkerWaitTimeMS() int
GetWorkerWaitTimeMS refer the interface
func (*NodeConfig) ID ¶
func (nc *NodeConfig) ID() ([]byte, error)
ID Gets the ID of the document represented by this model
func (*NodeConfig) IsDebugLogEnabled ¶ added in v1.0.0
func (nc *NodeConfig) IsDebugLogEnabled() bool
IsDebugLogEnabled refer the interface
func (*NodeConfig) IsPProfEnabled ¶
func (nc *NodeConfig) IsPProfEnabled() bool
IsPProfEnabled refer the interface
func (*NodeConfig) JSON ¶
func (nc *NodeConfig) JSON() ([]byte, error)
JSON return the json representation of the model
func (*NodeConfig) Set ¶
func (nc *NodeConfig) Set(key string, value interface{})
Set refer the interface
func (*NodeConfig) SetDefault ¶
func (nc *NodeConfig) SetDefault(key string, value interface{})
SetDefault refer the interface
func (*NodeConfig) SetupSmartContractAddresses ¶
func (nc *NodeConfig) SetupSmartContractAddresses(network string, smartContractAddresses *config.SmartContractAddresses)
SetupSmartContractAddresses refer the interface
func (*NodeConfig) Type ¶
func (nc *NodeConfig) Type() reflect.Type
Type Returns the underlying type of the Model
type ProtocolSetter ¶
ProtocolSetter sets the protocol on host for the centID
type Repository ¶ added in v1.0.0
type Repository interface { // RegisterAccount registers account in DB RegisterAccount(config config.Account) // RegisterConfig registers node config in DB RegisterConfig(config config.Configuration) // GetAccount returns the acocunt Model associated with account ID GetAccount(id []byte) (config.Account, error) // GetConfig returns the node config model GetConfig() (config.Configuration, error) // GetAccounts returns a list of all account models in the config DB GetAllAccounts() ([]config.Account, error) // Create creates the account model if not present in the DB. // should error out if the config exists. CreateAccount(id []byte, account config.Account) error // Create creates the node config model if not present in the DB. // should error out if the config exists. CreateConfig(config config.Configuration) error // Update strictly updates the account model. // Will error out when the account model doesn't exist in the DB. UpdateAccount(id []byte, account config.Account) error // Update strictly updates the node config model. // Will error out when the config model doesn't exist in the DB. UpdateConfig(nodeConfig config.Configuration) error // Delete deletes account config // Will not error out when account model doesn't exists in DB DeleteAccount(id []byte) error // Delete deletes node config // Will not error out when config model doesn't exists in DB DeleteConfig() error }
Repository defines the required methods for the config repository.
func NewDBRepository ¶ added in v1.0.0
func NewDBRepository(db storage.Repository) Repository
NewDBRepository creates instance of Config repository