/** * Build a block from the given string. * * @param s the string * @return the block */ public static Chunk fromString(String s) { HashMap<String, String> map = DataUtils.parseMap(s); int id = DataUtils.readHexInt(map, "chunk", 0); Chunk c = new Chunk(id); c.block = DataUtils.readHexLong(map, "block", 0); c.len = DataUtils.readHexInt(map, "len", 0); c.pageCount = DataUtils.readHexInt(map, "pages", 0); c.pageCountLive = DataUtils.readHexInt(map, "livePages", c.pageCount); c.mapId = DataUtils.readHexInt(map, "map", 0); c.maxLen = DataUtils.readHexLong(map, "max", 0); c.maxLenLive = DataUtils.readHexLong(map, "liveMax", c.maxLen); c.metaRootPos = DataUtils.readHexLong(map, "root", 0); c.time = DataUtils.readHexLong(map, "time", 0); c.unused = DataUtils.readHexLong(map, "unused", 0); c.version = DataUtils.readHexLong(map, "version", id); c.next = DataUtils.readHexLong(map, "next", 0); return c; }
/** * Try to read a chunk footer. * * @param end the end of the chunk * @return the chunk, or null if not successful */ private Chunk readChunkFooter(long end) { // the following can fail for various reasons try { // read the chunk footer of the last block of the file ByteBuffer lastBlock = fileStore.readFully( end - Chunk.FOOTER_LENGTH, Chunk.FOOTER_LENGTH); byte[] buff = new byte[Chunk.FOOTER_LENGTH]; lastBlock.get(buff); HashMap<String, String> m = DataUtils.parseChecksummedMap(buff); if (m != null) { int chunk = DataUtils.readHexInt(m, "chunk", 0); Chunk c = new Chunk(chunk); c.version = DataUtils.readHexLong(m, "version", 0); c.block = DataUtils.readHexLong(m, "block", 0); return c; } } catch (Exception e) { // ignore } return null; }
continue; int blockSize = DataUtils.readHexInt( m, "blockSize", BLOCK_SIZE); if (blockSize != BLOCK_SIZE) { storeHeader.putAll(m); creationTime = DataUtils.readHexLong(m, "created", 0); int chunkId = DataUtils.readHexInt(m, "chunk", 0); long block = DataUtils.readHexLong(m, "block", 0); Chunk test = readChunkHeaderAndFooter(block);
int chunkId = DataUtils.readHexInt(storeHeader, "chunk", 0); while (true) { Chunk old = chunks.get(chunkId);
/** * Open this map with the given store and configuration. * * @param store the store * @param config the configuration */ protected void init(MVStore store, HashMap<String, Object> config) { this.store = store; this.id = DataUtils.readHexInt(config, "id", 0); this.createVersion = DataUtils.readHexLong(config, "createVersion", 0); this.writeVersion = store.getCurrentVersion(); }
/** * Open this map with the given store and configuration. * * @param store the store * @param config the configuration */ protected void init(MVStore store, HashMap<String, Object> config) { this.store = store; this.id = DataUtils.readHexInt(config, "id", 0); this.createVersion = DataUtils.readHexLong(config, "createVersion", 0); this.writeVersion = store.getCurrentVersion(); }
/** * Build a block from the given string. * * @param s the string * @return the block */ public static Chunk fromString(String s) { HashMap<String, String> map = DataUtils.parseMap(s); int id = DataUtils.readHexInt(map, "chunk", 0); Chunk c = new Chunk(id); c.block = DataUtils.readHexLong(map, "block", 0); c.len = DataUtils.readHexInt(map, "len", 0); c.pageCount = DataUtils.readHexInt(map, "pages", 0); c.pageCountLive = DataUtils.readHexInt(map, "livePages", c.pageCount); c.mapId = DataUtils.readHexInt(map, "map", 0); c.maxLen = DataUtils.readHexLong(map, "max", 0); c.maxLenLive = DataUtils.readHexLong(map, "liveMax", c.maxLen); c.metaRootPos = DataUtils.readHexLong(map, "root", 0); c.time = DataUtils.readHexLong(map, "time", 0); c.unused = DataUtils.readHexLong(map, "unused", 0); c.version = DataUtils.readHexLong(map, "version", id); c.next = DataUtils.readHexLong(map, "next", 0); return c; }
/** * Build a block from the given string. * * @param s the string * @return the block */ public static Chunk fromString(String s) { HashMap<String, String> map = DataUtils.parseMap(s); int id = DataUtils.readHexInt(map, "chunk", 0); Chunk c = new Chunk(id); c.block = DataUtils.readHexLong(map, "block", 0); c.len = DataUtils.readHexInt(map, "len", 0); c.pageCount = DataUtils.readHexInt(map, "pages", 0); c.pageCountLive = DataUtils.readHexInt(map, "livePages", c.pageCount); c.mapId = DataUtils.readHexInt(map, "map", 0); c.maxLen = DataUtils.readHexLong(map, "max", 0); c.maxLenLive = DataUtils.readHexLong(map, "liveMax", c.maxLen); c.metaRootPos = DataUtils.readHexLong(map, "root", 0); c.time = DataUtils.readHexLong(map, "time", 0); c.unused = DataUtils.readHexLong(map, "unused", 0); c.version = DataUtils.readHexLong(map, "version", id); c.next = DataUtils.readHexLong(map, "next", 0); return c; }
String s = new String(buff, DataUtils.LATIN).trim(); HashMap<String, String> m = DataUtils.parseMap(s); int check = DataUtils.readHexInt(m, "fletcher", 0); m.remove("fletcher"); s = s.substring(0, s.lastIndexOf("fletcher") - 1); int checksum = DataUtils.getFletcher32(bytes, bytes.length); if (check == checksum) { int chunk = DataUtils.readHexInt(m, "chunk", 0); Chunk c = new Chunk(chunk); c.version = DataUtils.readHexLong(m, "version", 0);
/** * Build a block from the given string. * * @param s the string * @return the block */ public static Chunk fromString(String s) { HashMap<String, String> map = DataUtils.parseMap(s); int id = DataUtils.readHexInt(map, "chunk", 0); Chunk c = new Chunk(id); c.block = DataUtils.readHexLong(map, "block", 0); c.len = DataUtils.readHexInt(map, "len", 0); c.pageCount = DataUtils.readHexInt(map, "pages", 0); c.pageCountLive = DataUtils.readHexInt(map, "livePages", c.pageCount); c.mapId = DataUtils.readHexInt(map, "map", 0); c.maxLen = DataUtils.readHexLong(map, "max", 0); c.maxLenLive = DataUtils.readHexLong(map, "liveMax", c.maxLen); c.metaRootPos = DataUtils.readHexLong(map, "root", 0); c.time = DataUtils.readHexLong(map, "time", 0); c.unused = DataUtils.readHexLong(map, "unused", 0); c.version = DataUtils.readHexLong(map, "version", id); c.next = DataUtils.readHexLong(map, "next", 0); return c; }
String s = new String(buff, DataUtils.LATIN).trim(); HashMap<String, String> m = DataUtils.parseMap(s); int check = DataUtils.readHexInt(m, "fletcher", 0); m.remove("fletcher"); s = s.substring(0, s.lastIndexOf("fletcher") - 1); int checksum = DataUtils.getFletcher32(bytes, bytes.length); if (check == checksum) { int chunk = DataUtils.readHexInt(m, "chunk", 0); Chunk c = new Chunk(chunk); c.version = DataUtils.readHexLong(m, "version", 0);
/** * Try to read a chunk footer. * * @param end the end of the chunk * @return the chunk, or null if not successful */ private Chunk readChunkFooter(long end) { // the following can fail for various reasons try { // read the chunk footer of the last block of the file ByteBuffer lastBlock = fileStore.readFully( end - Chunk.FOOTER_LENGTH, Chunk.FOOTER_LENGTH); byte[] buff = new byte[Chunk.FOOTER_LENGTH]; lastBlock.get(buff); HashMap<String, String> m = DataUtils.parseChecksummedMap(buff); if (m != null) { int chunk = DataUtils.readHexInt(m, "chunk", 0); Chunk c = new Chunk(chunk); c.version = DataUtils.readHexLong(m, "version", 0); c.block = DataUtils.readHexLong(m, "block", 0); return c; } } catch (Exception e) { // ignore } return null; }
DataUtils.LATIN).trim(); HashMap<String, String> m = DataUtils.parseMap(s); int blockSize = DataUtils.readHexInt( m, "blockSize", BLOCK_SIZE); if (blockSize != BLOCK_SIZE) { blockSize); int check = DataUtils.readHexInt(m, "fletcher", 0); m.remove("fletcher"); s = s.substring(0, s.lastIndexOf("fletcher") - 1); storeHeader.putAll(m); creationTime = DataUtils.readHexLong(m, "created", 0); int chunkId = DataUtils.readHexInt(m, "chunk", 0); long block = DataUtils.readHexLong(m, "block", 0); Chunk test = readChunkHeaderAndFooter(block);
DataUtils.LATIN).trim(); HashMap<String, String> m = DataUtils.parseMap(s); int blockSize = DataUtils.readHexInt( m, "blockSize", BLOCK_SIZE); if (blockSize != BLOCK_SIZE) { blockSize); int check = DataUtils.readHexInt(m, "fletcher", 0); m.remove("fletcher"); s = s.substring(0, s.lastIndexOf("fletcher") - 1); storeHeader.putAll(m); creationTime = DataUtils.readHexLong(m, "created", 0); int chunkId = DataUtils.readHexInt(m, "chunk", 0); long block = DataUtils.readHexLong(m, "block", 0); Chunk test = readChunkHeaderAndFooter(block);
continue; int blockSize = DataUtils.readHexInt( m, "blockSize", BLOCK_SIZE); if (blockSize != BLOCK_SIZE) { storeHeader.putAll(m); creationTime = DataUtils.readHexLong(m, "created", 0); int chunkId = DataUtils.readHexInt(m, "chunk", 0); long block = DataUtils.readHexLong(m, "block", 0); Chunk test = readChunkHeaderAndFooter(block);
int chunkId = DataUtils.readHexInt(storeHeader, "chunk", 0); while (true) { Chunk old = chunks.get(chunkId);
int chunkId = DataUtils.readHexInt(storeHeader, "chunk", 0); while (true) { Chunk old = chunks.get(chunkId);
int chunkId = DataUtils.readHexInt(storeHeader, "chunk", 0); while (true) { Chunk old = chunks.get(chunkId);