SlideShare uma empresa Scribd logo
1 de 79
Baixar para ler offline
Sociable Software
(or “how you really already know
how to make concurrency for multicore
easy to work with”)




                                                          Michael Sparks
                                                         ms@cerenity.org
  http://kamaelia.sourceforge.net/Developers/   BBC Research & Innovation
Note added after barcamp




This presentation aims to show people that they already know
how to deal with concurrency.
It argues that if we have the tools for large scale concurrency
(mashups) and small scale (hardware) that midrange (normal
apps) can be done in a similar way, using existing tools.
This is done by showing useful systems that have been produced
in this manner using existing tools.
ie from existing practice, not theory




    http://kamaelia.sourceforge.net/Developers/             ms@cerenity.org
Note added after barcamp



During the actual presentation I also talked about Kamaelia
projects created by novice programmers of varying ability which
show high levels of concurrency.
These include: previewing PVR content on mobiles, multicast
island joining, as-live streaming using bit torrent, Open GL based
user interfaces & integration, seaside style webserving, speex
based secure phone, IRC/IM systems, a shakespeare script
player, and games tools.
Other systems created include Atom/RSS routing, memcached
integration, P2P whiteboarding (with audio + mixing), gesture
recognition, presentation tools, a kids development environment,
topology visualisation tools, database modelling etc.


   http://kamaelia.sourceforge.net/Developers/             ms@cerenity.org
Sociable Software

Core idea : “building systems that
are made of many software
systems that are sociable with
each other”

          (yes, this project did start at work, but I am primarily working
             on it in my own time at present due to a resource crunch :)
Sociable Software

ie it's comprised of systems that
talk to each other.
ie are sociable.
Comfortable examples
request
Web Browser


                         Web Server
              response
More sociable:




                     request
       Web Browser


                                           Web Server
                           RSS/Atom Feed
More sociable:




                      request
        Web Browser


                                            Web Server
                            RSS/Atom Feed




Kinda like your facebook mini-feed
General principle
                                Web Server
                     RSS/Atom Feed


       Web Browser

                                Web Server
                     RSS/Atom Feed




                                Web Server
                     RSS/Atom Feed
Mash ups
(next logical step)
Basic client side mashup
                                       Web Server
                                 RSS Feed




                                       Web Server
                       Some
                       client   Atom Feed




                                       Web Server
                                 Web API
Basic client side mashup
                                          Web Server
                                    RSS Feed




                                          Web Server
                          Some
                          client   Atom Feed




                                          Web Server
Example: Google Ads
                                    Web API
Basic client side mashup
                                                      Web Server
                                                RSS Feed




                                                      Web Server
                            Some
                            client             Atom Feed




                                                      Web Server
Example: Google Ads
         Or any similar sort of system          Web API
         ie using Javascript for transcludes
Mashup as a service
                                          Web Server
Some                                RSS Feed
client



                                          Web Server
                      Web Server   Atom Feed




                                          Web Server
                                    Web API
Mashup as a service
                                              Web Server
 Some                                   RSS Feed
 client



                                              Web Server
                          Web Server   Atom Feed




                                              Web Server
Example: gmap-pedometer
                                        Web API
More generally
                                        Web Server
Some                              RSS Feed
client



                                        Web Server
                    Web Server   Atom Feed
                 Service



                                        Web Server
                                  Web API
Go Crazy
(next logical step)
Web Server
                                         RSS Feed




                                              Web Server
                                        Atom Feed
                       Web Server
                  RSS Feed
                                                                Web Server
                                                           Web API        Web API
                       Web Server
  Web Server     Atom Feed
