Skip to content
Permalink
Browse files

Add most unimplemented functions to the remote storage driver.

Add pathCreate(), pathRemove(), pathSync(), and remove() to the driver.

Contributed by Cynthia Shang.
  • Loading branch information...
cmwshang authored and dwsteele committed May 20, 2019
1 parent bbf2e0d commit a839830333490555800377ea095d756765f476e4
@@ -13,6 +13,17 @@

<release-list>
<release date="XXXX-XX-XX" version="2.15dev" title="UNDER DEVELOPMENT">
<release-core-list>
<release-development-list>
<release-item>
<release-item-contributor-list>
<release-item-contributor id="cynthia.shang"/>
</release-item-contributor-list>

<p>Add most unimplemented functions to the remote storage driver.</p>
</release-item>
</release-development-list>
</release-core-list>
</release>

<release date="2019-05-20" version="2.14" title="Bug Fix and Improvements">
@@ -19,7 +19,11 @@ STRING_EXTERN(PROTOCOL_COMMAND_STORAGE_EXISTS_STR, PROTOCOL_COM
STRING_EXTERN(PROTOCOL_COMMAND_STORAGE_LIST_STR, PROTOCOL_COMMAND_STORAGE_LIST);
STRING_EXTERN(PROTOCOL_COMMAND_STORAGE_OPEN_READ_STR, PROTOCOL_COMMAND_STORAGE_OPEN_READ);
STRING_EXTERN(PROTOCOL_COMMAND_STORAGE_OPEN_WRITE_STR, PROTOCOL_COMMAND_STORAGE_OPEN_WRITE);
STRING_EXTERN(PROTOCOL_COMMAND_STORAGE_PATH_CREATE_STR, PROTOCOL_COMMAND_STORAGE_PATH_CREATE);
STRING_EXTERN(PROTOCOL_COMMAND_STORAGE_PATH_EXISTS_STR, PROTOCOL_COMMAND_STORAGE_PATH_EXISTS);
STRING_EXTERN(PROTOCOL_COMMAND_STORAGE_PATH_REMOVE_STR, PROTOCOL_COMMAND_STORAGE_PATH_REMOVE);
STRING_EXTERN(PROTOCOL_COMMAND_STORAGE_PATH_SYNC_STR, PROTOCOL_COMMAND_STORAGE_PATH_SYNC);
STRING_EXTERN(PROTOCOL_COMMAND_STORAGE_REMOVE_STR, PROTOCOL_COMMAND_STORAGE_REMOVE);

/***********************************************************************************************************************************
Regular expressions
@@ -165,6 +169,14 @@ storageRemoteProtocol(const String *command, const VariantList *paramList, Proto

protocolServerResponse(server, NULL);
}
else if (strEq(command, PROTOCOL_COMMAND_STORAGE_PATH_CREATE_STR))
{
interface.pathCreate(
driver, storagePathNP(storage, varStr(varLstGet(paramList, 0))), varBool(varLstGet(paramList, 1)),
varBool(varLstGet(paramList, 2)), varUIntForce(varLstGet(paramList, 3)));

protocolServerResponse(server, NULL);
}
else if (strEq(command, PROTOCOL_COMMAND_STORAGE_PATH_EXISTS_STR))
{
// Not all drivers implement pathExists()
@@ -173,6 +185,26 @@ storageRemoteProtocol(const String *command, const VariantList *paramList, Proto
protocolServerResponse(server, VARBOOL( // The unusual line break is to make coverage happy -- not sure why
interface.pathExists(driver, storagePathNP(storage, varStr(varLstGet(paramList, 0))))));
}
else if (strEq(command, PROTOCOL_COMMAND_STORAGE_PATH_REMOVE_STR))
{
interface.pathRemove
(driver, storagePathNP(storage, varStr(varLstGet(paramList, 0))), varBool(varLstGet(paramList, 1)),
varBool(varLstGet(paramList, 2)));

protocolServerResponse(server, NULL);
}
else if (strEq(command, PROTOCOL_COMMAND_STORAGE_PATH_SYNC_STR))
{
interface.pathSync(driver, storagePathNP(storage, varStr(varLstGet(paramList, 0))), varBool(varLstGet(paramList, 1)));

protocolServerResponse(server, NULL);
}
else if (strEq(command, PROTOCOL_COMMAND_STORAGE_REMOVE_STR))
{
interface.remove(driver, storagePathNP(storage, varStr(varLstGet(paramList, 0))), varBool(varLstGet(paramList, 1)));

protocolServerResponse(server, NULL);
}
else
found = false;
}
@@ -21,8 +21,16 @@ Constants
STRING_DECLARE(PROTOCOL_COMMAND_STORAGE_OPEN_READ_STR);
#define PROTOCOL_COMMAND_STORAGE_OPEN_WRITE "storageOpenWrite"
STRING_DECLARE(PROTOCOL_COMMAND_STORAGE_OPEN_WRITE_STR);
#define PROTOCOL_COMMAND_STORAGE_PATH_CREATE "storagePathCreate"
STRING_DECLARE(PROTOCOL_COMMAND_STORAGE_PATH_CREATE_STR);
#define PROTOCOL_COMMAND_STORAGE_PATH_EXISTS "storagePathExists"
STRING_DECLARE(PROTOCOL_COMMAND_STORAGE_PATH_EXISTS_STR);
#define PROTOCOL_COMMAND_STORAGE_REMOVE "storageRemove"
STRING_DECLARE(PROTOCOL_COMMAND_STORAGE_REMOVE_STR);
#define PROTOCOL_COMMAND_STORAGE_PATH_REMOVE "storagePathRemove"
STRING_DECLARE(PROTOCOL_COMMAND_STORAGE_PATH_REMOVE_STR);
#define PROTOCOL_COMMAND_STORAGE_PATH_SYNC "storagePathSync"
STRING_DECLARE(PROTOCOL_COMMAND_STORAGE_PATH_SYNC_STR);

/***********************************************************************************************************************************
Functions
@@ -184,7 +184,17 @@ storageRemotePathCreate(THIS_VOID, const String *path, bool errorOnExists, bool
ASSERT(this != NULL);
ASSERT(path != NULL);

THROW(AssertError, "NOT YET IMPLEMENTED");
MEM_CONTEXT_TEMP_BEGIN()
{
ProtocolCommand *command = protocolCommandNew(PROTOCOL_COMMAND_STORAGE_PATH_CREATE_STR);
protocolCommandParamAdd(command, VARSTR(path));
protocolCommandParamAdd(command, VARBOOL(errorOnExists));
protocolCommandParamAdd(command, VARBOOL(noParentCreate));
protocolCommandParamAdd(command, VARUINT(mode));

protocolClientExecute(this->client, command, false);
}
MEM_CONTEXT_TEMP_END();

FUNCTION_LOG_RETURN_VOID();
}
@@ -236,7 +246,16 @@ storageRemotePathRemove(THIS_VOID, const String *path, bool errorOnMissing, bool
ASSERT(this != NULL);
ASSERT(path != NULL);

THROW(AssertError, "NOT YET IMPLEMENTED");
MEM_CONTEXT_TEMP_BEGIN()
{
ProtocolCommand *command = protocolCommandNew(PROTOCOL_COMMAND_STORAGE_PATH_REMOVE_STR);
protocolCommandParamAdd(command, VARSTR(path));
protocolCommandParamAdd(command, VARBOOL(errorOnMissing));
protocolCommandParamAdd(command, VARBOOL(recurse));

protocolClientExecute(this->client, command, false);
}
MEM_CONTEXT_TEMP_END();

FUNCTION_LOG_RETURN_VOID();
}
@@ -258,7 +277,15 @@ storageRemotePathSync(THIS_VOID, const String *path, bool ignoreMissing)
ASSERT(this != NULL);
ASSERT(path != NULL);

THROW(AssertError, "NOT YET IMPLEMENTED");
MEM_CONTEXT_TEMP_BEGIN()
{
ProtocolCommand *command = protocolCommandNew(PROTOCOL_COMMAND_STORAGE_PATH_SYNC_STR);
protocolCommandParamAdd(command, VARSTR(path));
protocolCommandParamAdd(command, VARBOOL(ignoreMissing));

protocolClientExecute(this->client, command, false);
}
MEM_CONTEXT_TEMP_END();

FUNCTION_LOG_RETURN_VOID();
}
@@ -280,7 +307,15 @@ storageRemoteRemove(THIS_VOID, const String *file, bool errorOnMissing)
ASSERT(this != NULL);
ASSERT(file != NULL);

THROW(AssertError, "NOT YET IMPLEMENTED");
MEM_CONTEXT_TEMP_BEGIN()
{
ProtocolCommand *command = protocolCommandNew(PROTOCOL_COMMAND_STORAGE_REMOVE_STR);
protocolCommandParamAdd(command, VARSTR(file));
protocolCommandParamAdd(command, VARBOOL(errorOnMissing));

protocolClientExecute(this->client, command, false);
}
MEM_CONTEXT_TEMP_END();

FUNCTION_LOG_RETURN_VOID();
}
@@ -525,7 +525,7 @@ unit:

# ----------------------------------------------------------------------------------------------------------------------------
- name: remote
total: 6
total: 10
perlReq: true

coverage:

0 comments on commit a839830

Please sign in to comment.
You can’t perform that action at this time.