예제 #1
0
파일: test.py 프로젝트: stevenleigh/sib
bm = local_blob_manager()
commit_hash_3 = bm.commit_directory(key, '../resource/test_directory_3/root',
                                    os.path.join(peer_A_storage,
                                                 'test_share'), 'joe.keur',
                                    'third commit msg', commit_hash_2)
bm.restore_directory(key, '../resource/restore_directory_3',
                     os.path.join(peer_A_storage, 'test_share'), commit_hash_3)

print '\n\n'
print '************************************************************************'
print '***Testing network connections'
logging.debug('Testing network connections')
print '************************************************************************'
command_port = random.randint(20000, 50000)

peer_B = peer_service.peer_service(command_port)
peer_B_process = Process(target=peer_B.serve_forever)
peer_B_process.start()
time.sleep(0.1)  #wait for peer process and socket creation
print 'server start finished'

peer_A = peer_service.peer_service(command_port + 1)
peer_B_proxy = peer_A.pm.connect_machine(
    'machine_B', 'http://localhost:' + str(command_port))
print peer_B_proxy.ping()

time.sleep(0.1)
peer_B_process.terminate()

print '\n\n'
print '************************************************************************'
예제 #2
0
파일: test.py 프로젝트: stevenleigh/sib
    "joe.keur",
    "third commit msg",
    commit_hash_2,
)
bm.restore_directory(key, "../resource/restore_directory_3", os.path.join(peer_A_storage, "test_share"), commit_hash_3)


print "\n\n"
print "************************************************************************"
print "***Testing network connections"
logging.debug("Testing network connections")
print "************************************************************************"
command_port = random.randint(20000, 50000)


peer_B = peer_service.peer_service(command_port)
peer_B_process = Process(target=peer_B.serve_forever)
peer_B_process.start()
time.sleep(0.1)  # wait for peer process and socket creation
print "server start finished"


peer_A = peer_service.peer_service(command_port + 1)
peer_B_proxy = peer_A.pm.connect_machine("machine_B", "http://localhost:" + str(command_port))
print peer_B_proxy.ping()


time.sleep(0.1)
peer_B_process.terminate()

예제 #3
0
#my_storage = 'Home/temp/you_storage'
#my_working = 'Home/temp/you_working'









bm=local_blob_manager()


#initialize and start local peer service
peer_me = peer_service.peer_service(command_port)
peer_me.pm.storage_directory = my_storage
peer_me.pm.add_share_to_machine(share_ID, my_machine_ID)
peer_you_proxy = peer_me.pm.connect_machine('desktop', your_url)
peer_me_process = Process(target = peer_me.serve_forever)
peer_me_process.start()
time.sleep(0.1)  #wait for peer process and socket creation


#commands for managing local commits
bm.commit_directory(key, my_working, os.path.join(my_storage, share_ID), 'user_name','commit msg')
bm.restore_directory(key, my_working, os.path.join(my_storage, share_ID), 'commit_hash')


#commands for getting commits from peer
peer_you_proxy.get_all_commits(share_ID, my_machine_ID)