Skip to content

Commit

Permalink
Merge pull request #525 from aionnetwork/master-pre-merge
Browse files Browse the repository at this point in the history
merge v0.2.8 features into master
  • Loading branch information
qoire authored Jun 14, 2018
2 parents 1bbeec1 + 048b86d commit 84df0a7
Show file tree
Hide file tree
Showing 117 changed files with 10,742 additions and 5,147 deletions.
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

0 comments on commit 84df0a7

Please sign in to comment.