Exemple #1
0
def syncMirror(setting, nodeid, path):
    '''Synchronize file entries on cloud to local directory.'''
    #Azure connection:
    conn = connectCloud(setting, nodeid)
    container_name = setting.nodeInfo[nodeid].bucketname
    #Sync cloud to mirror dir:
    objects = conn.list_blobs(container_name)
    for obj in objects:
        #Touch files in local directory:
        filename = obj
        # if filename.endswith('.metadata'):
        if filename.endswith('.node%d' % nodeid):
            storageutil.syncFile(setting, filename, path)
    return True
Exemple #2
0
def syncMirror(setting, nodeid, path):
    '''Synchronize file entries on cloud to local directory.'''
    #Azure connection:
    conn = connectCloud(setting, nodeid)
    container_name = setting.nodeInfo[nodeid].bucketname
    #Sync cloud to mirror dir:
    objects = conn.list_blobs(container_name)
    for obj in objects:
        #Touch files in local directory:
        filename = obj
        # if filename.endswith('.metadata'):
        if filename.endswith('.node%d' % nodeid):
            storageutil.syncFile(setting, filename, path)
    return True
Exemple #3
0
def syncMirror(setting, nodeid, path):
    '''Synchronize file entries on cloud to local directory.'''
    #S3connection:
    conn = connectCloud(setting, nodeid)
    bucketname = setting.nodeInfo[nodeid].bucketname
    #Sync cloud to mirror dir:
    bucket = conn.get_bucket(bucketname)
    objects = bucket.get_all_keys()
    for obj in objects:
        #Touch files in local directory:
        filename = obj.name
        # if filename.endswith('.metadata'):
        if filename.endswith('.node%d' % nodeid):
            storageutil.syncFile(setting, filename, path)
    return True
Exemple #4
0
def syncMirror(setting, nodeid, path):
    '''Synchronize file entries on cloud to local directory.'''
    #S3connection:
    conn = connectCloud(setting, nodeid)
    bucketname = setting.nodeInfo[nodeid].bucketname
    #Sync cloud to mirror dir:
    bucket = conn.get_bucket(bucketname)
    objects = bucket.get_all_keys()
    for obj in objects:
        #Touch files in local directory:
        filename = obj.name
        # if filename.endswith('.metadata'):
        if filename.endswith('.node%d' % nodeid):
            storageutil.syncFile(setting, filename, path)
    return True
Exemple #5
0
def syncMirror(setting, nodeid, path):
    """Synchronize file entries on cloud to local directory."""
    # Swift connection:
    conn = connectCloud(setting, nodeid)
    container_name = setting.nodeInfo[nodeid].bucketname
    # Sync cloud to mirror dir:
    container = conn.get_container(container_name)
    objects = container.get_objects()
    for obj in objects:
        # Touch files in local directory:
        filename = obj.name
        # if filename.endswith('.metadata'):
        if filename.endswith(".node%d" % nodeid):
            storageutil.syncFile(setting, filename, path)
    return True
Exemple #6
0
def syncMirror(setting, nodeid, path):
    '''Synchronize file entries on cloud to local directory.'''
    basedir = setting.nodeInfo[nodeid].bucketname
    #Sync cloud to mirror dir:
    for root, dirs, files in os.walk(basedir):
        #Touch files in local directory:
        for obj in files:
            filename = os.path.relpath(os.path.join(root, obj), basedir)
            # if filename.endswith('.metadata'):
            if setting.coding == 'replication':  #cq
                if filename.endswith('.node0') or filename.endswith('.pt'):
                    storageutil.syncFile(setting, filename, path)
            else:
                if filename.endswith('.node%d' % nodeid):
                    storageutil.syncFile(setting, filename, path)
    return True
Exemple #7
0
def syncMirror(setting, nodeid, path):
    '''Synchronize file entries on cloud to local directory.'''
    basedir = setting.nodeInfo[nodeid].bucketname
    #Sync cloud to mirror dir:
    for root, dirs, files in os.walk(basedir):
        #Touch files in local directory:
        for obj in files:
            filename = os.path.relpath(os.path.join(root, obj), basedir)
            # if filename.endswith('.metadata'):
            if setting.coding == 'replication': #cq
                if filename.endswith('.node0') or filename.endswith('.pt'):
                    storageutil.syncFile(setting, filename, path)
            else:
                if filename.endswith('.node%d' % nodeid):
                    storageutil.syncFile(setting, filename, path)
    return True
Exemple #8
0
def syncMirror(setting, nodeid, path):
    '''Synchronize file entries on cloud to local directory.'''
    #Dropbox connection:
    conn = connectCloud(setting, nodeid)
    bucketname = setting.nodeInfo[nodeid].bucketname
    #Sync cloud to mirror dir:
    folder_metadata = conn.metadata(bucketname)
    folder_contents = folder_metadata["contents"]
    for content in folder_contents:
        #Touch files in local directory:
        filename = os.path.relpath(content["path"],bucketname)
        #only sync certain file object
        if setting.coding == 'replication':
            if filename.endswith('.node0') or filename.endswith('.pt'):
                storageutil.syncFile(setting, filename, path)                
        else:
            if filename.endswith('.node%d' % nodeid):
                storageutil.syncFile(setting, filename, path)
    return True