Skip to content

Concepts Overview

Jasper Nalbach edited this page Jul 25, 2017 · 5 revisions

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.

Main Entities

Node

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.

MessageReceiver

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.

Agent

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.

UserAgent

An agent represting a user.

GroupAgents

A group of agents: Any agent can be member of a GroupAgent and thus unlock it.

AnonymousAgent

An agent representing an anonymous entity. The anonymous agent has no keypair and thus can only read unencrypted content from the content.

AgentContext

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.

Service

Services are published by developers. A service is identified by its name and version.

ServiceAgent

A service agent is an agent and executes a service on a node. A new agent is created per node and service (name + version).

Mediator

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.

Connector

A connector implements interaction with the network from other protocols, using the mediator.

Agent-to-Agent communication

Messages are sent between agents.

Messages

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.

Send Modes

  • 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

Answer Collection

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 Invocations

  • 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
  • also, each Node cleans up unlocked contexts regularly.

Distributed Storage

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.