예제 #1
0
 def __init__(self, toPersist, threadName):
     AsyncService.__init__(self)
     self.isLoaded = Event()
     self.pause = Event()
     self.toPersist = toPersist
     self.data = {}
     self.setName(threadName)
예제 #2
0
    def __init__(self, threadName):
        AsyncService.__init__(self)

        self.port = str(CONFIG.getint('p2p', 'PORT'))
        self.fingerTable = []
        self.setName(threadName)
        self.host = socket.gethostbyname(socket.getfqdn()) + ":" + self.port

        self.chord = Chord(self)

        self.build_finger_table = Build_finger_table(self)
        print(sys.argv)
        if len(sys.argv) == 5:
            self.ringIp = sys.argv[1].strip()
            self.mBits = int(sys.argv[2].strip())
            self.number = int(sys.argv[3])
            self.id = int(sys.argv[4])

            self.chord.doJoin(self.ringIp,
                              ServerInfo(serverID=self.id, source=self.host))

        elif len(sys.argv) == 4:
            self.mBits = int(sys.argv[1])
            self.number = int(sys.argv[2])
            self.id = int(sys.argv[3])
        else:
            print("Arguments Invalid ([IP] M N ID) '0 < ID <= N'")
            sys.exit(1)

        print("My range is: [", self.toID(self.id - 1), ",",
              self.toID(self.id), ")")
예제 #3
0
 def __init__(self, node, requests, toLog, toPersist, toRedirect,
              threadName):
     AsyncService.__init__(self)
     self.requests = requests
     self.toLog = toLog
     self.toRedirect = toRedirect
     self.toPersist = toPersist
     self.pause = Event()
     self.node = node
예제 #4
0
    def __init__(self, requests, threadName):
        AsyncService.__init__(self)
        self.host = CONFIG.get('all', 'host')
        self.port = str(CONFIG.getint('all', 'PORT'))

        self.requests = requests

        self.recipients = []
        self.setName(threadName)
예제 #5
0
    def __init__(self, persistence, splitter):
        AsyncService.__init__(self)
        self.filename = CONFIG.get('all', 'FILENAME')
        #self.requests = requests
        self.persistence = persistence
        self.splitter = splitter
        self.time_inter_snap = 10
        self.toPersist = self.splitter.toPersist
        self.toLog = self.splitter.toLog
        self.pauseSplit = self.splitter.pause
        self.snapshot_version = 1
        self.digitSize = CONFIG.getint('backup', 'digitSize')
        self.verifySnapshotVersion()

        self.createIfNotFound(LOG_PATH)
        self.createIfNotFound(SNAP_PATH)

        self.load()
예제 #6
0
 def __init__(self, connection, address, requests, threadName):
     AsyncService.__init__(self)
     self.connection = connection
     self.address = address
     self.requests = requests
     self.setName(threadName)
예제 #7
0
 def __init__(self, node):
     AsyncService.__init__(self)
     self.node = node
     self.wait_time = CONFIG.getint('p2p', 'SLEEP_BUILD_FT')