How to use the riffle.SetFabricLocal function in Riffle

To help you get started, we’ve selected a few Riffle examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github exis-io / Exis / python / example / test-restart-client.py View on Github external
# Template Setup
import riffle
from riffle import want

riffle.SetFabricLocal()
riffle.SetLogLevelDebug()

class GenericDomain(riffle.Domain):

    def onJoin(self):
        # End Template Setup
        ######################################################################################
        # Example Test Restart before call - Does restarting before a call work?
        import time
        # Trying to restart the node before the call happens, but need to insert artificial delay to make this happen!
        print "___NODERESTART___"
        time.sleep(4.0)
        s = backend.call("restartBeforeC", "Restart before call").wait(str)
        print(s) # Expects a str, like "Restart before call works"
        # End Example Test Restart before call
github exis-io / Exis / python / example / test-numeric-client.py View on Github external
# Template Setup
import riffle
from riffle import want

riffle.SetFabricLocal()
riffle.SetLogLevelDebug()

class GenericDomain(riffle.Domain):

    def onJoin(self):
        # End Template Setup
        ######################################################################################
        # E-ample Test Reg/Call Big Ints - should be big
        i = backend.call("sendBigInt", 9223372036854775807).wait(int)
        print("{:d}".format(int(i))) # Expects a str, like "9223372036854775807"
        # End E-ample Test Reg/Call Big Ints

        print "___SETUPCOMPLETE___"

# Template Setup
app = riffle.Domain("xs.demo.test") # ARBITER $DOMAIN replaces "xs.demo.test"
github exis-io / Exis / python / example / test-restart-backend.py View on Github external
# Template Setup
import riffle
from riffle import want

riffle.SetFabricLocal()
riffle.SetLogLevelDebug()

class GenericDomain(riffle.Domain):

    def onJoin(self):
        # End Template Setup
        ######################################################################################
        # Example Test Restart before call - Does restarting before a call work?
        @want(str)
        def restartBeforeC(s):
            print(s) # Expects a str, like "Restart before call"
            return "{} works".format(s)
        self.register("restartBeforeC", restartBeforeC)
        # End Example Test Restart before call
        
        # Example Test Restart after reg - Does restarting after a register work
github exis-io / Exis / python / example / reg-client.py View on Github external
# Template Setup
import riffle
from riffle import want

riffle.SetFabricLocal()
riffle.SetLogLevelDebug()

class GenericDomain(riffle.Domain):

    def onJoin(self):
        # End Template Setup
        
        # Example Reg/Call str str - Basic reg expects string, returns string
        s = backend.call("regStrStr", "Hello").wait(str)
        print s # Expects a str, like "Hello World"
        # End Example Reg/Call str str
        
        # Example Reg/Call str int - Basic reg expects string, returns int
        i = backend.call("regStrInt", "Hello").wait(int)
        print i # Expects an int, like 42
        # End Example Reg/Call str int
github exis-io / Exis / python / example / tour-reg-client.py View on Github external
# Template Setup
import riffle
from riffle import want

riffle.SetFabricLocal()
riffle.SetLogLevelDebug()

class GenericDomain(riffle.Domain):

    def onJoin(self):
        # End Template Setup
        
        ######################################################################################
        # Example Tour Reg/Call Lesson 1 - our first basic example
        s = backend.call("myFirstFunc", "Hello").wait(str)
        print s # Expects a str, like "Hello World"
        # End Example Tour Reg/Call Lesson 1

        ######################################################################################
        # Example Tour Reg/Call Lesson 2 Works - type enforcement good
        s = backend.call("iWantStrings", "Hi").wait(str)
github exis-io / Exis / python / example / tour-basics-client.py View on Github external
# Template Setup
import riffle
from riffle import want

riffle.SetFabricLocal()
riffle.SetLogLevelDebug()

class GenericDomain(riffle.Domain):

    def onJoin(self):
        # End Template Setup
        
        # Example Tour Basics 1 - simple print
        # ARBITER set action simple
        print "Hello World"
        # End Example Tour Basics 1
        
        # Example Tour Basics 2 - async NOTE this code won't run since pub/sub is in line
        for i in range(0, 10):
            backend.publish("async", i)
        # End Example Tour Basics 2
github exis-io / Exis / python / example / tour-sub-client.py View on Github external
# Template Setup
import riffle
from riffle import want

riffle.SetFabricLocal()
riffle.SetLogLevelDebug()

class GenericDomain(riffle.Domain):

    def onJoin(self):
        # End Template Setup
        
        ######################################################################################
        # Example Tour Pub/Sub Lesson 1 - our first basic example
        backend.publish("myFirstSub", "Hello")
        # End Example Tour Pub/Sub Lesson 1

        ######################################################################################
        # Example Tour Pub/Sub Lesson 2 Works - type enforcement good
        backend.publish("iWantStrings", "Hi")
        # End Example Tour Pub/Sub Lesson 2 Works
github exis-io / Exis / python / example / sub-client.py View on Github external
import riffle

riffle.SetFabricLocal()
riffle.SetLogLevelDebug()


class Send(riffle.Domain):

    def onJoin(self):

        # Example Pub/Sub Basic - This is a basic pub/sub
        backend.publish("basicSub", "Hello")
        # End Example Pub/Sub Basic

        # Example Pub/Sub Objects - This tests sending an object using pub/sub
        class Stuff(riffle.ModelObject):
            name = "This guy"

        s = Stuff()
github exis-io / Exis / python / example / reg-backend.py View on Github external
# Template Setup
import riffle
from riffle import want

riffle.SetFabricLocal()
riffle.SetLogLevelDebug()

class GenericDomain(riffle.Domain):

    def onJoin(self):
        # End Template Setup
        # Example Reg/Call str str - Basic reg expects string, returns string
        @want(str)
        def regStrStr(s):
            print(s)  # Expects a str, like "Hello"
            return "Hello World"
        self.register("regStrStr", regStrStr)
        # End Example Reg/Call str str
        
        # Example Reg/Call str int - Basic reg expects string, returns int
        @want(str)
github exis-io / Exis / python / example / adv-backend.py View on Github external
# Template Setup
import riffle
from riffle import want

riffle.SetFabricLocal()
riffle.SetLogLevelDebug()

class GenericDomain(riffle.Domain):

    def onJoin(self):
        # End Template Setup

        ######################################################
        # TODO this would be an advanced setup to show how leave would work
        class Logger(riffle.Domain):
            @want([str])
            def pushLogs(self, l):
                self.logs.extend(l)

            def pullLogs(self):
                return self.logs