Skip to content

Instantly share code, notes, and snippets.

@connormanning
Last active March 30, 2018 06:45
Show Gist options
  • Save connormanning/1d63e4a0a1f8dbc9ebfe2c46d782d0f6 to your computer and use it in GitHub Desktop.
Save connormanning/1d63e4a0a1f8dbc9ebfe2c46d782d0f6 to your computer and use it in GitHub Desktop.
Get Entwine file hierarchy as JSON

First, save the run.cpp file somewhere.

$ docker run -it \
  -v <your-entwine-data-directory>:/opt/data/ \
  -v <wherever-you-put-that-c++-file>:/opt/test/ \
  --entrypoint=bash connormanning/entwine

root@ff99e5b49bf0:/# cd /opt/test/
root@ff99e5b49bf0:/opt/test# g++ -std=c++11 -I /usr/include/jsoncpp/ run.cpp -lentwine -ljsoncpp -o dump
root@ff99e5b49bf0:/opt/test# ./dump /opt/data/<name-of-your-entwine-index>
{
   "5461" : {
      "21845" : {
         "87381" : {
            "1135957" : {
                ...lots of JSON representing the file structure.
#include <entwine/third/arbiter/arbiter.hpp>
#include <entwine/tree/traverser.hpp>
int main(int argc, char** argv)
{
using namespace entwine;
const std::string in(argv[1]);
arbiter::Arbiter a;
auto ep(a.getEndpoint(in));
Metadata m(ep);
const auto v(extract<Id>(parse(ep.get("entwine-ids"))));
const std::set<Id> ids(v.begin(), v.end());
Traverser t(m, ids);
std::cout << t.chunkTree().toStyledString() << std::endl;
return 0;
}
@ryanuc
Copy link

ryanuc commented Mar 30, 2018

Hi, attempting to run through this, however it looks to be that the docker image has changed significantly since this was put together. Are there any updated processes to get similar information? Cheers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment