Presentation is loading. Please wait.

Presentation is loading. Please wait.

A presentation by Robin Upton (2009-03-12) ‏ latest version at www.altruists.org/ff4 Attribution – NonCommercial - ShareAlike www.altruists.org FF 404.

Similar presentations


Presentation on theme: "A presentation by Robin Upton (2009-03-12) ‏ latest version at www.altruists.org/ff4 Attribution – NonCommercial - ShareAlike www.altruists.org FF 404."— Presentation transcript:

1 A presentation by Robin Upton (2009-03-12) ‏ latest version at www.altruists.org/ff4 Attribution – NonCommercial - ShareAlike www.altruists.org FF 404 : Decentralised F 2 F Programming in 4 Minutes Decentralised Programming v1.0 http://www.altruists.org/ff4

2 (1)Decentralised Programming. WWW as Distributed Programming C C C C C C C S distributed.net = Distributed, Centralised Calculations are performed by many CPUs, but directed by a single authority. Friend2Friend.net = Distributed, Decentralised Each computers in F2F network has unique local data & instructions. None has special privilege. F F F F F F F Distributed programs may still be centrally controlled. http://www.distributed.net

3 Sites: code data code data code data code data WWW as Distributed Programming Clients Send Data Websites have unique instructions and data stores... Clients send data to one site at a time Clients:

4 Clients Send Data. Servers Return Data Users input data through browsers and pass it to websites: decentralization

5 Servers Return Data Code ≠ Data Websites receive data, carry out instructions, return data to clients

6 Code ≠ Data 'Code' = XML = 'Data' function f2fError($text, $nodename='error')‏ { // Example of usual source code $err= new DOMDocument(); $errnode=$err->createElementNS(nsF2F, $nodename, $text); $err->appendChild($errnode); return $err; } to be processed by trusted code. Untrusted data is dynamically input... Most programming languages cannot treat data as code.

7 'Code' = XML = 'Data' (2) How to Program F2F In F2F, programs, instructions and data share a common format: XML F2F data streams can embed instructions, allowing for rich interaction. i.e. Sites can dynamically script other sites. F2F service, coded in XML arbitrary XML...

8 (2)How to Program F2F. Hello World Service F2F servers are XML virtual machines. Input, output & internal workings are XML. Although required, the namespace is omitted for brevity from this point on. All instructions to F2F servers take the form: etc.

9 XML Stylesheet Language Transformations v1.0... is a 1999 W3C recommendation!... is a programming language expressed in XML.... transforms one XML document into another.... ‘side-effect free’, so cannot write files/send messages/ etc. http://www.w3.org/TR/xslt

10 Hello-World Service. Processing Service Requests We start by requesting the service: So this is implemented by the XSL template at hello.xslt The F2F server finds the matching service definition: Unique identifier Location on disk

11 Passing Arguments The XSL transforms it to an Output Document: The itself is the script’s Input Document: Hello World! Processing Service Requests Hello World!

12 Passing Arguments Nested Servicereqs Many languages pass a comma separated list of input parameters to a function: function browse($uri, $width, $height)‏ {...instructions here, in which $uri, $width and $height are replaced at run time by the values of the arguments given... } browse(“http://friend2friend.net”, 130, 500)‏http://friend2friend.net http://friend2friend.net 130 500 <!-- Transform here, which operates on the whole XML document --!> F2F passes an XML document:

13 Nested Servicereqs. Processing Directives browse(“http://friend2friend.net”, getwidth(), getheight())‏ By default, F2F starts with the deepest : Evaluation is usually from inside out: http://friend2friend.net 130500 130 <!-- Transform here, which gets the width. --!> <!-- Transform here, which gets the height. --!> <!-- Transform here, which operates on the whole XML document --!>

14 Tree-shaped Pipelines Nested items results in pipelining XML: Nested Servicereqs = Pipelined XML The interior outputs XML......which is fed into the exterior... XSL ex.1 XSL ex.2 XML pipelining is taking the input from one transform and feeding it into another:

15 Core Services The model allows trees of transforms. Tree-shaped Pipelines XSL 2B XSL 3 3b 3a XSL 2A 3c 2b XSL 1A XSL 1B 1a 2a22a1 1b

16 Saving Instructions About 80 hardcoded (non-XSLT) services extend the possibilities. e.g: Core Services Send/Receive http://friend2friend.net/services/send http://friend2friend.net/services/receive Read/Write XML data http://friend2friend.net/services/xml-write http://friend2friend.net/services/xml-read Read/Write the F2F Server http://friend2friend.net/services/access-get http://friend2friend.net/services/access-set Read/Write Files to disk http://friend2friend.net/services/fs-read http://friend2friend.net/services/fs-write

17 www.friend2friend.net F2F scripts use XSLT, extended with about 100 extra core functions. Nested items pipeline XML data & instructions. http://www.altruists.org/ff5 F2F servers are general purpose XML virtual machines. F2F servers are designed to form decentralised networks....


Download ppt "A presentation by Robin Upton (2009-03-12) ‏ latest version at www.altruists.org/ff4 Attribution – NonCommercial - ShareAlike www.altruists.org FF 404."

Similar presentations


Ads by Google