mirror of
https://github.com/davidgiven/fluxengine.git
synced 2025-10-31 11:17:01 -07:00
Add support for updating file metadata (only the SRA bits, really).
This commit is contained in:
@@ -193,7 +193,7 @@ public:
|
||||
uint32_t capabilities() const override
|
||||
{
|
||||
return OP_GETFSDATA | OP_LIST | OP_GETFILE | OP_PUTFILE | OP_DELETE |
|
||||
OP_GETDIRENT | OP_CREATE | OP_MOVE;
|
||||
OP_GETDIRENT | OP_CREATE | OP_MOVE | OP_PUTATTRS;
|
||||
}
|
||||
|
||||
std::map<std::string, std::string> getMetadata() override
|
||||
@@ -294,6 +294,42 @@ public:
|
||||
throw FileNotFoundException();
|
||||
}
|
||||
|
||||
void putMetadata(const Path& path,
|
||||
const std::map<std::string, std::string>& metadata) override
|
||||
{
|
||||
mount();
|
||||
if (path.size() != 1)
|
||||
throw BadPathException();
|
||||
|
||||
/* Only updating MODE is supported. */
|
||||
|
||||
if (metadata.empty())
|
||||
return;
|
||||
if ((metadata.size() != 1) || (metadata.begin()->first != MODE))
|
||||
throw UnimplementedFilesystemException();
|
||||
auto mode = metadata.begin()->second;
|
||||
|
||||
/* Update all dirents corresponding to this file. */
|
||||
|
||||
bool found = false;
|
||||
for (int d = 0; d < _config.dir_entries(); d++)
|
||||
{
|
||||
std::unique_ptr<Entry> entry = getEntry(d);
|
||||
if (entry->deleted)
|
||||
continue;
|
||||
if (path[0] == entry->combinedFilename())
|
||||
{
|
||||
entry->mode = mode;
|
||||
putEntry(entry);
|
||||
found = true;
|
||||
}
|
||||
}
|
||||
if (!found)
|
||||
throw FileNotFoundException();
|
||||
|
||||
unmount();
|
||||
}
|
||||
|
||||
Bytes getFile(const Path& path) override
|
||||
{
|
||||
mount();
|
||||
|
||||
Reference in New Issue
Block a user