Persistent Compute Objects, or picos, are tools for modeling the Internet of Things. A pico represents an entity—something that has a unique identity and a long-lived existence. Picos can represent people, places, things, organizations, and even ideas.
The motivation for picos is to design infrastructure to support the Internet of Things that is decentralized, heterarchical, and interoperable. These three characteristics are essential to a workable solution and are sadly lacking in our current implementations.
Without these three characteristics, it's impossible to build an Internet of Things that respects people's privacy and independence.
- persistent: They exist from when they are created until they are explicitly deleted. Picos retain state based on past operations.
- unique: They have an identity that is immutable. While attributes of the pico, its state, may change, its identity does not.
- online: They are available on the Internet and respond to events and queries.
- concurrent: They operate independently of one another and process events and queries asynchronously.
- event-driven: They respond to events by changing state and sending new events.
- rule-based: Their behavior is expressed as rules that pattern-match against incoming events. Put another way, rules listen for events on the pico's internal event bus.
Collections of picos are used to create models of interacting entities in the Internet of Things. Picos communicate by sending events to or making requests of each other in an actor-like manner. These communications are point-to-point and every pico can have a unique address, shared by no one else, to any other pico to which it communicates. Collections of picos were used in architecting the Fuse connected-car system with significant advantage.
Pico Building Blocks
Picos are part of a system that supports programming them. While you can imagine different implementations that support the characteristics of picos enumerated in the previous section, this post will describe the implementation and surrounding ecosystem that I and others have been building for the past seven years.
The various pieces of the pico ecosystem and their relationship is shown in the following diagram (click for enlarged diagram).
Many of the titles in these boxes may be familiar, but I suspect that the exact nature of how they relate to each other has been a mystery in many cases. Here are some brief descriptions of the primary components and some explanation of the relationships.
The event-query API is a name I gave the style of interaction that picos support. Picos don't implement RESTful APIs. They aren't meant to. As I explain in Pico APIs: Events and Queries, picos are primarily event-driven but also support a query API for getting values from the pico. Each pico has an internal event-bus. So while picos interact with each other and the world in a point-to-point actor model, internally, they distribute events with a publish and subscribe mechanism. More
Picos use the event-query API to communicate with each other. So do applications using a programming style called the pico application architecture (formerly the personal cloud application architecture). The PAA is a variant on an architecture that is being promoted as unhosted web apps and remotestorage. PAA goes beyond those models by offering a richer API that includes not just storage, but other services that developers might need. In fact the set of services is infinitely variable in each pico.
In the same way that operating systems provide more complex, more flexible services for developers than the bare metal of the machine, Wrangler provides pico programmers with important services that make picos easier to use and manage. For example, Wrangler provides services for creating new picos and creating communication channels between picos. (Wrangler was formerly known as CloudOS.)
The basic module for programming picos is a ruleset. A ruleset is a collection of rules that respond to events. But a ruleset is more than that. Functions in the ruleset make up the queries that are available in the event query API. Thus, the specific event-query API that a given pico presents to the world correlates exactly to the rulesets that are installed in the pico.
The following diagram shows the rules and functions in a pico presenting an event-query API to an application.
Wrangler provides functionality to installing rulesets in a pico and they can change overtime just as the programs installed on a computer change over time. As the installed rulesets change, so does the pico's API.
KRL is the language in which rulesets are programmed. Picos run KRL using the event evaluation cycle. Rules in KRL are "event-condition-action" rules because they tie together an event expression, a condition, and an action. Event expressions are how rules subscribe to specific events on the pico's event bus. KRL supports complex, declarative event expressions. KRL also supports persistent variables, which is how developers access the pico's state. KRL developers do not need a database to store attributes for the pico because of persistent variables.
The pico engine is a host or container engine for picos. A given instance of the pico engine can host any number of picos. The pico engine makes picos work. Pico Engine is an open source project, hosted on GitHub.
KRL rulesets are usually hosted online. Developers register the URL with a pico engine to create a ruleset ID or RID. A given ruleset can be installed in any number of picos. When the pico runs, the engine gets the ruleset source, parses it, optimizes it, and executes it.
The diagram below shows an important property of pico hosting. Picos can have communication relationships with each other even though they are hosted on different instances of the pico engine. Pico engine instances need have no specific relationship with each other for the picos they host to interact.
This hosted model is important because it provides a key component of ensuring that picos can run everywhere, not only in one organization's infrastructure.
Picos present a powerful model for how a decentralized, heterarchical, interoperable Internet of Things can be built. Picos run on open-source software engine that can be deployed on any hardware that supports Node JS. They have been used to build and deploy several production systems, including the Fuse connected-car system. They provide the means for giving people direct, unintermediated control of their personal data and the devices that are generating it.
I invite your questions and participation.