Service
                                                Web Server

                       Web Server          RSS Feed

                  Web API     Web API




                                                            Web Server
                                                                     Web API



    Web Server
 Service

                              `                            Web Server
                                                      Web API
Do you really think of it that way?
Got that?
(pretty common stuff yes?)
Let's look at something completely
different.
Formal verification of
asynchronous hardware
(Rainbow project, Manchester Uni. ~10 years old)
Doesn't really look
so very different
does it?
Even complex
examples look
similar.
Why?
They're comprised of systems that
talk to each other.
So what?
Both represent concurrent systems.
One is very high level.
One is incredibly low level.
The low level has the best tools and builds on
decades of experience of making things simpler.
They've made their lives easier
green Pipeline() =
    Random() >> buffer(1) >>
    Invert() >> buffer(1) >>
    Invert() >> buffer(1) >> sink
end
green Substituter() =
   chan thevalue,istwelve end
   function test(value x:integer) : boolean =
       x==12
   end
   Random() >> thevalue >> test() >> istwelve$
   thevalue >> if istwelve then
        sink$ source 0 >>
   else
        {}
   end_if >> sink
end
green Substituter() =
         chan thevalue,istwelve end
         function test(value x:integer) : boolean =



Um?
              x==12
         end
         Random() >> thevalue >> test() >> istwelve$
         thevalue >> if istwelve then
               sink$ source 0 >>
         else
               {}
         end_if >> sink
      end
green Substituter() =
                chan thevalue,istwelve end
                function test(value x:integer) : boolean =



Um?
                     x==12
                end
                Random() >> thevalue >> test() >> istwelve$
                thevalue >> if istwelve then
                      sink$ source 0 >>
                else
                      {}
                end_if >> sink
             end




That looks like software!
Can we write software that way
and still have it perform well,
and gain the same benefits?
YES!
Examples
Examples


 I am only going to show you non-trivial
 examples
 For more trivial examples, please look at the
 slides uploaded to slideshare.net/kamaelian
 and also the Kamaelia cookbook.
Examples
Email Greylisting Server: Kamaelia Grey

 Specifically written to deal with the ever growing
 spam problem I was facing
 Has eradicated my spam problem on my home
 server.
Examples
Email Greylisting Server:
                outbox




         Selector           inbox

                                    outbox



                         TCPServer              inbox



                                             Greylist
                                             Server
Examples
Email Greylisting Server: New Connection
                    outbox




        Selector                 inbox

                                          outbox


           outbox
                              TCPServer               inbox




                                 outbox
                                                   Greylist
                                 inbox
                                                   Server              inbox


                                                                               outbox
                      inbox
                             Connected
                              Socket
                                           inbox              outbox
                                                                          GreyListing
                              Adapter     outbox
                                           inbox                  inbox
                                                                            Policy
Examples
Email Greylisting Server: Many Connections
            Selector

                       TCPServer

                                   Greylist
                                   Server

                       Connected
                        Socket                GreyListing
                        Adapter                 Policy


                       Connected
                        Socket                GreyListing
                        Adapter                 Policy


                       Connected
                        Socket                GreyListing
                        Adapter                 Policy
Examples
Email Greylisting Core Code:
class GreylistServer(MoreComplexServer):
   logfile = config[quot;greylist_logquot;]
   ...
   port = config[quot;portquot;]
   socketOptions=(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)

  class TCPS(TCPServer):
    CSA = NoActivityTimeout(ConnectedSocketAdapter,
                            timeout=config[quot;inactivity_timeoutquot;])

  class protocol(GreyListingPolicy):
       servername = config[quot;servernamequot;]
       smtp_ip = config[quot;smtp_ipquot;]
       smtp_port = config[quot;smtp_portquot;]
       ...
Examples                                   Selector


Email Greylisting Core Code:                          TCPServer

                                                                  Greylist
                                                                  Server
class GreylistServer(MoreComplexServer):
   logfile = config[quot;greylist_logquot;]              Connected
                                                                             GreyListing
                                                  Socket
   ...                                            Adapter                      Policy
   port = config[quot;portquot;]
   socketOptions=(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)

  class TCPS(TCPServer):
    CSA = NoActivityTimeout(ConnectedSocketAdapter,
                            timeout=config[quot;inactivity_timeoutquot;])

  class protocol(GreyListingPolicy):
       servername = config[quot;servernamequot;]
       smtp_ip = config[quot;smtp_ipquot;]
       smtp_port = config[quot;smtp_portquot;]
       ...
Examples                                   Selector


Email Greylisting Core Code:                          TCPServer

                                                                  Greylist
                                                                  Server
class GreylistServer(MoreComplexServer):
   logfile = config[quot;greylist_logquot;]              Connected
                                                                             GreyListing
                                                  Socket
   ...                                            Adapter                      Policy
   port = config[quot;portquot;]
   socketOptions=(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)

  class TCPS(TCPServer):
    CSA = NoActivityTimeout(ConnectedSocketAdapter,
                            timeout=config[quot;inactivity_timeoutquot;])

  class protocol(GreyListingPolicy):
       servername = config[quot;servernamequot;]
       smtp_ip = config[quot;smtp_ipquot;]
       smtp_port = config[quot;smtp_portquot;]
       ...
Examples                                   Selector


Email Greylisting Core Code:                          TCPServer

                                                                  Greylist
                                                                  Server
class GreylistServer(MoreComplexServer):
   logfile = config[quot;greylist_logquot;]              Connected
                                                                             GreyListing
                                                  Socket
   ...                                            Adapter                      Policy
   port = config[quot;portquot;]
   socketOptions=(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)

  class TCPS(TCPServer):
    CSA = NoActivityTimeout(ConnectedSocketAdapter,
                            timeout=config[quot;inactivity_timeoutquot;])

  class protocol(GreyListingPolicy):
       servername = config[quot;servernamequot;]
       smtp_ip = config[quot;smtp_ipquot;]
       smtp_port = config[quot;smtp_portquot;]
       ...
Examples                                   Selector


Email Greylisting Core Code:                          TCPServer

                                                                  Greylist
                                                                  Server
class GreylistServer(MoreComplexServer):
   logfile = config[quot;greylist_logquot;]              Connected
                                                                             GreyListing
                                                  Socket
   ...                                            Adapter                      Policy
   port = config[quot;portquot;]
   socketOptions=(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)

  class TCPS(TCPServer):
    CSA = NoActivityTimeout(ConnectedSocketAdapter,
                            timeout=config[quot;inactivity_timeoutquot;])

  class protocol(GreyListingPolicy):
       servername = config[quot;servernamequot;]
       smtp_ip = config[quot;smtp_ipquot;]
       smtp_port = config[quot;smtp_portquot;]
       ...
Examples                                   Selector


Email Greylisting Core Code:                          TCPServer

                                                                  Greylist
                                                                  Server
class GreylistServer(MoreComplexServer):
   logfile = config[quot;greylist_logquot;]              Connected
                                                                             GreyListing
                                                  Socket
   ...                                            Adapter                      Policy
   port = config[quot;portquot;]
   socketOptions=(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)

  class TCPS(TCPServer):
    CSA = NoActivityTimeout(ConnectedSocketAdapter,
                            timeout=config[quot;inactivity_timeoutquot;])

  class protocol(GreyListingPolicy):
       servername = config[quot;servernamequot;]
       smtp_ip = config[quot;smtp_ipquot;]
       smtp_port = config[quot;smtp_portquot;]
       ...
Slightly less obvious than normal, but these
functions together form a factory.
              outbox




       Selector           inbox

                                  outbox



                       TCPServer              inbox



                                           Greylist
                                           Server
Slightly less obvious than normal, but these
functions together form a factory... so as to
create new things to handle connections:
           Selector

                      TCPServer

                                  Greylist
                                  Server

                      Connected
                       Socket                GreyListing
                       Adapter                 Policy
Slightly less obvious than normal, but these
functions together form a factory... so as to
create new things to handle connections:
           Selector

                      TCPServer

                                  Greylist
                                  Server

                      Connected
                       Socket                GreyListing
                       Adapter                 Policy


                      Connected
                       Socket                GreyListing
                       Adapter                 Policy
Slightly less obvious than normal, but these
functions together form a factory... so as to
create new things to handle connections:
           Selector

                      TCPServer

                                  Greylist
                                  Server

                      Connected
                       Socket                GreyListing
                       Adapter                 Policy


                      Connected
                       Socket                GreyListing
                       Adapter                 Policy


                      Connected
                       Socket                GreyListing
                       Adapter                 Policy
Examples
Kamaelia ER Modeller
Examples
Kamaelia ER Modeller

Intended for use in designing
databases. Created last
year because I had an
urgent need.
About a ½ day hack.
Examples
Kamaelia ER Modeller : Simple Example


 entity missionagent
 entity person(missionagent)
 entity team(missionagent)

 entity missionitem:
      simpleattributes visible

 entity activemission

 relation participatesin(activemission,missionagent)
 relation creates(missionagent,missionitem)
Examples
Kamaelia ER Modeller : More Complex Example


 entity missionagent
 entity person(missionagent):
     simpleattributes name
 entity team(missionagent):
     simpleattributes teamname
 entity mission
 entity activemission
 relation participatesin(activemission,missionagent)
 entity missionitem:
     simpleattributes visible
 relation creates(missionagent,missionitem)
 relation updates(missionagent,missionitem)
 entity textfrag(atomicitem)
 entity externalurl(atomicitem)
 ...
Examples
 Kamaelia ER Modeller : Internals
                           Pipeline                                        Pipeline

                                      FileReader                                  ConsoleEchoer


Pipeline                              ERParser                                        ERVisualiser

       Console Reader
                                ERModel2Visualiser                              lines_to_tokenlists


   PublishTo(“TOPOLOGY”)      PublishTo(“TOPOLOGY”)                          SubscribeTo(“TOPOLOGY”)




                                                   Backplane(“TOPOLOGY”)
Examples
 Kamaelia ER Modeller : Internals
                             Pipeline                                        Pipeline

                                        FileReader                                  ConsoleEchoer


Pipeline                                ERParser                                        ERVisualiser

       Console Reader
                           Backplane(quot;TOPOLOGYquot;).activate()
                                  ERModel2Visualiser                              lines_to_tokenlists


   PublishTo(“TOPOLOGY”)        PublishTo(“TOPOLOGY”)                          SubscribeTo(“TOPOLOGY”)




                                                     Backplane(“TOPOLOGY”)
Examples
 Kamaelia ER Modeller : Internals
                           Pipeline                                   Pipeline

                                  Pipeline(
                                   FileReader                  ConsoleEchoer

                                          ConsoleReader(quot;>>> quot;),
                                    ERParser                    ERVisualiser
Pipeline

       Console Reader
                                          PublishTo(quot;TOPOLOGYquot;),
                                  ).activate()
                                ERModel2Visualiser          lines_to_tokenlists


   PublishTo(“TOPOLOGY”)      PublishTo(“TOPOLOGY”)                     SubscribeTo(“TOPOLOGY”)




                                              Backplane(“TOPOLOGY”)
Examples
Kamaelia ER Modeller : Internals
       Pipeline(            Pipeline                       Pipeline

               ReadFileAdaptor(sys.argv[1]),
                                     ConsoleEchoer                    FileReader

               ERParser(),            ERVisualiser                    ERParser
Pipeline
               ERModel2Visualiser(),
       Console Reader
               PublishTo(quot;TOPOLOGYquot;),
                                  lines_to_tokenlists           ERModel2Visualiser


       ).activate()
   PublishTo(“TOPOLOGY”)      SubscribeTo(“TOPOLOGY”)         PublishTo(“TOPOLOGY”)




                                   Backplane(“TOPOLOGY”)
Examples
 Kamaelia ER Modeller : Internals
   Pipeline(               Pipeline                                    Pipeline

           SubscribeTo(quot;TOPOLOGYquot;), FileReader                                ConsoleEchoer

           lines_to_tokenlists(),
                                     ERParser                                     ERVisualiser
Pipeline
           ERVisualiser(
       Console Reader
                      screensize = (1024,768),
                                 ERModel2Visualiser                         lines_to_tokenlists

                      fullscreen = True
   PublishTo(“TOPOLOGY”)      PublishTo(“TOPOLOGY”)                      SubscribeTo(“TOPOLOGY”)
           ),
           ConsoleEchoer(),
   ).run()                                     Backplane(“TOPOLOGY”)
Examples
 Kamaelia ER Modeller : Internals
                                                                                         Pipeline                   Pipeline

Backplane(quot;TOPOLOGYquot;).activate()                                                                    FileReader            ConsoleEchoer


                                                                Pipeline                            ERParser               ERVisualiser
Pipeline(                                                            Console Reader
    ConsoleReader(quot;>>> quot;),                                                                  ERModel2Visualiser          lines_to_tokenlists

    PublishTo(quot;TOPOLOGYquot;),                                       PublishTo(“TOPOLOGY”)     PublishTo(“TOPOLOGY”)    SubscribeTo(“TOPOLOGY”)
).activate()

Pipeline(                                                                                   Backplane(“TOPOLOGY”)

    ReadFileAdaptor(sys.argv[1]),
    ERParser(),
    ERModel2Visualiser(),
    PublishTo(quot;TOPOLOGYquot;),
).activate()

Pipeline(
    SubscribeTo(quot;TOPOLOGYquot;),
    lines_to_tokenlists(),
    ERVisualiser(screensize = (1024,768), fullscreen = True),
    ConsoleEchoer(),
).run()
Examples
Kamaelia Macro
Examples
Kamaelia Macro

 It records and transcodes
 what is broadcast over DTT
 for future viewing.
Examples
Kamaelia Macro

   It records and transcodes
   what is broadcast over DTT
   for future viewing.
     17A.  ­ (1) The making in domestic premises for private and domestic use of a recording of a broadcast 
      solely for the purpose of enabling it to be viewed or listened to at a more convenient time does not 
      infringe any right conferred by Part 2 in relation to a performance or recording included in the 
      broadcast.
                       ­­ Timeshifting as defined by copyright
Examples
Kamaelia Macro
Examples
Kamaelia Macro: Top Level Schematic
                                              DVB Multiplex
     outbox




              inbox
                                   BBC_ONE          inbox   Channel Transcoder
                                   BBC_TWO          inbox   Channel Transcoder
                        DVB       BBC_THREE         inbox   Channel Transcoder
                      Demuxer  
                                  BBC_FOUR          inbox   Channel Transcoder
                                  CBEEBIES          inbox   Channel Transcoder

                                    CBBC            inbox   Channel Transcoder
Examples
Kamaelia Macro: Transcode progs on a Channel
     inbox


             inbox                     outbox   inbox
                         Splitter
                                                          Restartable
                 _eit_




                                                          Transcoder
                                                           transcoder_factory

                         inbox    Prog outbox      next

                                 Change
                                 Detector

      Channel Transcoder
Examples
Kamaelia Macro: Finding Programme Junctions
      inbox
              inbox
                                           inbox
               DVB Packet                          Now Next
              Reconstructor                         Parser
                               outbox
                                                             outbox


                                        inbox
                           Now Next                    Now Next
                                                                       inbox

                           Changes                    service filter
                  outbox
                                                    outbox

       EIT Parsing
                           outbox
Examples
Kamaelia Macro: Programme Transcoder
      inbox

     control                                                                     (a pipeline)

                             inbox                                     control
                                           Pipethrough
                                     (“mencoder ­o file options...”)               _stop

                            signal




     _transcodingcomplete                                                            signal


      Programme Transcoder
How?
What's inside the box?

 The following examples are largely simplified,
 simply because slides are a terrible way to
 show code.
 I've generally removed shutdown code.
How?
What's inside the box?
  class ConsoleReader(threadedcomponent):
     def main(self):
        while 1:
           line = raw_input(quot;>>quot;)
           line = line + self.eol
           self.send(line, quot;outboxquot;)
How?
What's inside the box?
  class ConsoleReader(threadedcomponent):
     def main(self):
        while 1:                            See – we're saying this
           line = raw_input(quot;>>quot;)           component runs inside it's
           line = line + self.eol           own thread. This is all we have
           self.send(line, quot;outboxquot;)        to write for it to work.
How?
What's inside the box?
  class ConsoleReader(threadedcomponent):
     def main(self):
        while 1:
           line = raw_input(quot;>>quot;)
           line = line + self.eol
           self.send(line, quot;outboxquot;)

                                            As you can see here, a
                                            component communicates
                                            with other components by
                                            sending things to outboxes.
How?
What's inside the box?
  class ConsoleEchoer(component):
     def main(self):
        while not self.shutdown():
            while self.dataReady(quot;inboxquot;):
                data = self.recv(quot;inboxquot;)
                sys.stdout.write(str(data))   Whereas here, you can see
                sys.stdout.flush()            that they listen for data in
            yield 1                           their inboxes. and then do
                                              stuff based on that!
How?
What's inside the box?
                                              This one however is a
  class ConsoleEchoer(component):             generator based component.
     def main(self):                          This runs in the same thread
        while not self.shutdown():            as all other generators,
            while self.dataReady(quot;inboxquot;):    making this code equivalent to
                data = self.recv(quot;inboxquot;)     a state machine. Note the
                sys.stdout.write(str(data))   baseclass does not say
                sys.stdout.flush()            threaded or generator.
            yield 1
How?
What's inside the box?
  class ConsoleEchoer(component):
     def main(self):
        while not self.shutdown():
            while self.dataReady(quot;inboxquot;):
                data = self.recv(quot;inboxquot;)
                sys.stdout.write(str(data))
                sys.stdout.flush()
            yield 1
                    This yield keyword is what makes
                    this method a generator. For
                    now, you can assume it acts like
                    a “return back here when next
                    called” thing. It's NOT really the
                    same at all as a ruby yield!
And that's the basic idea.
 On the website there's a mini axon tutorial and a
 guide to writing components, and a few
 magazine articles as well which should get you
 started.
 There are also more tutorials on slideshare
 Please also ask on #kamaelia on freenode.
Thank you:-)

Mais conteúdo relacionado

Semelhante a Sociable Software

Semelhante a Sociable Software (20)

Deep Dive on Serverless App Development
Deep Dive on Serverless App DevelopmentDeep Dive on Serverless App Development
Deep Dive on Serverless App Development
 
Deep Dive On Serverless App Development
Deep Dive On Serverless App DevelopmentDeep Dive On Serverless App Development
Deep Dive On Serverless App Development
 
Serverless Developer Experience I AWS Dev Day 2018
Serverless Developer Experience I AWS Dev Day 2018Serverless Developer Experience I AWS Dev Day 2018
Serverless Developer Experience I AWS Dev Day 2018
 
戦う情シス!全社 API で社内アプリ開発を加速させよう
戦う情シス!全社 API で社内アプリ開発を加速させよう戦う情シス!全社 API で社内アプリ開発を加速させよう
戦う情シス!全社 API で社内アプリ開発を加速させよう
 
The serverless LAMP stack
The serverless LAMP stackThe serverless LAMP stack
The serverless LAMP stack
 
Build and run applications without thinking about servers
Build and run applications without thinking about serversBuild and run applications without thinking about servers
Build and run applications without thinking about servers
 
Restful Web Services
Restful Web ServicesRestful Web Services
Restful Web Services
 
(ATS4-DEV04) Protocols as RESTful Services and RESTful URL Routing
(ATS4-DEV04) Protocols as RESTful Services and RESTful URL Routing(ATS4-DEV04) Protocols as RESTful Services and RESTful URL Routing
(ATS4-DEV04) Protocols as RESTful Services and RESTful URL Routing
 
Application Lifecycle Management in a Serverless World | AWS Public Sector Su...
Application Lifecycle Management in a Serverless World | AWS Public Sector Su...Application Lifecycle Management in a Serverless World | AWS Public Sector Su...
Application Lifecycle Management in a Serverless World | AWS Public Sector Su...
 
Rs on Rails 2011
Rs on Rails 2011Rs on Rails 2011
Rs on Rails 2011
 
Serverless Development Deep Dive
Serverless Development Deep DiveServerless Development Deep Dive
Serverless Development Deep Dive
 
re:Invent ARC307 - Serverless architectural patterns and best practices.pdf
re:Invent ARC307 - Serverless architectural patterns and best practices.pdfre:Invent ARC307 - Serverless architectural patterns and best practices.pdf
re:Invent ARC307 - Serverless architectural patterns and best practices.pdf
 
Meet AWS SAM
Meet AWS SAMMeet AWS SAM
Meet AWS SAM
 
Getting Started with AWS Lambda and Serverless Computing
Getting Started with AWS Lambda and Serverless ComputingGetting Started with AWS Lambda and Serverless Computing
Getting Started with AWS Lambda and Serverless Computing
 
Serverless APIs and you
Serverless APIs and youServerless APIs and you
Serverless APIs and you
 
Cloud Security-how to create serverless applications
Cloud Security-how to create serverless applicationsCloud Security-how to create serverless applications
Cloud Security-how to create serverless applications
 
Migrating your .NET Applications to the AWS Serverless Platform
Migrating your .NET Applications to the AWS Serverless PlatformMigrating your .NET Applications to the AWS Serverless Platform
Migrating your .NET Applications to the AWS Serverless Platform
 
Modern Architectures with Spring and JavaScript
Modern Architectures with Spring and JavaScriptModern Architectures with Spring and JavaScript
Modern Architectures with Spring and JavaScript
 
Mike Taulty MIX10 Silverlight 4 Patterns Frameworks
Mike Taulty MIX10 Silverlight 4 Patterns FrameworksMike Taulty MIX10 Silverlight 4 Patterns Frameworks
Mike Taulty MIX10 Silverlight 4 Patterns Frameworks
 
Dev309 from asgard to zuul - netflix oss-final
Dev309  from asgard to zuul - netflix oss-finalDev309  from asgard to zuul - netflix oss-final
Dev309 from asgard to zuul - netflix oss-final
 

Mais de kamaelian

Mais de kamaelian (19)

Kamaelia lightning2010opensource
Kamaelia lightning2010opensourceKamaelia lightning2010opensource
Kamaelia lightning2010opensource
 
Kamaelia Europython Tutorial
Kamaelia Europython TutorialKamaelia Europython Tutorial
Kamaelia Europython Tutorial
 
Embracing concurrency for fun utility and simpler code
Embracing concurrency for fun utility and simpler codeEmbracing concurrency for fun utility and simpler code
Embracing concurrency for fun utility and simpler code
 
Kamaelia Protocol Walkthrough
Kamaelia Protocol WalkthroughKamaelia Protocol Walkthrough
Kamaelia Protocol Walkthrough
 
Sharing Data and Services Safely in Concurrent Systems using Kamaelia
Sharing Data and Services Safely in Concurrent Systems using KamaeliaSharing Data and Services Safely in Concurrent Systems using Kamaelia
Sharing Data and Services Safely in Concurrent Systems using Kamaelia
 
Practical concurrent systems made simple using Kamaelia
Practical concurrent systems made simple using KamaeliaPractical concurrent systems made simple using Kamaelia
Practical concurrent systems made simple using Kamaelia
 
Kamaelia Grey
Kamaelia GreyKamaelia Grey
Kamaelia Grey
 
Open Source at the BBC: When, Why, Why not & How
Open Source at the BBC: When, Why, Why not & HowOpen Source at the BBC: When, Why, Why not & How
Open Source at the BBC: When, Why, Why not & How
 
Open Source at the BBC
Open Source at the BBCOpen Source at the BBC
Open Source at the BBC
 
Kamaelia - Fave 2005
Kamaelia - Fave 2005Kamaelia - Fave 2005
Kamaelia - Fave 2005
 
SWP - A Generic Language Parser
SWP - A Generic Language ParserSWP - A Generic Language Parser
SWP - A Generic Language Parser
 
Kamaelia - Networking Using Generators
Kamaelia - Networking Using GeneratorsKamaelia - Networking Using Generators
Kamaelia - Networking Using Generators
 
Timeshift Everything, Miss Nothing - Mashup your PVR with Kamaelia
Timeshift Everything, Miss Nothing - Mashup your PVR with KamaeliaTimeshift Everything, Miss Nothing - Mashup your PVR with Kamaelia
Timeshift Everything, Miss Nothing - Mashup your PVR with Kamaelia
 
Scaling Streaming - Concepts, Research, Goals
Scaling Streaming - Concepts, Research, GoalsScaling Streaming - Concepts, Research, Goals
Scaling Streaming - Concepts, Research, Goals
 
Kamaelia Internals
Kamaelia InternalsKamaelia Internals
Kamaelia Internals
 
Managing Creativity
Managing CreativityManaging Creativity
Managing Creativity
 
Building systems with Kamaelia
Building systems with KamaeliaBuilding systems with Kamaelia
Building systems with Kamaelia
 
Free software: How does it work?
Free software: How does it work?Free software: How does it work?
Free software: How does it work?
 
The Selfish Programmer
The Selfish ProgrammerThe Selfish Programmer
The Selfish Programmer
 

Último

The Abortion pills for sale in Qatar@Doha [+27737758557] []Deira Dubai Kuwait
The Abortion pills for sale in Qatar@Doha [+27737758557] []Deira Dubai KuwaitThe Abortion pills for sale in Qatar@Doha [+27737758557] []Deira Dubai Kuwait
The Abortion pills for sale in Qatar@Doha [+27737758557] []Deira Dubai Kuwait
daisycvs
 
Call Girls From Pari Chowk Greater Noida ❤️8448577510 ⊹Best Escorts Service I...
Call Girls From Pari Chowk Greater Noida ❤️8448577510 ⊹Best Escorts Service I...Call Girls From Pari Chowk Greater Noida ❤️8448577510 ⊹Best Escorts Service I...
Call Girls From Pari Chowk Greater Noida ❤️8448577510 ⊹Best Escorts Service I...
lizamodels9
 
Al Mizhar Dubai Escorts +971561403006 Escorts Service In Al Mizhar
Al Mizhar Dubai Escorts +971561403006 Escorts Service In Al MizharAl Mizhar Dubai Escorts +971561403006 Escorts Service In Al Mizhar
Al Mizhar Dubai Escorts +971561403006 Escorts Service In Al Mizhar
allensay1
 
FULL ENJOY Call Girls In Majnu Ka Tilla, Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Majnu Ka Tilla, Delhi Contact Us 8377877756FULL ENJOY Call Girls In Majnu Ka Tilla, Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Majnu Ka Tilla, Delhi Contact Us 8377877756
dollysharma2066
 
Russian Call Girls In Gurgaon ❤️8448577510 ⊹Best Escorts Service In 24/7 Delh...
Russian Call Girls In Gurgaon ❤️8448577510 ⊹Best Escorts Service In 24/7 Delh...Russian Call Girls In Gurgaon ❤️8448577510 ⊹Best Escorts Service In 24/7 Delh...
Russian Call Girls In Gurgaon ❤️8448577510 ⊹Best Escorts Service In 24/7 Delh...
lizamodels9
 
Call Girls Kengeri Satellite Town Just Call 👗 7737669865 👗 Top Class Call Gir...
Call Girls Kengeri Satellite Town Just Call 👗 7737669865 👗 Top Class Call Gir...Call Girls Kengeri Satellite Town Just Call 👗 7737669865 👗 Top Class Call Gir...
Call Girls Kengeri Satellite Town Just Call 👗 7737669865 👗 Top Class Call Gir...
amitlee9823
 
Call Girls In Nangloi Rly Metro ꧂…….95996 … 13876 Enjoy ꧂Escort
Call Girls In Nangloi Rly Metro ꧂…….95996 … 13876 Enjoy ꧂EscortCall Girls In Nangloi Rly Metro ꧂…….95996 … 13876 Enjoy ꧂Escort
Call Girls In Nangloi Rly Metro ꧂…….95996 … 13876 Enjoy ꧂Escort
dlhescort
 
Call Girls From Raj Nagar Extension Ghaziabad❤️8448577510 ⊹Best Escorts Servi...
Call Girls From Raj Nagar Extension Ghaziabad❤️8448577510 ⊹Best Escorts Servi...Call Girls From Raj Nagar Extension Ghaziabad❤️8448577510 ⊹Best Escorts Servi...
Call Girls From Raj Nagar Extension Ghaziabad❤️8448577510 ⊹Best Escorts Servi...
lizamodels9
 
Call Now ☎️🔝 9332606886🔝 Call Girls ❤ Service In Bhilwara Female Escorts Serv...
Call Now ☎️🔝 9332606886🔝 Call Girls ❤ Service In Bhilwara Female Escorts Serv...Call Now ☎️🔝 9332606886🔝 Call Girls ❤ Service In Bhilwara Female Escorts Serv...
Call Now ☎️🔝 9332606886🔝 Call Girls ❤ Service In Bhilwara Female Escorts Serv...
Anamikakaur10
 
Call Girls in Delhi, Escort Service Available 24x7 in Delhi 959961-/-3876
Call Girls in Delhi, Escort Service Available 24x7 in Delhi 959961-/-3876Call Girls in Delhi, Escort Service Available 24x7 in Delhi 959961-/-3876
Call Girls in Delhi, Escort Service Available 24x7 in Delhi 959961-/-3876
dlhescort
 

Último (20)

Business Model Canvas (BMC)- A new venture concept
Business Model Canvas (BMC)-  A new venture conceptBusiness Model Canvas (BMC)-  A new venture concept
Business Model Canvas (BMC)- A new venture concept
 
(Anamika) VIP Call Girls Napur Call Now 8617697112 Napur Escorts 24x7
(Anamika) VIP Call Girls Napur Call Now 8617697112 Napur Escorts 24x7(Anamika) VIP Call Girls Napur Call Now 8617697112 Napur Escorts 24x7
(Anamika) VIP Call Girls Napur Call Now 8617697112 Napur Escorts 24x7
 
Phases of Negotiation .pptx
 Phases of Negotiation .pptx Phases of Negotiation .pptx
Phases of Negotiation .pptx
 
Call Girls Service In Old Town Dubai ((0551707352)) Old Town Dubai Call Girl ...
Call Girls Service In Old Town Dubai ((0551707352)) Old Town Dubai Call Girl ...Call Girls Service In Old Town Dubai ((0551707352)) Old Town Dubai Call Girl ...
Call Girls Service In Old Town Dubai ((0551707352)) Old Town Dubai Call Girl ...
 
The Abortion pills for sale in Qatar@Doha [+27737758557] []Deira Dubai Kuwait
The Abortion pills for sale in Qatar@Doha [+27737758557] []Deira Dubai KuwaitThe Abortion pills for sale in Qatar@Doha [+27737758557] []Deira Dubai Kuwait
The Abortion pills for sale in Qatar@Doha [+27737758557] []Deira Dubai Kuwait
 
Uneak White's Personal Brand Exploration Presentation
Uneak White's Personal Brand Exploration PresentationUneak White's Personal Brand Exploration Presentation
Uneak White's Personal Brand Exploration Presentation
 
Call Girls From Pari Chowk Greater Noida ❤️8448577510 ⊹Best Escorts Service I...
Call Girls From Pari Chowk Greater Noida ❤️8448577510 ⊹Best Escorts Service I...Call Girls From Pari Chowk Greater Noida ❤️8448577510 ⊹Best Escorts Service I...
Call Girls From Pari Chowk Greater Noida ❤️8448577510 ⊹Best Escorts Service I...
 
Al Mizhar Dubai Escorts +971561403006 Escorts Service In Al Mizhar
Al Mizhar Dubai Escorts +971561403006 Escorts Service In Al MizharAl Mizhar Dubai Escorts +971561403006 Escorts Service In Al Mizhar
Al Mizhar Dubai Escorts +971561403006 Escorts Service In Al Mizhar
 
👉Chandigarh Call Girls 👉9878799926👉Just Call👉Chandigarh Call Girl In Chandiga...
👉Chandigarh Call Girls 👉9878799926👉Just Call👉Chandigarh Call Girl In Chandiga...👉Chandigarh Call Girls 👉9878799926👉Just Call👉Chandigarh Call Girl In Chandiga...
👉Chandigarh Call Girls 👉9878799926👉Just Call👉Chandigarh Call Girl In Chandiga...
 
Cheap Rate Call Girls In Noida Sector 62 Metro 959961乂3876
Cheap Rate Call Girls In Noida Sector 62 Metro 959961乂3876Cheap Rate Call Girls In Noida Sector 62 Metro 959961乂3876
Cheap Rate Call Girls In Noida Sector 62 Metro 959961乂3876
 
FULL ENJOY Call Girls In Majnu Ka Tilla, Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Majnu Ka Tilla, Delhi Contact Us 8377877756FULL ENJOY Call Girls In Majnu Ka Tilla, Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Majnu Ka Tilla, Delhi Contact Us 8377877756
 
Russian Call Girls In Gurgaon ❤️8448577510 ⊹Best Escorts Service In 24/7 Delh...
Russian Call Girls In Gurgaon ❤️8448577510 ⊹Best Escorts Service In 24/7 Delh...Russian Call Girls In Gurgaon ❤️8448577510 ⊹Best Escorts Service In 24/7 Delh...
Russian Call Girls In Gurgaon ❤️8448577510 ⊹Best Escorts Service In 24/7 Delh...
 
Call Girls Kengeri Satellite Town Just Call 👗 7737669865 👗 Top Class Call Gir...
Call Girls Kengeri Satellite Town Just Call 👗 7737669865 👗 Top Class Call Gir...Call Girls Kengeri Satellite Town Just Call 👗 7737669865 👗 Top Class Call Gir...
Call Girls Kengeri Satellite Town Just Call 👗 7737669865 👗 Top Class Call Gir...
 
Famous Olympic Siblings from the 21st Century
Famous Olympic Siblings from the 21st CenturyFamous Olympic Siblings from the 21st Century
Famous Olympic Siblings from the 21st Century
 
Call Girls In Nangloi Rly Metro ꧂…….95996 … 13876 Enjoy ꧂Escort
Call Girls In Nangloi Rly Metro ꧂…….95996 … 13876 Enjoy ꧂EscortCall Girls In Nangloi Rly Metro ꧂…….95996 … 13876 Enjoy ꧂Escort
Call Girls In Nangloi Rly Metro ꧂…….95996 … 13876 Enjoy ꧂Escort
 
Whitefield CALL GIRL IN 98274*61493 ❤CALL GIRLS IN ESCORT SERVICE❤CALL GIRL
Whitefield CALL GIRL IN 98274*61493 ❤CALL GIRLS IN ESCORT SERVICE❤CALL GIRLWhitefield CALL GIRL IN 98274*61493 ❤CALL GIRLS IN ESCORT SERVICE❤CALL GIRL
Whitefield CALL GIRL IN 98274*61493 ❤CALL GIRLS IN ESCORT SERVICE❤CALL GIRL
 
Call Girls From Raj Nagar Extension Ghaziabad❤️8448577510 ⊹Best Escorts Servi...
Call Girls From Raj Nagar Extension Ghaziabad❤️8448577510 ⊹Best Escorts Servi...Call Girls From Raj Nagar Extension Ghaziabad❤️8448577510 ⊹Best Escorts Servi...
Call Girls From Raj Nagar Extension Ghaziabad❤️8448577510 ⊹Best Escorts Servi...
 
Call Now ☎️🔝 9332606886🔝 Call Girls ❤ Service In Bhilwara Female Escorts Serv...
Call Now ☎️🔝 9332606886🔝 Call Girls ❤ Service In Bhilwara Female Escorts Serv...Call Now ☎️🔝 9332606886🔝 Call Girls ❤ Service In Bhilwara Female Escorts Serv...
Call Now ☎️🔝 9332606886🔝 Call Girls ❤ Service In Bhilwara Female Escorts Serv...
 
Call Girls in Delhi, Escort Service Available 24x7 in Delhi 959961-/-3876
Call Girls in Delhi, Escort Service Available 24x7 in Delhi 959961-/-3876Call Girls in Delhi, Escort Service Available 24x7 in Delhi 959961-/-3876
Call Girls in Delhi, Escort Service Available 24x7 in Delhi 959961-/-3876
 
Malegaon Call Girls Service ☎ ️82500–77686 ☎️ Enjoy 24/7 Escort Service
Malegaon Call Girls Service ☎ ️82500–77686 ☎️ Enjoy 24/7 Escort ServiceMalegaon Call Girls Service ☎ ️82500–77686 ☎️ Enjoy 24/7 Escort Service
Malegaon Call Girls Service ☎ ️82500–77686 ☎️ Enjoy 24/7 Escort Service
 

Sociable Software

  • 1. Sociable Software (or “how you really already know how to make concurrency for multicore easy to work with”) Michael Sparks ms@cerenity.org http://kamaelia.sourceforge.net/Developers/ BBC Research & Innovation
  • 2. Note added after barcamp This presentation aims to show people that they already know how to deal with concurrency. It argues that if we have the tools for large scale concurrency (mashups) and small scale (hardware) that midrange (normal apps) can be done in a similar way, using existing tools. This is done by showing useful systems that have been produced in this manner using existing tools. ie from existing practice, not theory http://kamaelia.sourceforge.net/Developers/ ms@cerenity.org
  • 3. Note added after barcamp During the actual presentation I also talked about Kamaelia projects created by novice programmers of varying ability which show high levels of concurrency. These include: previewing PVR content on mobiles, multicast island joining, as-live streaming using bit torrent, Open GL based user interfaces & integration, seaside style webserving, speex based secure phone, IRC/IM systems, a shakespeare script player, and games tools. Other systems created include Atom/RSS routing, memcached integration, P2P whiteboarding (with audio + mixing), gesture recognition, presentation tools, a kids development environment, topology visualisation tools, database modelling etc. http://kamaelia.sourceforge.net/Developers/ ms@cerenity.org
  • 4. Sociable Software Core idea : “building systems that are made of many software systems that are sociable with each other” (yes, this project did start at work, but I am primarily working on it in my own time at present due to a resource crunch :)
  • 5. Sociable Software ie it's comprised of systems that talk to each other. ie are sociable.
  • 7. request Web Browser Web Server response
  • 8. More sociable: request Web Browser Web Server RSS/Atom Feed
  • 9. More sociable: request Web Browser Web Server RSS/Atom Feed Kinda like your facebook mini-feed
  • 10. General principle Web Server RSS/Atom Feed Web Browser Web Server RSS/Atom Feed Web Server RSS/Atom Feed
  • 12. Basic client side mashup Web Server RSS Feed Web Server Some client Atom Feed Web Server Web API
  • 13. Basic client side mashup Web Server RSS Feed Web Server Some client Atom Feed Web Server Example: Google Ads Web API
  • 14. Basic client side mashup Web Server RSS Feed Web Server Some client Atom Feed Web Server Example: Google Ads Or any similar sort of system Web API ie using Javascript for transcludes
  • 15. Mashup as a service Web Server Some RSS Feed client Web Server Web Server Atom Feed Web Server Web API
  • 16. Mashup as a service Web Server Some RSS Feed client Web Server Web Server Atom Feed Web Server Example: gmap-pedometer Web API
  • 17. More generally Web Server Some RSS Feed client Web Server Web Server Atom Feed Service Web Server Web API
  • 19. Web Server RSS Feed Web Server Atom Feed Web Server RSS Feed Web Server Web API Web API Web Server Web Server Atom Feed Service Web Server Web Server RSS Feed Web API Web API Web Server Web API Web Server Service ` Web Server Web API
  • 20. Do you really think of it that way?
  • 21.
  • 23. Let's look at something completely different.
  • 24. Formal verification of asynchronous hardware (Rainbow project, Manchester Uni. ~10 years old)
  • 25. Doesn't really look so very different does it?
  • 27. Why?
  • 28. They're comprised of systems that talk to each other.
  • 30. Both represent concurrent systems. One is very high level. One is incredibly low level. The low level has the best tools and builds on decades of experience of making things simpler. They've made their lives easier
  • 31. green Pipeline() = Random() >> buffer(1) >> Invert() >> buffer(1) >> Invert() >> buffer(1) >> sink end
  • 32. green Substituter() = chan thevalue,istwelve end function test(value x:integer) : boolean = x==12 end Random() >> thevalue >> test() >> istwelve$ thevalue >> if istwelve then sink$ source 0 >> else {} end_if >> sink end
  • 33. green Substituter() = chan thevalue,istwelve end function test(value x:integer) : boolean = Um? x==12 end Random() >> thevalue >> test() >> istwelve$ thevalue >> if istwelve then sink$ source 0 >> else {} end_if >> sink end
  • 34. green Substituter() = chan thevalue,istwelve end function test(value x:integer) : boolean = Um? x==12 end Random() >> thevalue >> test() >> istwelve$ thevalue >> if istwelve then sink$ source 0 >> else {} end_if >> sink end That looks like software!
  • 35. Can we write software that way and still have it perform well, and gain the same benefits?
  • 36. YES!
  • 38. Examples I am only going to show you non-trivial examples For more trivial examples, please look at the slides uploaded to slideshare.net/kamaelian and also the Kamaelia cookbook.
  • 39. Examples Email Greylisting Server: Kamaelia Grey Specifically written to deal with the ever growing spam problem I was facing Has eradicated my spam problem on my home server.
  • 40. Examples Email Greylisting Server: outbox Selector inbox outbox TCPServer inbox Greylist Server
  • 41. Examples Email Greylisting Server: New Connection outbox Selector inbox outbox outbox TCPServer inbox outbox Greylist inbox Server inbox outbox inbox Connected Socket inbox outbox GreyListing Adapter outbox inbox inbox Policy
  • 42. Examples Email Greylisting Server: Many Connections Selector TCPServer Greylist Server Connected Socket GreyListing Adapter Policy Connected Socket GreyListing Adapter Policy Connected Socket GreyListing Adapter Policy
  • 43. Examples Email Greylisting Core Code: class GreylistServer(MoreComplexServer): logfile = config[quot;greylist_logquot;] ... port = config[quot;portquot;] socketOptions=(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) class TCPS(TCPServer): CSA = NoActivityTimeout(ConnectedSocketAdapter, timeout=config[quot;inactivity_timeoutquot;]) class protocol(GreyListingPolicy): servername = config[quot;servernamequot;] smtp_ip = config[quot;smtp_ipquot;] smtp_port = config[quot;smtp_portquot;] ...
  • 44. Examples Selector Email Greylisting Core Code: TCPServer Greylist Server class GreylistServer(MoreComplexServer): logfile = config[quot;greylist_logquot;] Connected GreyListing Socket ... Adapter Policy port = config[quot;portquot;] socketOptions=(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) class TCPS(TCPServer): CSA = NoActivityTimeout(ConnectedSocketAdapter, timeout=config[quot;inactivity_timeoutquot;]) class protocol(GreyListingPolicy): servername = config[quot;servernamequot;] smtp_ip = config[quot;smtp_ipquot;] smtp_port = config[quot;smtp_portquot;] ...
  • 45. Examples Selector Email Greylisting Core Code: TCPServer Greylist Server class GreylistServer(MoreComplexServer): logfile = config[quot;greylist_logquot;] Connected GreyListing Socket ... Adapter Policy port = config[quot;portquot;] socketOptions=(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) class TCPS(TCPServer): CSA = NoActivityTimeout(ConnectedSocketAdapter, timeout=config[quot;inactivity_timeoutquot;]) class protocol(GreyListingPolicy): servername = config[quot;servernamequot;] smtp_ip = config[quot;smtp_ipquot;] smtp_port = config[quot;smtp_portquot;] ...
  • 46. Examples Selector Email Greylisting Core Code: TCPServer Greylist Server class GreylistServer(MoreComplexServer): logfile = config[quot;greylist_logquot;] Connected GreyListing Socket ... Adapter Policy port = config[quot;portquot;] socketOptions=(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) class TCPS(TCPServer): CSA = NoActivityTimeout(ConnectedSocketAdapter, timeout=config[quot;inactivity_timeoutquot;]) class protocol(GreyListingPolicy): servername = config[quot;servernamequot;] smtp_ip = config[quot;smtp_ipquot;] smtp_port = config[quot;smtp_portquot;] ...
  • 47. Examples Selector Email Greylisting Core Code: TCPServer Greylist Server class GreylistServer(MoreComplexServer): logfile = config[quot;greylist_logquot;] Connected GreyListing Socket ... Adapter Policy port = config[quot;portquot;] socketOptions=(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) class TCPS(TCPServer): CSA = NoActivityTimeout(ConnectedSocketAdapter, timeout=config[quot;inactivity_timeoutquot;]) class protocol(GreyListingPolicy): servername = config[quot;servernamequot;] smtp_ip = config[quot;smtp_ipquot;] smtp_port = config[quot;smtp_portquot;] ...
  • 48. Examples Selector Email Greylisting Core Code: TCPServer Greylist Server class GreylistServer(MoreComplexServer): logfile = config[quot;greylist_logquot;] Connected GreyListing Socket ... Adapter Policy port = config[quot;portquot;] socketOptions=(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) class TCPS(TCPServer): CSA = NoActivityTimeout(ConnectedSocketAdapter, timeout=config[quot;inactivity_timeoutquot;]) class protocol(GreyListingPolicy): servername = config[quot;servernamequot;] smtp_ip = config[quot;smtp_ipquot;] smtp_port = config[quot;smtp_portquot;] ...
  • 49. Slightly less obvious than normal, but these functions together form a factory. outbox Selector inbox outbox TCPServer inbox Greylist Server
  • 50. Slightly less obvious than normal, but these functions together form a factory... so as to create new things to handle connections: Selector TCPServer Greylist Server Connected Socket GreyListing Adapter Policy
  • 51. Slightly less obvious than normal, but these functions together form a factory... so as to create new things to handle connections: Selector TCPServer Greylist Server Connected Socket GreyListing Adapter Policy Connected Socket GreyListing Adapter Policy
  • 52. Slightly less obvious than normal, but these functions together form a factory... so as to create new things to handle connections: Selector TCPServer Greylist Server Connected Socket GreyListing Adapter Policy Connected Socket GreyListing Adapter Policy Connected Socket GreyListing Adapter Policy
  • 54. Examples Kamaelia ER Modeller Intended for use in designing databases. Created last year because I had an urgent need. About a ½ day hack.
  • 55. Examples Kamaelia ER Modeller : Simple Example entity missionagent entity person(missionagent) entity team(missionagent) entity missionitem: simpleattributes visible entity activemission relation participatesin(activemission,missionagent) relation creates(missionagent,missionitem)
  • 56. Examples Kamaelia ER Modeller : More Complex Example entity missionagent entity person(missionagent): simpleattributes name entity team(missionagent): simpleattributes teamname entity mission entity activemission relation participatesin(activemission,missionagent) entity missionitem: simpleattributes visible relation creates(missionagent,missionitem) relation updates(missionagent,missionitem) entity textfrag(atomicitem) entity externalurl(atomicitem) ...
  • 57. Examples Kamaelia ER Modeller : Internals Pipeline Pipeline FileReader ConsoleEchoer Pipeline ERParser ERVisualiser Console Reader ERModel2Visualiser lines_to_tokenlists PublishTo(“TOPOLOGY”) PublishTo(“TOPOLOGY”) SubscribeTo(“TOPOLOGY”) Backplane(“TOPOLOGY”)
  • 58. Examples Kamaelia ER Modeller : Internals Pipeline Pipeline FileReader ConsoleEchoer Pipeline ERParser ERVisualiser Console Reader Backplane(quot;TOPOLOGYquot;).activate() ERModel2Visualiser lines_to_tokenlists PublishTo(“TOPOLOGY”) PublishTo(“TOPOLOGY”) SubscribeTo(“TOPOLOGY”) Backplane(“TOPOLOGY”)
  • 59. Examples Kamaelia ER Modeller : Internals Pipeline Pipeline Pipeline( FileReader ConsoleEchoer ConsoleReader(quot;>>> quot;), ERParser ERVisualiser Pipeline Console Reader PublishTo(quot;TOPOLOGYquot;), ).activate() ERModel2Visualiser lines_to_tokenlists PublishTo(“TOPOLOGY”) PublishTo(“TOPOLOGY”) SubscribeTo(“TOPOLOGY”) Backplane(“TOPOLOGY”)
  • 60. Examples Kamaelia ER Modeller : Internals Pipeline( Pipeline Pipeline ReadFileAdaptor(sys.argv[1]), ConsoleEchoer FileReader ERParser(), ERVisualiser ERParser Pipeline ERModel2Visualiser(), Console Reader PublishTo(quot;TOPOLOGYquot;), lines_to_tokenlists ERModel2Visualiser ).activate() PublishTo(“TOPOLOGY”) SubscribeTo(“TOPOLOGY”) PublishTo(“TOPOLOGY”) Backplane(“TOPOLOGY”)
  • 61. Examples Kamaelia ER Modeller : Internals Pipeline( Pipeline Pipeline SubscribeTo(quot;TOPOLOGYquot;), FileReader ConsoleEchoer lines_to_tokenlists(), ERParser ERVisualiser Pipeline ERVisualiser( Console Reader screensize = (1024,768), ERModel2Visualiser lines_to_tokenlists fullscreen = True PublishTo(“TOPOLOGY”) PublishTo(“TOPOLOGY”) SubscribeTo(“TOPOLOGY”) ), ConsoleEchoer(), ).run() Backplane(“TOPOLOGY”)
  • 62. Examples Kamaelia ER Modeller : Internals Pipeline Pipeline Backplane(quot;TOPOLOGYquot;).activate() FileReader ConsoleEchoer Pipeline ERParser ERVisualiser Pipeline( Console Reader ConsoleReader(quot;>>> quot;), ERModel2Visualiser lines_to_tokenlists PublishTo(quot;TOPOLOGYquot;), PublishTo(“TOPOLOGY”) PublishTo(“TOPOLOGY”) SubscribeTo(“TOPOLOGY”) ).activate() Pipeline( Backplane(“TOPOLOGY”) ReadFileAdaptor(sys.argv[1]), ERParser(), ERModel2Visualiser(), PublishTo(quot;TOPOLOGYquot;), ).activate() Pipeline( SubscribeTo(quot;TOPOLOGYquot;), lines_to_tokenlists(), ERVisualiser(screensize = (1024,768), fullscreen = True), ConsoleEchoer(), ).run()
  • 64. Examples Kamaelia Macro It records and transcodes what is broadcast over DTT for future viewing.
  • 65. Examples Kamaelia Macro It records and transcodes what is broadcast over DTT for future viewing.      17A.  ­ (1) The making in domestic premises for private and domestic use of a recording of a broadcast  solely for the purpose of enabling it to be viewed or listened to at a more convenient time does not  infringe any right conferred by Part 2 in relation to a performance or recording included in the  broadcast. ­­ Timeshifting as defined by copyright
  • 67. Examples Kamaelia Macro: Top Level Schematic DVB Multiplex outbox inbox BBC_ONE inbox Channel Transcoder BBC_TWO inbox Channel Transcoder DVB   BBC_THREE inbox Channel Transcoder Demuxer   BBC_FOUR inbox Channel Transcoder CBEEBIES inbox Channel Transcoder CBBC inbox Channel Transcoder
  • 68. Examples Kamaelia Macro: Transcode progs on a Channel inbox inbox outbox inbox Splitter Restartable _eit_ Transcoder transcoder_factory inbox Prog outbox next Change Detector Channel Transcoder
  • 69. Examples Kamaelia Macro: Finding Programme Junctions inbox inbox inbox DVB Packet Now Next Reconstructor Parser outbox outbox inbox Now Next Now Next inbox Changes service filter outbox outbox EIT Parsing outbox
  • 70. Examples Kamaelia Macro: Programme Transcoder inbox control (a pipeline) inbox control Pipethrough (“mencoder ­o file options...”) _stop signal _transcodingcomplete signal Programme Transcoder
  • 71. How? What's inside the box? The following examples are largely simplified, simply because slides are a terrible way to show code. I've generally removed shutdown code.
  • 72. How? What's inside the box? class ConsoleReader(threadedcomponent): def main(self): while 1: line = raw_input(quot;>>quot;) line = line + self.eol self.send(line, quot;outboxquot;)
  • 73. How? What's inside the box? class ConsoleReader(threadedcomponent): def main(self): while 1: See – we're saying this line = raw_input(quot;>>quot;) component runs inside it's line = line + self.eol own thread. This is all we have self.send(line, quot;outboxquot;) to write for it to work.
  • 74. How? What's inside the box? class ConsoleReader(threadedcomponent): def main(self): while 1: line = raw_input(quot;>>quot;) line = line + self.eol self.send(line, quot;outboxquot;) As you can see here, a component communicates with other components by sending things to outboxes.
  • 75. How? What's inside the box? class ConsoleEchoer(component): def main(self): while not self.shutdown(): while self.dataReady(quot;inboxquot;): data = self.recv(quot;inboxquot;) sys.stdout.write(str(data)) Whereas here, you can see sys.stdout.flush() that they listen for data in yield 1 their inboxes. and then do stuff based on that!
  • 76. How? What's inside the box? This one however is a class ConsoleEchoer(component): generator based component. def main(self): This runs in the same thread while not self.shutdown(): as all other generators, while self.dataReady(quot;inboxquot;): making this code equivalent to data = self.recv(quot;inboxquot;) a state machine. Note the sys.stdout.write(str(data)) baseclass does not say sys.stdout.flush() threaded or generator. yield 1
  • 77. How? What's inside the box? class ConsoleEchoer(component): def main(self): while not self.shutdown(): while self.dataReady(quot;inboxquot;): data = self.recv(quot;inboxquot;) sys.stdout.write(str(data)) sys.stdout.flush() yield 1 This yield keyword is what makes this method a generator. For now, you can assume it acts like a “return back here when next called” thing. It's NOT really the same at all as a ruby yield!
  • 78. And that's the basic idea. On the website there's a mini axon tutorial and a guide to writing components, and a few magazine articles as well which should get you started. There are also more tutorials on slideshare Please also ask on #kamaelia on freenode.