# SETUP ############################################################################### # Define the common parameters from the config file ACTIVEHOSTSFILE = config.activehostsfile OPLOG = config.oplog chunkPort = config.port # Initiallize an instance of the API, to be used for chunk replication api = API.API() # Initialize an instance of the heartBeat, to be used for ensuring connection # to chunkserver is actually active. hB = heartBeat.heartBeat() ############################################################################### # OBJECT DEFINITIONS ############################################################################### # The file object is stored in the data dictionary, keyed to its associated # fileName. The object holds its fileName, a delete flag, and a dictionary of # the chunks associated with it, where the chunk handle is the key, and the # chunk object is the value. class File: def __init__(self, name):
# As this does not need to be run continuously, we can define # how often we wish to run it. time.sleep(30) ####################################################################### # MAIN ####################################################################### # Initiate an instance of the database database = db.Database() # Initiate an instance of the heartBeat heartBeat = hB.heartBeat() if __name__ == "__main__": # Define the paths of the host file, activehost file from the config file, and # define the port to be used, also from the config file HOSTSFILE = config.hostsfile ACTIVEHOSTSFILE = config.activehostsfile chunkPort = config.port EOT = config.eot # Define a thread lock to be used to get and increment chunk handles threadLock = threading.Lock() # Run the heartBeat to make sure there is an up-to-date activehosts.txt file heartBeat.pumpBlood()
############################################################################### # SETUP ############################################################################### # Define the common parameters from the config file ACTIVEHOSTSFILE = config.activehostsfile OPLOG = config.oplog chunkPort = config.port # Initiallize an instance of the API, to be used for chunk replication api = API.API() # Initialize an instance of the heartBeat, to be used for ensuring connection # to chunkserver is actually active. hB = heartBeat.heartBeat() ############################################################################### # OBJECT DEFINITIONS ############################################################################### # The file object is stored in the data dictionary, keyed to its associated # fileName. The object holds its fileName, a delete flag, and a dictionary of # the chunks associated with it, where the chunk handle is the key, and the # chunk object is the value. class File: def __init__(self, name): self.fileName = name