提交 7cb0c93e authored 作者: Thomas Mueller's avatar Thomas Mueller

Documentation

上级 2c22a10e
...@@ -62,7 +62,7 @@ But it can be also directly within an application, without using JDBC or SQL. ...@@ -62,7 +62,7 @@ But it can be also directly within an application, without using JDBC or SQL.
</li><li>Old versions of the data can be read concurrently with all other operations. </li><li>Old versions of the data can be read concurrently with all other operations.
</li><li>Transaction are supported (including concurrent transactions and 2-phase commit). </li><li>Transaction are supported (including concurrent transactions and 2-phase commit).
</li><li>The tool is very modular. </li><li>The tool is very modular.
It supports pluggable data types / serialization, It supports pluggable data types and serialization,
pluggable storage (to a file, to off-heap memory), pluggable storage (to a file, to off-heap memory),
pluggable map implementations (B-tree, R-tree, concurrent B-tree currently), pluggable map implementations (B-tree, R-tree, concurrent B-tree currently),
BLOB storage, BLOB storage,
...@@ -86,10 +86,7 @@ MVMap&lt;Integer, String&gt; map = s.openMap("data"); ...@@ -86,10 +86,7 @@ MVMap&lt;Integer, String&gt; map = s.openMap("data");
map.put(1, "Hello World"); map.put(1, "Hello World");
System.out.println(map.get(1)); System.out.println(map.get(1));
// mark the changes as committed // close the store (this will store changes)
s.commit();
// close the store (this will store committed changes)
s.close(); s.close();
</pre> </pre>
...@@ -101,6 +98,7 @@ The following code contains all supported configuration options: ...@@ -101,6 +98,7 @@ The following code contains all supported configuration options:
</p> </p>
<pre> <pre>
MVStore s = new MVStore.Builder(). MVStore s = new MVStore.Builder().
autoCommitDisabled().
backgroundExceptionListener(listener). backgroundExceptionListener(listener).
cacheSize(10). cacheSize(10).
compressData(). compressData().
...@@ -109,11 +107,10 @@ MVStore s = new MVStore.Builder(). ...@@ -109,11 +107,10 @@ MVStore s = new MVStore.Builder().
fileStore(new FileStore()). fileStore(new FileStore()).
pageSplitSize(6 * 1024). pageSplitSize(6 * 1024).
readOnly(). readOnly().
writeBufferSize(8).
writeDelay(100).
open(); open();
</pre> </pre>
<ul><li>backgroundExceptionListener: a listener for <ul><li>autoCommitDisabled(): to disable auto-commit.
</li><li>backgroundExceptionListener: a listener for
exceptions that could occur while writing in the background. exceptions that could occur while writing in the background.
</li><li>cacheSize: the cache size in MB. </li><li>cacheSize: the cache size in MB.
</li><li>compressData: compress the data when storing. </li><li>compressData: compress the data when storing.
...@@ -122,9 +119,6 @@ MVStore s = new MVStore.Builder(). ...@@ -122,9 +119,6 @@ MVStore s = new MVStore.Builder().
</li><li>fileStore: the storage implementation to use. </li><li>fileStore: the storage implementation to use.
</li><li>pageSplitSize: the point where pages are split. </li><li>pageSplitSize: the point where pages are split.
</li><li>readOnly: open the file in read-only mode. </li><li>readOnly: open the file in read-only mode.
</li><li>writeBufferSize: the size of the write buffer in MB.
</li><li>writeDelay: the maximum delay in milliseconds
until committed changes are stored in the background.
</li></ul> </li></ul>
<h2 id="r_tree">R-Tree</h2> <h2 id="r_tree">R-Tree</h2>
...@@ -185,15 +179,11 @@ the key of the map must also contain the primary key). ...@@ -185,15 +179,11 @@ the key of the map must also contain the primary key).
<h3 id="versions">Versions</h3> <h3 id="versions">Versions</h3>
<p> <p>
Multiple versions are supported.
A version is a snapshot of all the data of all maps at a given point in time. A version is a snapshot of all the data of all maps at a given point in time.
Versions are not immediately persisted; instead, only the version counter is incremented. Old versions are readable until the old data was explicitly overwritten.
If there is a change after switching to a new version, a snapshot of the old version is kept in memory, Creating a snapshot is fast: only those pages that are changed after a snapshot are copied.
so that it can still be read.
Old persisted versions are readable until the old data was explicitly overwritten.
Creating a snapshot is fast: only the pages that are changed after a snapshot are copied.
This behavior is also called COW (copy on write). This behavior is also called COW (copy on write).
Rollback is supported (rollback to any old in-memory version or an old persisted version). Rollback to an old version is supported.
</p><p> </p><p>
The following sample code show how to create a store, open a map, add some data, The following sample code show how to create a store, open a map, add some data,
and access the current and an old version: and access the current and an old version:
...@@ -210,7 +200,7 @@ map.put(2, "World"); ...@@ -210,7 +200,7 @@ map.put(2, "World");
long oldVersion = s.getCurrentVersion(); long oldVersion = s.getCurrentVersion();
// from now on, the old version is read-only // from now on, the old version is read-only
s.incrementVersion(); s.commit();
// more changes, in the new version // more changes, in the new version
// changes can be rolled back if required // changes can be rolled back if required
...@@ -222,9 +212,6 @@ map.remove(2); ...@@ -222,9 +212,6 @@ map.remove(2);
MVMap&lt;Integer, String&gt; oldMap = MVMap&lt;Integer, String&gt; oldMap =
map.openVersion(oldVersion); map.openVersion(oldVersion);
// mark the changes as committed
s.commit();
// print the old version (can be done // print the old version (can be done
// concurrently with further modifications) // concurrently with further modifications)
// this will print "Hello" and "World": // this will print "Hello" and "World":
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -33,8 +33,10 @@ ...@@ -33,8 +33,10 @@
90002=Method is only allowed for a query. Use execute or executeUpdate instead of executeQuery 90002=Method is only allowed for a query. Use execute or executeUpdate instead of executeQuery
90003=Hexadecimal string with odd number of characters: {0} 90003=Hexadecimal string with odd number of characters: {0}
90004=Hexadecimal string contains non-hex character: {0} 90004=Hexadecimal string contains non-hex character: {0}
90006=Sequence {0} has run out of numbers
90007=The object is already closed 90007=The object is already closed
90008=Invalid value {0} for parameter {1} 90008=Invalid value {0} for parameter {1}
90009=Unable to create or alter sequence {0} because of invalid attributes (start value {1}, min value {2}, max value {3}, increment {4})
90012=Parameter {0} is not set 90012=Parameter {0} is not set
90013=Database {0} not found 90013=Database {0} not found
90014=Error parsing {0} 90014=Error parsing {0}
...@@ -104,7 +106,7 @@ ...@@ -104,7 +106,7 @@
90082=Sequence {0} belongs to a table 90082=Sequence {0} belongs to a table
90083=Column may be referenced by {0} 90083=Column may be referenced by {0}
90084=Cannot drop last column {0} 90084=Cannot drop last column {0}
90085=Index {0} belongs to a constraint 90085=Index {0} belongs to constraint {1}
90086=Class {0} not found 90086=Class {0} not found
90087=Method {0} not found 90087=Method {0} not found
90088=Unknown mode {0} 90088=Unknown mode {0}
......
...@@ -742,4 +742,6 @@ layers waited descent spliced abstracts planning interest among sliced ...@@ -742,4 +742,6 @@ layers waited descent spliced abstracts planning interest among sliced
lives pauses allocates kicks introduction straightforward getenv lives pauses allocates kicks introduction straightforward getenv
ordinate tweaking fetching rfe yates cookie btrfs cookies ordinate tweaking fetching rfe yates cookie btrfs cookies
nocycle nomaxvalue nominvalue cycling proceed prospective exhausted contingent nocycle nomaxvalue nominvalue cycling proceed prospective exhausted contingent
validities hang degenerates freezes validities hang degenerates freezes
\ No newline at end of file
reverting gredler blanked koc cemo jump
\ No newline at end of file
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论