Skip to content

Commit

Permalink
大量简化设计(BTreeMap和BTreePage不再需要维护版本号信息)
Browse files Browse the repository at this point in the history
  • Loading branch information
codefollower committed Oct 28, 2015
1 parent 1e16e28 commit a003719
Show file tree
Hide file tree
Showing 6 changed files with 83 additions and 246 deletions.
Expand Up @@ -188,6 +188,10 @@ public interface StorageMap<K, V> {


boolean isClosed(); boolean isClosed();


/**
* Close the map. Accessing the data is still possible (to allow concurrent
* reads), but it is marked as closed.
*/
void close(); void close();


void save(); void save();
Expand Down
Expand Up @@ -33,11 +33,6 @@ public class BTreeChunk {
*/ */
public final int id; public final int id;


/**
* The version stored in this chunk.
*/
public long version;

/** /**
* The position of the root page. * The position of the root page.
*/ */
Expand Down Expand Up @@ -126,7 +121,6 @@ public StringBuilder asStringBuilder() {
StringBuilder buff = new StringBuilder(); StringBuilder buff = new StringBuilder();


DataUtils.appendMap(buff, "id", id); DataUtils.appendMap(buff, "id", id);
DataUtils.appendMap(buff, "version", version);
DataUtils.appendMap(buff, "rootPagePos", rootPagePos); DataUtils.appendMap(buff, "rootPagePos", rootPagePos);


DataUtils.appendMap(buff, "blockCount", blockCount); DataUtils.appendMap(buff, "blockCount", blockCount);
Expand Down Expand Up @@ -159,7 +153,6 @@ public static BTreeChunk fromString(String s) {
HashMap<String, String> map = DataUtils.parseMap(s); HashMap<String, String> map = DataUtils.parseMap(s);
int id = DataUtils.readHexInt(map, "id", 0); int id = DataUtils.readHexInt(map, "id", 0);
BTreeChunk c = new BTreeChunk(id); BTreeChunk c = new BTreeChunk(id);
c.version = DataUtils.readHexLong(map, "version", id);
c.rootPagePos = DataUtils.readHexLong(map, "rootPagePos", 0); c.rootPagePos = DataUtils.readHexLong(map, "rootPagePos", 0);


c.blockCount = DataUtils.readHexInt(map, "blockCount", 0); c.blockCount = DataUtils.readHexInt(map, "blockCount", 0);
Expand Down

0 comments on commit a003719

Please sign in to comment.