Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use string for chunkID to support UUIDs #544

Merged
merged 1 commit into from
Aug 31, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions brayns/tasks/AddModelFromBlobTask.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,14 @@ namespace brayns
{
struct Chunk
{
size_t id;
std::string id;
};

struct BinaryParam : ModelParams
{
size_t size{0}; //!< size in bytes of file
std::string type; //!< file extension or type (MESH, POINTS, CIRCUIT)
size_t chunksID{0};
std::string chunksID;
SERIALIZATION_FRIEND(BinaryParam)
};

Expand Down
6 changes: 3 additions & 3 deletions plugins/RocketsPlugin/BinaryRequests.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class BinaryRequests
return task;
}

void setNextChunkID(const size_t id) { _nextChunkID = id; }
void setNextChunkID(const std::string& id) { _nextChunkID = id; }
/** The receive and delegate of blobs to the AddModelFromBlobTask. */
rockets::ws::Response processMessage(const rockets::ws::Request& wsRequest)
{
Expand Down Expand Up @@ -102,9 +102,9 @@ class BinaryRequests
}

private:
using ClientRequestID = std::pair<uintptr_t, size_t>;
using ClientRequestID = std::pair<uintptr_t, std::string>;
std::map<ClientRequestID, std::shared_ptr<AddModelFromBlobTask>> _requests;
size_t _nextChunkID{0};
std::string _nextChunkID;
std::mutex _mutex;
};
}
4 changes: 2 additions & 2 deletions tests/addModelFromBlob.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ BOOST_AUTO_TEST_CASE(concurrent_requests)
return file.tellg();
}();
xyzParams.type = "xyz";
xyzParams.chunksID = 1;
xyzParams.chunksID = "coffee";
xyzParams.setPath("monkey.xyz");

auto xyzRequest =
Expand All @@ -363,7 +363,7 @@ BOOST_AUTO_TEST_CASE(concurrent_requests)
return file.tellg();
}();
objParams.type = "obj";
objParams.chunksID = 2;
objParams.chunksID = "1plus1equals2";
objParams.setName("bennu");

auto objRequest =
Expand Down