Пример #1
0
def main():
    """docstring for main"""
    fname = "/home/diacus/Dropbox/src/celda/file/opensuse.pdf"
    fconf = "/etc/celda/celdad.conf"

    conf = SADConfig()
    conf.setconfigfile(fconf)
    conf.loadconf()

    dis, rec = conf.getidapath()
    path     = conf.getstoragepath()

    server = "http://192.168.86.99:4242"
    client = NodeClient(server)

    logging.basicConfig(
        format='%(asctime)s -- %(levelname)-8s %(message)s',
        filename="test.log",
        level=logging.DEBUG
    )

    fragment = FragmentStream(1, 0, "IDA")
    fragment.loadfromfile(fname)
Пример #2
0
                b.registerblock( self._dbase, node.getid() )
                if self.itsme( node ) :
                    self._localprocessblock(b)
                else:
                    node.client.sendblock(b)


    def processfragment(self, (check, fdata) ):
        """
        @param sdata FragmentStream instance data

        @raise CorruptedFile: Raise this exception if the given checksum
        doesn't match with the stream's checksum 
        """

        fragment = FragmentStream()
        fragment.load(fdata)

        if not check == fragment.checksum():
            del fragment
            raise CorruptedFile

        self._localprocessfragment(fragment)

    def _localprocessblock( self, block ):
        """
        @param block: FragmentStream instance
        """
        conf = SADConfig()
        bname = os.path.join( conf.getstoragepath(), block.getfilename() )
        msg = Messages.ProcessingBlock % str(block)