-
Notifications
You must be signed in to change notification settings - Fork 13
Concepts Overview
These descriptions are additional to the technical paper which you should read first. This article should cover some implementation details to get into the code more easily.
The network consists of multiple nodes. Nodes are passively executing agents.
A node provides basic messaging and storage facilities to the upper layers.
Node is an abstract class. There are two implementations: LocalNode for testing purposes and PastryNodeImpl using FreePastry. This way, las2peer is independent from any specific DHT implementation.
A message receiver is registered on a node to receive and process incoming messages. Message receivers can either be adressed directly by usign their id or they can listen to an arbitrary topic and send messages to an arbitrary topic.
An agent is an acting entity in the network. An agent has an asymmetric key pair and is stored to the network. It can store content to the distributed storage. They are also a message receiver enabling agent-to-agent communication.
An agent represting a user.
A group of agents: Any agent can be member of a GroupAgent and thus unlock it.
An agent representing an anonymous entity. The anonymous agent has no keypair and thus can only read unencrypted content from the content.
For performing actions on a node on behalf on an agent, the node creates an AgentContext for the respective agent. The agent that is used for operations prformed thorugh an agent context is called main agent. The agent context caches for example unlocked group agent instances to avoid unlocking agents twice. The node manages a set of agent contexts and cleans them up whenever they become stale.
Services are published by developers. A service is identified by its name and version.
A service agent is an agent and executes a service on a node. A new agent is created per node and service (name + version).
The mediator mediates agents that do not have message handling implemented (and thus can not act themselves) to the outside world. This allows interaction with the network through standard protocols such as HTTP/REST or WebSockets.
A connector implements interaction with the network from other protocols, using the mediator.
Messages are sent between agents.
A message always has a sender who signs the message. The receiver may be specified as an agent or as topic. In the first case, the message is encrpyted, in the second case, this is not possible since no specific receiver is known. A message may be an answer to another message. These answers are passed to answer listeners at the node as they are received.
- Messages can be sent directly to an Agent instance (specifying the node id where the agent is running).
- Anycast to Agent: an agent instance will be chosen, the message will only be sent to this agent
- Broadcast ot Agent: the message will be sent to all agent instances (not implemented in the PastryNode)
- Anycast to topic: the message will be sent to one agent listening to the topic
- Broadcast to topic: the message will be sent to all agents listening to the topic
After sending a message, answers can be collected:
- wait for one message
- wait for a specific amount of messages
- wait for one message, and wait a little bit longer to collect some more messages
Message receiving ends after the timeout is exeeded in all cases.
- service agent is choosen ( read more about it here )
- request to service's scribe topic (all ServiceAgents listen to their service topic)
- Node collects results and chooses service agent based on informations sent by service agents (version, load, response time, node fingerprint, ...)
- message exchange with service agent
- send method invocation
- and the calling agent's passphrase which is used to unlock the Context on the executing Node
- receive messages / results
- send method invocation
- also, each Node cleans up unlocked contexts regularly.
Freepastry provides a key value store (DHT) called Past. On top of that las2peer uses Agents to encrypt and sign arbitrary data and store them in the shared storage. Furthermore las2peer allows to overwrite entries for a given identifier, while ensuring that the latest version is always returned in a fetch operation. Read more about the shared storage system here.
Copyright (c) 2020 Advanced Community Information Systems (ACIS) Group, Chair of Computer Science 5 (Databases & Information Systems), RWTH Aachen University, Germany