Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

merge v0.2.8 features into master #525

Merged
merged 160 commits into from
Jun 14, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
160 commits
Select commit Hold shift + click to select a range
9370587
fix p2p tests
ali-sharif Apr 18, 2018
024681a
cleaning up the data recovery unit tests
AlexandraRoatis May 9, 2018
a19a604
reenabling the journal prune DS #298
AlexandraRoatis May 9, 2018
349c930
adding the pune block count to the configuration
AlexandraRoatis May 9, 2018
4041344
command line utils for exploring the state trie; corrections to the b…
AlexandraRoatis May 10, 2018
f8152db
rebuilding the genesis block if missing when attempting state recovery
AlexandraRoatis May 10, 2018
9377138
disabled pruning when pruneBlockCount is negative; set a lower bound …
AlexandraRoatis May 10, 2018
493f112
unit tests for JournalPruneDataSource.java
AlexandraRoatis May 11, 2018
7e8dfbd
correcting test case
AlexandraRoatis May 11, 2018
bb92c60
impoving comments for prune and repair functionality
AlexandraRoatis May 16, 2018
b67323e
storing the public total difficulty inside the best block
AlexandraRoatis May 16, 2018
ab40ed4
extracting common code into a method
AlexandraRoatis May 17, 2018
601e905
refactored JournalPruneDataSource to be independent of the block and …
AlexandraRoatis May 11, 2018
e92d842
replacing synchronized methods with read-write locks
AlexandraRoatis May 14, 2018
0fb29b9
disabling locking on the state database since the JournalPruneDS is l…
AlexandraRoatis May 14, 2018
8aa1133
moving the JournalPruneDS test class in the correct folder
AlexandraRoatis May 14, 2018
ca0c44b
unit tests for conformance to interface
AlexandraRoatis May 14, 2018
d10df63
concurrency tests for JournalPruneDS
AlexandraRoatis May 14, 2018
3205e07
unit tests for pruning functionality
AlexandraRoatis May 14, 2018
0f78cc8
removed dependency on modDbImpl
AlexandraRoatis May 14, 2018
527f382
applying review comments
AlexandraRoatis May 17, 2018
2f0ac31
added logger features
aionJoey May 17, 2018
0d89dae
logger feature added
aionJoey May 17, 2018
07c93e1
logger feature added
aionJoey May 17, 2018
a2186ad
allows user to toggle logger
aionJoey May 18, 2018
6fd52f2
first refactor: separate TaskInbound
aionick May 18, 2018
dc0cc75
second refactor: separate TaskSend
aionick May 18, 2018
4cf4642
third refactor: separate TaskReceive
aionick May 18, 2018
91829ec
fourth refactor: separate TaskStatus
aionick May 18, 2018
0b981ec
fifth refactor: separate TaskConnectPeers
aionick May 18, 2018
44e73a0
sixth refactor: separate TaskClear
aionick May 18, 2018
4d8faec
moved MsgOut/In classes, renames and cleanups
aionick May 18, 2018
d1aba20
moved accept,read others into TaskInbound, cleanups
aionick May 18, 2018
e7f2386
added licenses, more cleanups
aionick May 18, 2018
a6b558a
refactoring to improve readability
aionick May 22, 2018
7182785
moved tasks to separate package
aionick May 22, 2018
606b1e3
bugfix: incorrect check for presence in the data source
AlexandraRoatis May 22, 2018
d7c1f58
new configuration class and interface for pruning
AlexandraRoatis May 15, 2018
e319850
using new detailed pruning configuration
AlexandraRoatis May 15, 2018
cf6e9d5
bugfix: method parameters should be generic
AlexandraRoatis May 15, 2018
e40b699
new data source class that deletes from the current db only keys not …
AlexandraRoatis May 18, 2018
471614e
refactored journal prune class to take a data store as argument; meth…
AlexandraRoatis May 18, 2018
9c5b552
building the journal prune on top of the data source with archive
AlexandraRoatis May 18, 2018
8e487b5
archiving the world state at runtime
AlexandraRoatis May 18, 2018
631da9e
bugfix: incorrect variable update
AlexandraRoatis May 18, 2018
236dddf
file path check
aionJoey May 22, 2018
4666b67
added getNrgPrice functionality
aionick May 22, 2018
629c5a8
init NrgOracle before get recommended nrg
aionick May 22, 2018
3b6ac0b
removed req method for getNrgPrice
aionick May 22, 2018
bfd5c85
add null check back in
aionick May 23, 2018
0bdb509
logger features
aionJoey May 23, 2018
5f4ecec
improved binding and db locking error messages
aionick May 23, 2018
2e89e3f
bugfix: reseting the root back to its initial value after recovery
AlexandraRoatis May 23, 2018
f8242db
optimizing the sync BACKWARD and FORWARD behavior
AlexandraRoatis May 23, 2018
cf03e54
fixing config file
AlexandraRoatis May 23, 2018
67209d3
added test for valid log path check
aionJoey May 23, 2018
8522525
changed to check if you have..
aionick May 24, 2018
47da914
bugfix: printing the size of the trie states should only consider the…
AlexandraRoatis May 24, 2018
54270e0
fix javaapi doesn't shutdown properly and revise some wording in the …
AionJayT May 24, 2018
b42dd50
additional stop condition for sync FORWARD mode
AlexandraRoatis May 24, 2018
27a7a52
new pruning configurations and default values
AlexandraRoatis May 24, 2018
f31e6ba
separated MsgIn and MsgOut
aionick May 24, 2018
1d48630
defined fields in terms of interfaces
aionick May 25, 2018
89a28b4
keep this PR up to date with its dependent PR.
aionick May 25, 2018
0101b06
added enhancement box
aionick May 25, 2018
c9e92b8
fix merge conflict
AionJayT May 25, 2018
4466731
Merge pull request #509 from aionick/fix_err_msgs
AionJayT May 25, 2018
253f3d5
remove duplicate method
AionJayT May 25, 2018
5ee86f1
Merge branch 'p2p-outbound' of https://github.com/aionnetwork/aion in…
AionJayT May 25, 2018
ada9502
correcting broken test cases
AlexandraRoatis May 25, 2018
e71422f
fix testcase of the BlockPropagationTest
AionJayT May 25, 2018
0e4880a
extracting the buildGenesis functionality to a utils class
AlexandraRoatis May 25, 2018
ba2050a
added test cases for log file creation
aionJoey May 25, 2018
fda465f
Removed commenting out @After
aionJoey May 25, 2018
188a483
state pruning as CLI options
AlexandraRoatis May 25, 2018
d87ac87
skipping full batch when in FORWARD mode and last block satisfies req…
AlexandraRoatis May 25, 2018
d415e4a
checking for prune restrictions before importing blocks
AlexandraRoatis May 25, 2018
651c408
null path now returns false
aionJoey May 25, 2018
79f5422
Merge branch 'enhance_logger' of https://github.com/aionJoey/aion int…
aionJoey May 25, 2018
9b0e045
removed commented-out code
aionick May 28, 2018
3a15d59
added unit test option
aionick May 28, 2018
3467903
moved init nrgOracle logic to ApiAion
aionick May 28, 2018
43d206b
FileUtils dependency avoided
aionJoey May 28, 2018
eeb8627
moved the prune restriction to block filtering
AlexandraRoatis May 28, 2018
8a1160b
bugfix: checking for null keys, values and batches
AlexandraRoatis May 28, 2018
1491b8a
getCumulativeDifficulty returns 0 or runtime TD; genesis block calls …
AlexandraRoatis May 28, 2018
fd5113b
updating the bestBlock total diff at loading
AlexandraRoatis May 28, 2018
76f97db
merged with master-pre-merge
AlexandraRoatis May 28, 2018
51edfc4
backward sync step as constant
AlexandraRoatis May 29, 2018
9e2d789
extracting repeated code into methods in TaskImportBlocks
AlexandraRoatis May 29, 2018
bff2e1c
prune parameters as constants
AlexandraRoatis May 29, 2018
e0ca459
bugfix: reducing the heap space requirements for the state recovery
AlexandraRoatis May 30, 2018
e1e80ff
Update README.md
kzeine May 30, 2018
341308a
p2p bug fix and TaskSend benchmarking(temp)
AionJayT May 30, 2018
325f0a7
made txBroadCastRoute field visible
aionick May 31, 2018
36b1dc7
Merge pull request #511 from kzeine/master
qoire May 31, 2018
6ad5911
correcting the license header
AlexandraRoatis May 31, 2018
e1e956a
p2pmgr & tasks enhancement
AionJayT May 31, 2018
9c65721
updated licenses and other minor fixes
aionick Jun 1, 2018
8def32b
added braces to one-line ifs
aionick Jun 1, 2018
4b5e4f7
Merge pull request #487 from aionnetwork/db-td-refactor
AionJayT Jun 1, 2018
46fccd6
Merge branch 'master-pre-merge' into db-journal-prune
AlexandraRoatis Jun 1, 2018
8ac445d
Merge pull request #478 from aionnetwork/db-journal-prune
AionJayT Jun 1, 2018
1f0e586
added headers and changed comments
aionJoey Jun 1, 2018
6e70b12
Merge branch 'enhance_logger' of https://github.com/aionJoey/aion int…
aionJoey Jun 1, 2018
ab6d339
Merge branch 'master-pre-merge' into db-archive-states
AlexandraRoatis Jun 1, 2018
756ccde
Merge pull request #513 from aionnetwork/db-archive-states
AionJayT Jun 1, 2018
3cb0eb0
Merge pull request #508 from aionick/add_enhancement
AionJayT Jun 1, 2018
1d44cbd
Merge pull request #503 from aionick/fix_err_msgs
AionJayT Jun 1, 2018
4f9e6b6
fix merge conflict
AionJayT Jun 1, 2018
7388acf
fix merge conflict
AionJayT Jun 1, 2018
94b973e
fixing the bug introduced by the different branch merges
AlexandraRoatis Jun 1, 2018
23500ab
Merge pull request #514 from aionnetwork/fix-index-tests
AionJayT Jun 1, 2018
b88dfa1
updated commenting
aionJoey Jun 1, 2018
3af3ad7
Merge branch 'master-pre-merge' into p2p-outbound
AionJayT Jun 1, 2018
6ec9f87
remove debugging cnt/log
AionJayT Jun 1, 2018
6b57d9f
remove unused variable
AionJayT Jun 1, 2018
67712be
bugfix: missing null checks
AlexandraRoatis Jun 1, 2018
31812c3
Merge branch 'master-pre-merge' into p2p-outbound
AionJayT Jun 1, 2018
8f93329
Merge pull request #502 from aionJoey/enhance_logger
AionJayT Jun 1, 2018
688ad84
Merge branch 'master-pre-merge' into p2p-outbound
AionJayT Jun 1, 2018
bc3f2c8
add license
AionJayT Jun 1, 2018
7770c9c
AW-103 Add local.storage.dir flag
victorbalan Jun 4, 2018
bfbc0d7
refactor p2p module
AionJayT Jun 4, 2018
0816027
move varible from the interface to the implement class
AionJayT Jun 4, 2018
7ea47e5
refactor p2p log system
AionJayT Jun 4, 2018
fdc1e7e
Fix typo in ketstore path
victorbalan Jun 5, 2018
d3a9916
Merge pull request #500 from aionick/add_nrgPrice
AionJayT Jun 5, 2018
51d78d8
fix build error
AionJayT Jun 5, 2018
a472c03
1. refine p2plog 2. update ant build files
AionJayT Jun 5, 2018
52486e7
update build file in modAionImpl
AionJayT Jun 5, 2018
0d70751
refactor nrgOracle and java/web3 API refactors
AionJayT Jun 5, 2018
7057a20
Merge branch 'master-pre-merge' into p2p-log
AionJayT Jun 5, 2018
cc5dc1d
replace log in TaskShowStatus
AionJayT Jun 5, 2018
1855ef8
small rework in ApiAion0
AionJayT Jun 5, 2018
f089d9d
Merge branch 'master-pre-merge' into p2p-log
AionJayT Jun 5, 2018
d34f433
adjustment the config settings for fitting the log feature
AionJayT Jun 5, 2018
a42df62
fix test error
AionJayT Jun 5, 2018
154167d
remove giving seed during the random class construct
AionJayT Jun 5, 2018
9326849
rename static variable
AionJayT Jun 5, 2018
2d81a07
refactor NodeMgr
AionJayT Jun 5, 2018
93da2b6
add exception log in the nodeMgr shutdown
AionJayT Jun 5, 2018
c3656b4
adjustment log level
AionJayT Jun 6, 2018
4cefbfe
Merge pull request #516 from Centrys/aw-103
AionJayT Jun 7, 2018
1778dbf
pack client API into release bin
AionJayT Jun 8, 2018
1280ae2
update pack script
AionJayT Jun 8, 2018
f272658
Merge pull request #520 from aionnetwork/api-pack
AionJayT Jun 13, 2018
382531f
Merge pull request #515 from aionnetwork/p2p-outbound
AionJayT Jun 13, 2018
96f57a4
Merge pull request #518 from aionnetwork/p2p-log
AionJayT Jun 13, 2018
5e3c07b
Merge pull request #505 from aionnetwork/api_shutdown
AionJayT Jun 13, 2018
464b474
bugfix: total diff set for best block at load time
AlexandraRoatis Jun 13, 2018
6d71545
fix block import issue and merge conflict
AionJayT Jun 13, 2018
2da97ef
Merge branch 'master-pre-merge' of https://github.com/aionnetwork/aio…
AionJayT Jun 13, 2018
d0c5ddd
test rollback on fork with exception
AlexandraRoatis Jun 13, 2018
3fb07f0
test rollback on adding invalid block
AlexandraRoatis Jun 13, 2018
395bb01
import block to the fork chain issue fix
AionJayT Jun 14, 2018
4df7eb6
update fvm ref
AionJayT Jun 14, 2018
ef6c78a
update aion_api ref
AionJayT Jun 14, 2018
c9e951b
pump kernel version
AionJayT Jun 14, 2018
048b86d
update fvm ref
AionJayT Jun 14, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ Fixes Issue # .
Insert **x** into the following checkboxes to confirm (eg. [x]):
- [ ] Bug fix.
- [ ] New feature.
- [ ] Enhancement.
- [ ] Unit test.
- [ ] Breaking change (a fix or feature that causes existing functionality to not work as expected).
- [ ] Requires documentation update.

Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,7 @@ Please refer to the [wiki pages](https://github.com/aionnetwork/aion/wiki) for f

Aion is released under the [GPL-V3 license](https://github.com/aionnetwork/aion/blob/dev/LICENSE)

### WE ARE HIRING!

If you are interested in being part of the Aion project, check out our available positions and apply [here](http://aion.humi.ca/job-board/it/697)!
<!--For additional Aion **command line options** run:```./aion.sh -h```-->
2 changes: 1 addition & 1 deletion aion_api
Submodule aion_api updated 207 files
8 changes: 8 additions & 0 deletions build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,11 @@
<ant inheritAll="false" antfile="${dir.workspace}/modBoot/build.xml" target="clean_build">
<property name="compile.debug" value="${compile.debug}" />
</ant>

<echo message="building modApi" />
<ant inheritAll="false" antfile="${dir.workspace}/aion_api/build.xml" target="clean_build">
<property name="compile.debug" value="${compile.debug}" />
</ant>
</target>

<target name="build" depends="mod_build">
Expand Down Expand Up @@ -386,6 +391,9 @@
<tarfileset dir="${dir.pack}/docs" filemode="755" prefix="${project.name}/docs">
<include name="**" />
</tarfileset>
<tarfileset dir="${dir.pack}/clientAPI" filemode="755" prefix="${project.name}/clientAPI">
<include name="**" />
</tarfileset>
</tar>
<exec executable="/bin/bash">
<arg value="${dir.workspace}/script/postpack.sh" />
Expand Down
33 changes: 3 additions & 30 deletions modAion/build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@

<target name="test_build" depends="build">
<mkdir dir="${dir.test}"/>
<javac debug="on" debuglevel="source,lines,vars" includeantruntime="false" release="9" srcdir="./test"
<javac debug="on" debuglevel="source,lines,vars" includeantruntime="false" release="10" srcdir="./test"
destdir="${dir.test}" includes="**/*Test.java">
<classpath>
<path refid="classpath.test"/>
Expand All @@ -51,7 +51,7 @@

<target name="ci_test_build" depends="build">
<mkdir dir="${dir.test}"/>
<javac debug="on" debuglevel="source,lines,vars" includeantruntime="false" release="9" srcdir="./test"
<javac debug="on" debuglevel="source,lines,vars" includeantruntime="false" release="10" srcdir="./test"
destdir="${dir.test}" includes="**/*Test.java">
<classpath>
<path refid="classpath.test"/>
Expand Down Expand Up @@ -109,7 +109,7 @@
<target name="build">
<echo message="compiling with debug=${compile.debug}" />
<mkdir dir="${dir.dest}"/>
<javac debug="${compile.debug}" debuglevel="source,lines,vars" includeantruntime="false" release="9" srcdir="./"
<javac debug="${compile.debug}" debuglevel="source,lines,vars" includeantruntime="false" release="10" srcdir="./"
destdir="${dir.dest}" includes="src/**/*.java,module-info.java">

<modulepath>
Expand All @@ -130,31 +130,4 @@
<file file="modAion.jar"/>
</move>
</target>


<target name="build_v8">
<mkdir dir="${dir.dest}"/>
<javac debug="true" debuglevel="source,lines,vars" includeantruntime="false" srcdir="./src"
destdir="${dir.dest}" includes="**/*.java">
<classpath>
<pathelement location="${dir.lib}/libnsc.jar"/>
<pathelement location="${dir.javaAPIlib}/libAionBase.jar"/>
</classpath>
</javac>

<jar destfile="libRlp.jar" filesetmanifest="mergewithoutmain" basedir="${dir.dest}"/>
<move includeemptydirs="false" todir="${dir.javaAPIlib}">
<file file="libRlp.jar"/>
</move>
</target>

<target name="clean_build_v8" depends="clean_v8, build_v8"/>

<target name="clean_v8">
<delete dir="${dir.dest}" includeEmptyDirs="true" includes="**/*/"/>
<delete dir="${dir.test}" includeEmptyDirs="true" includes="**/*/"/>
<delete dir="${test.report.dir}"/>
<delete file="Rlp.jar"/>
<delete file="${dir.javaAPIlib}/libRlp.jar"/>
</target>
</project>
19 changes: 3 additions & 16 deletions modAionBase/build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
debug="${compile.debug}"
debuglevel="source,lines,vars"
includeantruntime="false"
release="9"
release="10"
srcdir="${main.src.dir}"
destdir="${main.build.dir}"
includes="**/*.java, module-info.java"
Expand Down Expand Up @@ -72,7 +72,7 @@
debug="true"
debuglevel="source,lines,vars"
includeantruntime="false"
release="9"
release="10"
srcdir="${test.src.dir}"
destdir="${test.build.dir}"
>
Expand All @@ -86,7 +86,7 @@
debug="true"
debuglevel="source,lines,vars"
includeantruntime="false"
release="9"
release="10"
srcdir="${test.src.dir}"
destdir="${test.build.dir}"
>
Expand All @@ -106,19 +106,6 @@
/>
</target>

<target name="build_v8" depends="compile_v8">
<jar
destfile="libAionBase.jar"
filesetmanifest="mergewithoutmain"
basedir="${main.build.dir}"
/>
<copy includeemptydirs="false" todir="${dir.javaAPIlib}">
<file file="libAionBase.jar"/>
</copy>
</target>

<target name="clean_build_v8" depends="clean, build_v8" />

<!-- Test Related -->
<target name="test" depends="test-compile">
<mkdir dir="${test.report.dir}" />
Expand Down
127 changes: 56 additions & 71 deletions modAionBase/src/org/aion/base/db/IKeyValueStore.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*******************************************************************************
/* ******************************************************************************
* Copyright (c) 2017-2018 Aion foundation.
*
* This file is part of the aion network project.
Expand Down Expand Up @@ -42,14 +42,11 @@
/**
* Functionality for a key-value cache allowing itemized updates.
*
* @param <K>
* the data type of the keys
* @param <V>
* the data type of the values
* @param <K> the data type of the keys
* @param <V> the data type of the values
* @author Alexandra Roatis
* @implNote For the underlying DB connection, if [isClosed() == true], then all
* function calls which are documented to throw RuntimeException, will
* throw a RuntimeException.
* @implNote For the underlying DB connection, if [isClosed() == true], then all function calls
* which are documented to throw RuntimeException, will throw a RuntimeException.
*/
public interface IKeyValueStore<K, V> extends AutoCloseable {

Expand All @@ -60,115 +57,103 @@ public interface IKeyValueStore<K, V> extends AutoCloseable {
* Returns if the DB is empty or not.
*
* @return True if number of keys > 0, false otherwise
* @throws RuntimeException
* if the data store is closed
* @throws RuntimeException if the data store is closed
*/
boolean isEmpty();

/**
* Returns the set of keys for the database.
*
* @return Set of keys
* @throws RuntimeException
* if the data store is closed
* @apiNote Returns an empty set if the database keys could not be
* retrieved.
* @throws RuntimeException if the data store is closed
* @apiNote Returns an empty set if the database keys could not be retrieved.
*/
Set<K> keys();

/**
* get retrieves a value from the database, returning an optional, it is
* fulfilled if a value was able to be retrieved from the DB, otherwise the
* optional is empty
* get retrieves a value from the database, returning an optional, it is fulfilled if a value
* was able to be retrieved from the DB, otherwise the optional is empty
*
* @param k
* @throws RuntimeException
* if the data store is closed
* @throws IllegalArgumentException
* if the key is null
* @throws RuntimeException if the data store is closed
* @throws IllegalArgumentException if the key is null
*/
Optional<V> get(K k);

// Updates for individual keys
// -------------------------------------------------------------------------------------

/**
* Places or updates a value into the cache at the corresponding key. Makes
* no guarantees about when the value is actually inserted into the
* underlying data store.
* Places or updates a value into the cache at the corresponding key. Makes no guarantees about
* when the value is actually inserted into the underlying data store.
*
* @param k
* the key for the new entry
* @param v
* the value for the new entry
* @throws RuntimeException
* if the underlying data store is closed
* @throws IllegalArgumentException
* if the key is null
* @implNote The choice of when to push the changes to the data store is
* left up to the implementation.
* @param k the key for the new entry
* @param v the value for the new entry
* @throws RuntimeException if the underlying data store is closed
* @throws IllegalArgumentException if the key is null
* @implNote The choice of when to push the changes to the data store is left up to the
* implementation.
* @apiNote Put must have the following properties:
* <ol>
* <li>Creates a new entry in the cache, if the key-value pair does
* not exist in the cache or underlying data store.</li>
* <li>Updates the entry in the cache when the key-value pair
* already exists.
* <li>Deletes the entry when given a {@code null} value.</li>
* </ol>
* <ol>
* <li>Creates a new entry in the cache, if the key-value pair does not exist in the cache
* or underlying data store.
* <li>Updates the entry in the cache when the key-value pair already exists.
* <li>Deletes the entry when given a {@code null} value.
* </ol>
*/
void put(K k, V v);

/**
* Delete an entry from the cache, marking it for deletion inside the data
* store. Makes no guarantees about when the value is actually deleted from
* the underlying data store.
* Delete an entry from the cache, marking it for deletion inside the data store. Makes no
* guarantees about when the value is actually deleted from the underlying data store.
*
* @param k
* the key of the entry to be deleted
* @throws RuntimeException
* if the underlying data store is closed
* @throws IllegalArgumentException
* if the key is null
* @implNote The choice of when to push the changes to the data store is
* left up to the implementation.
* @param k the key of the entry to be deleted
* @throws RuntimeException if the underlying data store is closed
* @throws IllegalArgumentException if the key is null
* @implNote The choice of when to push the changes to the data store is left up to the
* implementation.
*/
void delete(K k);

// Batch Updates
// ---------------------------------------------------------------------------------------------------

/**
* Puts or updates the data store with the given <i>key-value</i> pairs, as
* follows:
* Puts or updates the data store with the given <i>key-value</i> pairs, as follows:
*
* <ul>
* <li>if the <i>key</i> is present in the data store, the stored
* <i>value</i> is overwritten</li>
* <li>if the <i>key</i> is not present in the data store, the new
* <i>key-value</i> pair is stored</li>
* <li>if the <i>value</i> is null, the matching stored <i>key</i> will be
* deleted from the data store, or</li>
* <li>if the <i>key</i> is present in the data store, the stored <i>value</i> is overwritten
* <li>if the <i>key</i> is not present in the data store, the new <i>key-value</i> pair is
* stored
* <li>if the <i>value</i> is null, the matching stored <i>key</i> will be deleted from the
* data store, or
* </ul>
*
* @param inputMap
* a {@link Map} of key-value pairs to be updated in the database
* @throws RuntimeException
* if the data store is closed
* @throws IllegalArgumentException
* if the map contains a null key
* @param inputMap a {@link Map} of key-value pairs to be updated in the database
* @throws RuntimeException if the data store is closed
* @throws IllegalArgumentException if the map contains a null key
*/
void putBatch(Map<K, V> inputMap);

void putToBatch(byte[] key, byte[] value);
void putToBatch(K key, V value);

void commitBatch();

/**
* Similar to delete, except operates on a list of keys
*
* @param keys
* @throws RuntimeException
* if the data store is closed
* @throws IllegalArgumentException
* if the collection contains a null key
* @throws RuntimeException if the data store is closed
* @throws IllegalArgumentException if the collection contains a null key
*/
void deleteBatch(Collection<K> keys);

/**
* Checks that the data store connection is open. Throws a {@link RuntimeException} if the data
* store connection is closed.
*
* @implNote Always do this check after acquiring a lock on the class/data. Otherwise it might
* produce inconsistent results due to lack of synchronization.
*/
void check();
}
37 changes: 37 additions & 0 deletions modAionBase/src/org/aion/base/db/IPruneConfig.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package org.aion.base.db;

/**
* Interface for pruning configuration parameters.
*
* @author Alexandra Roatis
*/
public interface IPruneConfig {

/**
* Indicates if pruning should be enabled or disabled.
*
* @return {@code true} when pruning enabled, {@code false} when pruning disabled.
*/
boolean isEnabled();

/**
* Indicates if archiving should be enabled or disabled.
*
* @return {@code true} when archiving enabled, {@code false} when archiving disabled.
*/
boolean isArchived();

/**
* @return the number of topmost blocks for which the full data should be maintained on disk.
*/
int getCurrentCount();

/**
* Gets the rate at which blocks should be archived (for which the full data should be
* maintained on disk). Blocks that are exact multiples of the returned value should be
* persisted on disk, regardless of other pruning.
*
* @return integer value representing the archive rate
*/
int getArchiveRate();
}
Loading