Exemple #1
0
def capture_id_data(id, time_with_microsec, collection):
    if id != '':
        if collection == '.Nodes':
            node = node_collection.find_one({"_id": ObjectId(str(id))})
        if collection == '.Triples':
            node = triple_collection.find_one({"_id": ObjectId(str(id))})
        if collection == '.fs.files':
            node = gridfs_collection.find_one({"_id": ObjectId(str(id))})
        if collection == '.fs.chunks':
            node = chunk_collection.find_one({"_id": ObjectId(str(id))})

        #create log file

        if node:
            print "every node passing through it", "the id", id
            capture_data(file_object=node,
                         file_data=None,
                         content_type='Genral',
                         time=time_with_microsec)
            with open("Registry.txt", 'a') as outfile:
                outfile.write(
                    str(time_with_microsec + "_" + str(node["_id"]) + ", " +
                        "Snapshot" + str(node.get("snapshot", 0)) +
                        ", Public key:" + SYNCDATA_KEY_PUB + ",Synced:{1}" +
                        "\n"))
Exemple #2
0
def process_dependent_collection(dependent_collection):
    for i in dependent_collection:
        i = (i[i.find('\''):i[i.find('\''):].find(')') +
               i.find('\'')]).strip('\'')
        if i != '':
            node = triple_collection.find_one({"_id": ObjectId(str(i))})
        capture_data(file_object=node, file_data=None, content_type='Genral')
Exemple #3
0
def capture_id_data(id,time_with_microsec,collection):
    if id != '':
        if collection == '.Nodes':
            node = node_collection.find_one({"_id":ObjectId(str(id))})
        if collection == '.Triples':
            node = triple_collection.find_one({"_id":ObjectId(str(id))})
        if collection == '.fs.files':
            node = gridfs_collection.find_one({"_id":ObjectId(str(id))})
        if collection == '.fs.chunks':
            node = chunk_collection.find_one({"_id":ObjectId(str(id))})
            
            
            
        #create log file

        if node:
                print "every node passing through it","the id",id
                capture_data(file_object=node, file_data=None, content_type='Genral',time=time_with_microsec)
                with open("Registry.txt", 'a') as outfile:
                    outfile.write(str(time_with_microsec + "_" + str(node["_id"]) + ", " +"Snapshot"+ str(node.get("snapshot",0)) +  ", Public key:" +SYNCDATA_KEY_PUB + ",Synced:{1}" +"\n" ))
Exemple #4
0
def process_dependent_collection(dependent_collection):
    for i in dependent_collection:
        i = (i[i.find('\''):i[i.find('\''):].find(')') + i.find('\'')]).strip('\'')
        if i != '':
            node = triple_collection.find_one({"_id":ObjectId(str(i))})
        capture_data(file_object=node, file_data=None, content_type='Genral')