import anna.client as client import anna.lattices as lattices import time from datetime import datetime import argparse from multiprocessing import Process import random parser = argparse.ArgumentParser(description='Client to SIGCOMM demo') parser.add_argument('ip', type=str, help='IP address of the client.') parser.add_argument('key', type=str, help='Key that is used to save value.') parser.add_argument('nf_id', type=int, help='ID of the NF') args = parser.parse_args() kvs_client = client.AnnaTcpClient(args.ip, args.ip, local=True, offset=int(args.nf_id)) ITER_COUNT = 60 WAIT = 1 READ_BOUND = 10 WRITE_BOUND = 1 access_times = [] timestamp = int(time.time()*1000000) write_counter = 1 str_value = args.ip + "_" + str(write_counter) byte_value = str_value.encode() print(byte_value) value = lattices.LWWPairLattice(timestamp, byte_value)
import anna.client as client import anna.lattices as lattices import time import argparse parser = argparse.ArgumentParser(description='Client for test2. TODO: a description what this "NF" does in the test2.') parser.add_argument('ip', type=str, help='IP address of the client.') parser.add_argument('key', type=str, help='Key that is used to save value.') args = parser.parse_args() kvs_client = client.AnnaTcpClient(args.ip, args.ip, local=True) ITER_COUNT = 60 WAIT = 1 access_times = [] timestamp = int(time.time()*1000000) value = lattices.LWWPairLattice(timestamp, b'1') print("PUT") try: kvs_client.put(args.key, value) print("OK") except UnboundLocalError as e: print("TIMEOUT") ############################################################## time.sleep(2)