Package i5.las2peer.p2p
Class EthereumNode
java.lang.Object
i5.las2peer.api.Configurable
i5.las2peer.p2p.Node
i5.las2peer.p2p.PastryNodeImpl
i5.las2peer.p2p.EthereumNode
- All Implemented Interfaces:
L2pStorageInterface
,NodeStorageInterface
,AgentStorage
Node implementation that extends the FreePastry-based node with
access to an Ethereum blockchain-based service and user registry.
Access to the registry is encapsulated in the package
i5.las2peer.registry
. (The actual Ethereum client is run
separately, but see there for details.)
The operator of an EthereumNode must have an Ethereum BIP39
mnemonic-derived key pair (e.g., as created for EthereumAgents).
The Ether funds of that account are used to announce service
deployments, i.e., services running at this node.
The same account should be used for mining in the Ethereum client,
so that new Ether is added.
Operations triggered by agents, such as users registering and
releasing services, are paid for by them.- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class i5.las2peer.p2p.Node
Node.NodeStatus, Node.SendMode
-
Field Summary
Fields inherited from class i5.las2peer.p2p.PastryNodeImpl
DEFAULT_BOOTSTRAP_PORT
Fields inherited from class i5.las2peer.p2p.Node
DEFAULT_AGENT_CONTEXT_LIFETIME, DEFAULT_CPU_LOAD_TRESHOLD, DEFAULT_INVOCATION_RETRY_COUNT, DEFAULT_NODE_SERVICE_CACHE_LIFETIME, DEFAULT_NODE_SERVICE_CACHE_RESULT_COUNT, DEFAULT_TIDY_UP_TIMER_INTERVAL
-
Constructor Summary
ConstructorDescriptionEthereumNode
(ClassManager classManager, boolean useMonitoringObserver, InetAddress pastryBindAddress, Integer pastryPort, List<String> bootstrap, SharedStorage.STORAGE_MODE storageMode, String storageDir, Long nodeIdSeed, String ethereumMnemonic, String ethereumPassword) -
Method Summary
Modifier and TypeMethodDescriptionvoid
announceServiceDeployment
(ServiceNameVersion nameVersion) Announce deployment of the service instance.void
announceServiceDeployment
(ServiceAgent serviceAgent) Announce deployment of the service associated with this service agent using the service registry.void
announceServiceDeploymentEnd
(ServiceAgent serviceAgent) Announce end of deployment (i.e., shutdown) of the service associated with this service agent using the service registry.byte[]
fetchHashedContent
(byte[] hash) uses a cache in contrast toPastryNodeImpl.fetchHashedContent(byte[])
Gets an agent description from the net.getAgentByDetail
(String agentId, String username, String email) float
getAgentReputation
(String adminName, String adminEmail) getAgentWithoutCheckInRegistry
(String agentId) isLocalAdmin
(String agentEmail) protected void
In addition to super(), set up registry client with CLI credentialsvoid
registerServiceInBlockchain
(String serviceName, String serviceVersion, EthereumAgent author, byte[] supplementHash) Registers a service release in the blockchain-based registry.protected void
Add blockchain-enabled Pastry repo, which verifies service authorsvoid
storeAgent
(AgentImpl agent) Stores a new Agent to the network.void
storeAgentInRegistry
(AgentImpl agent) Methods inherited from class i5.las2peer.p2p.PastryNodeImpl
createEnvelope, createEnvelope, createEnvelope, createEnvelope, createEnvelope, createUnencryptedEnvelope, createUnencryptedEnvelope, fetchArtifact, fetchArtifact, fetchEnvelope, fetchEnvelope, fetchEnvelopeAsync, fetchHashedContent, fetchHashedContentAsync, findRegisteredAgent, getApplication, getBindAddress, getLocalMaxStorageSize, getLocalStorageSize, getNodeId, getNodeInformation, getOtherKnownNodes, getPastryNode, getPort, registerReceiver, registerReceiverToTopic, removeArtifact, removeEnvelope, sendMessage, sendMessage, shutDown, storeArtifact, storeEnvelope, storeEnvelope, storeEnvelopeAsync, storeHashedContent, storeHashedContent, storeHashedContentAsync, unregisterReceiver, unregisterReceiverFromTopic, updateAgent
Methods inherited from class i5.las2peer.p2p.Node
addObserver, createMediatorForAgent, findRegisteredAgent, findRegisteredAgent, findRegisteredAgent, getAgentContext, getAgentContext, getAgentIdForEmail, getAgentIdForGroupName, getAgentIdForLogin, getBaseClassLoader, getInformationFilename, getLocalAgent, getLocalServiceAgent, getNodeCpuLoad, getNodeFreeRAMLoad, getNodeInformation, getNodeRAMLoad, getNodeRepresentation, getNodeServiceCache, getRegisteredAgents, getRegisteredServices, getServiceAgent, getServiceAliasManager, getStartTime, getStatus, getUserManager, handoverAnswer, hasAgent, hasLocalAgent, hasLocalAgent, hasService, hasTopic, invoke, invoke, invoke, invoke, invokeGlobally, invokeLocally, isBusy, launch, observerNotice, observerNotice, observerNotice, observerNotice, observerNotice, observerNotice, observerNotice, observerNotice, receiveMessage, registerAnswerListener, removeObserver, runTidyUpTimer, sendMessage, sendMessageAndCollectAnswers, sendMessageAndWaitForAnswer, sendMessageAndWaitForAnswer, sendResponse, setCpuLoadThreshold, setInformationFilename, setServiceMonitoring, setStatus, startService, stopService, stopService
Methods inherited from class i5.las2peer.api.Configurable
getProperties, setFieldValues
-
Constructor Details
-
Method Details
-
launchSub
In addition to super(), set up registry client with CLI credentials- Overrides:
launchSub
in classPastryNodeImpl
- Throws:
NodeException
- If launching the node fails
-
setupRepository
protected void setupRepository()Add blockchain-enabled Pastry repo, which verifies service authors- Overrides:
setupRepository
in classPastryNodeImpl
-
announceServiceDeployment
Announce deployment of the service associated with this service agent using the service registry.- Parameters:
serviceAgent
- agent of service being started
-
announceServiceDeployment
Announce deployment of the service instance.- Parameters:
nameVersion
- service being started
-
announceServiceDeploymentEnd
Announce end of deployment (i.e., shutdown) of the service associated with this service agent using the service registry.- Parameters:
serviceAgent
- agent of service being shut down
-
isLocalAdmin
- Throws:
EthereumException
-
getAgent
Description copied from class:Node
Gets an agent description from the net. make sure, always to return fresh versions of the requested agent, so that no thread can unlock the private key for another one!- Specified by:
getAgent
in interfaceAgentStorage
- Overrides:
getAgent
in classPastryNodeImpl
- Parameters:
id
- An agent id- Returns:
- the requested agent
- Throws:
AgentNotFoundException
- If the agent is not foundAgentException
- If any other issue with the agent occurs, e. g. XML not readableAgentNotFoundInRegistryException
-
storeAgent
Description copied from class:Node
Stores a new Agent to the network.- Overrides:
storeAgent
in classPastryNodeImpl
- Parameters:
agent
- An agent to store- Throws:
AgentException
- If any issue with the agent occurs
-
getAgentByDetail
public AgentImpl getAgentByDetail(String agentId, String username, String email) throws AgentNotFoundException - Throws:
AgentNotFoundException
-
getAgentReputation
-
getAgentWithoutCheckInRegistry
- Throws:
AgentException
-
storeAgentInRegistry
- Throws:
AgentException
-
registerServiceInBlockchain
public void registerServiceInBlockchain(String serviceName, String serviceVersion, EthereumAgent author, byte[] supplementHash) throws AgentException, SerializationException, EthereumException Registers a service release in the blockchain-based registry. Also registers the service name to the author, and registers the author, if those have not already happened. -
fetchHashedContent
uses a cache in contrast toPastryNodeImpl.fetchHashedContent(byte[])
- Overrides:
fetchHashedContent
in classPastryNodeImpl
- Throws:
EnvelopeException
-
getRegistryClient
- Returns:
- registry client using this agent's credentials
-