3 d
= {'script' : 'rename', 'dentry_name' : pohmelfs_dentry_name
}
5 def pohmelfs_upload_dentry(new_dir_id
, new_name
, inode_info
):
8 dir_content
= n
.read_data(new_dir_id
, pohmelfs_offset
, pohmelfs_size
, pohmelfs_aflags
, pohmelfs_ioflags_read
)
11 if not 'No such file or directory' in str(e
):
13 s
.init(len(inode_info
))
15 s
.insert(new_name
, inode_info
, True)
16 content
= str(s
.save())
18 pohmelfs_write(new_dir_id
, content
)
20 logging
.info("uploaded directory content hosting new name %s", new_name
, extra
=d
)
23 binary_data
= __input_binary_data_tuple
[0]
24 old_dir_id
= elliptics_id(list(binary_data
[0:64]), pohmelfs_group_id
, pohmelfs_column
)
25 new_dir_id
= elliptics_id(list(binary_data
[64:128]), pohmelfs_group_id
, pohmelfs_column
)
27 inode_info
= binary_data
[128:128+80]
28 new_name
= str(binary_data
[128+80:])
31 dir_content
= n
.read_data(old_dir_id
, pohmelfs_offset
, pohmelfs_size
, pohmelfs_aflags
, pohmelfs_ioflags_read
)
34 ret
= s
.search(pohmelfs_dentry_name
)
36 raise KeyError("no entry")
38 if binary_data
[0:64] != binary_data
[64:128]:
39 pohmelfs_upload_dentry(new_dir_id
, new_name
, str(inode_info
))
41 s
.insert(new_name
, str(inode_info
), True)
43 s
.delete(pohmelfs_dentry_name
)
44 content
= str(s
.save())
46 pohmelfs_write(old_dir_id
, content
)
49 #logging.info("renamed -> %s: %s", new_name, parse(content), extra=d)
50 logging
.info("renamed -> %s", new_name
, extra
=d
)
58 logging
.error("key error: %s", e
.__str
__(), extra
=d
)
59 __return_data
= 'key error: ' + e
.__str
__()
60 except Exception as e
:
61 logging
.error("generic error: %s", e
.__str
__(), extra
=d
)
62 __return_data
= 'error: ' + e
.__str
__()