Exemplo n.º 1
0
def get_data(blocknum, digest, result_queue):
    try:
        result = restlib.findvalue(digest, local=False)
        result_queue.put((blocknum, result))
    except Exception as e:
        print e
        result_queue.put((blocknum, None))
Exemplo n.º 2
0
manager = ServerManager()
manager.async_start_block_server(1234)
manager.async_start_block_server(1235)

try:
    data_chunks = [str(x) for x in xrange(10)]
    chunks_meta = coding.make_chunk_dicts(data_chunks)

    for chunk in chunks_meta:
        restlib.store(chunk['data'], chunk['digest'], local=False)

    print len(chunks_meta), "items stored"
    success = True
    for chunk in chunks_meta:
        data = restlib.findvalue(chunk['digest'])
        distrib_data = restlib.findvalue(chunk['digest'], local=False)
        if data != chunk['data']:
            print "DATA MISMATCH FOR DIGEST", chunk['digest']

        if distrib_data != chunk['data']:
            success = False
            print "DISTRIB DATA MISMATCH FOR DIGEST"
            print "Expecting", chunk['data'], "got", distrib_data
        
    if success:
        print len(chunks_meta), "items retrieved sucessfully"
        
finally:
    manager.kill_block_server(1234)
    manager.kill_block_server(1235)
Exemplo n.º 3
0
import coding
import restlib
from runner import ServerManager

manager = ServerManager()
manager.async_start_block_server(1234)

try:
    data_chunks = [str(x) for x in xrange(10)]
    chunks_meta = coding.make_chunk_dicts(data_chunks)

    for chunk in chunks_meta:
        restlib.store(chunk['data'], chunk['digest'])

    print len(chunks_meta), "items stored"
    success = True
    for chunk in chunks_meta:
        data = restlib.findvalue(chunk['digest'])
        if data != chunk['data']:
            success = False
            print "DATA MISMATCH FOR DIGEST", chunk['digest']
        
    if success:
        print len(chunks_meta), "items retrieved sucessfully"
finally:
    manager.kill_block_server(1234)
Exemplo n.º 4
0
def verify_chunks(chunks_meta):
    for chunk in chunks_meta:
        distrib_data = restlib.findvalue(chunk['digest'], local=False)
        if distrib_data != chunk['data']:
            return False
    return True