Example #1
0
File: ida.py Project: diacus/celda
def disperse(fragment):
    """
    Disperse the FragmentStream instance.
    @param fragment: FragmentStream instnace
    @return list instance: contains the generated BlockStreams
    """
    conf     = SADConfig()
    dis      = conf.getdispath()
    cache    = conf.getstoragepath()
    bname    = "%s-%05d.frag" % (fragment.getfilename(),fragment.getpos())
    fragname = os.path.join( cache, bname )
    disp     = [ "%s-%d.ida" % (fragname, k) for k in range(5) ]
    inidis   = Messages.Dispersing % str(fragment)
    enddis   = Messages.Dispersed % str(fragment)
             
    fragment.savetofile(fragname)

    logging.info(inidis)
    subprocess.call([dis, fragname])
    logging.info(enddis)

    blocks = list()

    for k, d in enumerate(disp):
        b = BlockStream(
            os.path.basename(d),
            "IDA",
            fragment.getid(),
            k
        )
        b.loadfromfile(d)
        blocks.append(b)
    
    return blocks
Example #2
0
 def _localprocessblock( self, block ):
     """
     @param block: FragmentStream instance
     """
     conf = SADConfig()
     bname = os.path.join( conf.getstoragepath(), block.getfilename() )
     msg = Messages.ProcessingBlock % str(block)
     logging.info(msg)
     print msg
     block.savetofile( bname )
Example #3
0
def main():

	confpath = "/etc/celda/celdad.conf"
	conf = SADConfig()
	conf.setConfigfile(confpath)
	conf.loadConf()

	handler = ProxyHandler()
	proxy = Proxy()
	proxy.setHandler(handler)
	proxy.start()
Example #4
0
File: ida.py Project: diacus/celda
def recover(blockA, blockB, blocC):
    """
    Recovers the original file from the given blocks
    
    @param blockA: BlockStream instance
    @param blockB: BlockStream instance
    @param blockC: BlockStream instance
    
    @return A FragmentStream instance
    """

    conf     = SADConfig()
    rec      = conf.getrecpath()
    cache    = conf.getstoragepath()
    bnames   = list()
    for b in [blockA, blockB, blocC]:
        name = os.path.join( cache, b.getfilename() )
        b.savetofile(name)
        bname.append(name)

    fragname = blockA.getfilename()[:-6]
Example #5
0
 def __init__(self):
     """
     Class constructor
     """
     conf = SADConfig()
     self._host      = conf.getaddress()
     self._port      = conf.getport()
     self._storage   = conf.getstoragepath()
     self._dbase     = conf.getdb()
     self._msu       = conf.getmsu()
Example #6
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)