This is an old revision of the document!
Table of Contents
F1x Architecture
Overview
Terminology
- Shard - Object with _name field
- Data shards have _handler
- Code shards have _code attributes
- Query shard have _object, _query and _callback. The _callback method of _object Handler is called if _query result it changed.
- Handler - Code shard that knows to execute methods for given Object
- Handlers Set - Handlers published by the same Owner
- Reflector - Mechanism to take referenced Shard, sign it and make available for peering
- Publish - procedure to create Reflector
- Site - f1x node installation
- Cache Routing Server (CRS) - intermediate server to connect Sites
Site
Site is base compute unit of F1x network that works on behalf of single owner. It consists of events routing server and presentation (like web server).
Web server (presentation) functionality:
- authenticate the single user (a site normally has one user, preferably with unique domain)
- communcate with core on objects CRUD
- visualise and manage content in user-friendly way
- show notifications
Events routing server performs functions below:
- Storage for shards
- Execute methods
- provide pserver interface for exported Shards
- Keep track of callbacks shards (subscribers), notify CRS on changes
- garbage collect “foreign” Shards that are not referenced anymore
Shard (Memo)
Shard is data structure that has associated data handler, similarily to data and code separation in OOP. Code is written in Lua and is executed in sandbox. API methods to read and call referenced Memos allows writing sophisticated applications.
Exported Folders
Memos are stored into Folders in “Private” area, that is visible to owner only. User might choose to mark some folders as externally accessible, for others to be able to see them. Exported folders have mandatory “Epoch” and “Digital Signature”. They also might be encrypted with public key of intended recipients, thus limiting who can see the content.
pCache server
Every Site is connected to a pCache server. It might be discovered by asking centralized “pCache servers registry”. It is publicly accessible and should be at location with good connectivity. The pCache servers perform functions below:
- retrieve list of subscriptions from sites under its control, send back matching Memos
- retrieve “exported” data from sites and share it to sites that request it. Cache the data.
- receive notifications from children sites about data change, forward them to upstream pServers or other sites
JQ queries
Microapps need to access data from other Memos. They can run jq queries on “known” Memos:
- what is default measurement system of the owner? Imperial or standard
- get list of neighbours who know me:
- find Memos of kind People and have homeAt geo and have Memo of kind Subscription where (site=me and kind Memo=Message)
- remove ones that have distance between me and homeAt more than 100 m
Stored queries (subscriptions) also use jq to find matching Memos: TBD How?
Security
For the system to be popular, users must trust the system to be able to protect their data. That means that Handlers must be trusted not to misuse data.
During setup Site owner is assigned “default” set of Handlers, that been carefully audited. He might change it or “overlay” it with other Handlers sets.
In addition to trusted Handlers set, data sharing must be permitted for each case. Initially Handler has “Unknown” security level. Once it reads from internal object, it is assumed “restricted” level, and it can not publish (write into public objects), unless permitted by Site Owner. The allowance might have a checkbox “remember this choice”, thus allowing the particular combination of Handler and Object to publish.
Site security
Handlers are executed in sandbox, with access to Object fields (in the shard). Some fields are volatile, e.g. they are stored in cache area, separately from the shard. For POC we use Lua for Handlers language (RestrictedPython is possible).
