Search in sources :

Example 1 with MVMap

use of org.h2.mvstore.MVMap in project jackrabbit-oak by apache.

the class PersistentCacheCommand method dump.

static void dump(PrintWriter write, String path, String revision, String map, String fileName, boolean values, boolean raw) {
    MVStore s = new MVStore.Builder().readOnly().fileName(fileName).open();
    Map<String, String> meta = s.getMetaMap();
    boolean statsOnly = "".equalsIgnoreCase(map) && "".equals(revision) && "".equals(path);
    if (!statsOnly) {
        if (raw) {
            write.println("map" + "\t" + "key" + "\t" + "length" + "\t" + "value");
        } else if (values) {
            write.println("map,path,revision,p2,length,value");
        } else {
            write.println("map,path,revision,p2,length");
        }
    }
    for (String n : meta.keySet()) {
        if (n.startsWith("name.")) {
            String mapName = n.substring(5, n.length());
            if (map.length() > 0 && !map.equalsIgnoreCase(mapName)) {
                continue;
            }
            MVMap.Builder<String, String> b = new MVMap.Builder<String, String>().keyType(StringDataType.INSTANCE).valueType(StringDataType.INSTANCE);
            MVMap<String, String> m = s.openMap(mapName, b);
            if (statsOnly) {
                statistics(write, m);
            } else if (raw) {
                dumpRaw(write, m);
            } else {
                dump(write, m, path, revision, values);
            }
        }
    }
    s.close();
}
Also used : MVStore(org.h2.mvstore.MVStore) MVMap(org.h2.mvstore.MVMap)

Aggregations

MVMap (org.h2.mvstore.MVMap)1 MVStore (org.h2.mvstore.MVStore)1