Address review comments

This commit is contained in:
Torsten Grote
2016-11-04 11:28:56 -02:00
parent 3f9a254a0b
commit 719a53dc94
6 changed files with 41 additions and 52 deletions

View File

@@ -1,5 +1,6 @@
package org.briarproject.api.clients;
import org.briarproject.api.FormatException;
import org.briarproject.api.db.DbException;
import org.briarproject.api.db.Metadata;
import org.briarproject.api.db.Transaction;
@@ -49,16 +50,19 @@ public interface MessageQueueManager {
* Called once for each incoming message that passes validation.
* Messages are passed to the hook in order.
*
* @throws DbException should only be used for real database errors
* @throws InvalidMessageException for any non-database error
* @throws DbException Should only be used for real database errors.
* If this is thrown, delivery will be attempted again at next startup,
* whereas if an FormatException is thrown,
* the message will be permanently invalidated.
* @throws FormatException for any non-database error
* that occurs while handling remotely created data.
* This includes errors that occur while handling locally created data
* in a context controlled by remotely created data
* (for example, parsing the metadata of a dependency
* of an incoming message).
* Never rethrow DbException as InvalidMessageException
* Never rethrow DbException as FormatException!
*/
void incomingMessage(Transaction txn, QueueMessage q, Metadata meta)
throws DbException, InvalidMessageException;
throws DbException, FormatException;
}
}

View File

@@ -57,7 +57,10 @@ public interface ValidationManager {
* Called once for each incoming message that passes validation.
*
* @return whether or not this message should be shared
* @throws DbException should only be used for real database errors
* @throws DbException Should only be used for real database errors.
* If this is thrown, delivery will be attempted again at next startup,
* whereas if an InvalidMessageException is thrown,
* the message will be permanently invalidated.
* @throws InvalidMessageException for any non-database error
* that occurs while handling remotely created data.
* This includes errors that occur while handling locally created data
@@ -66,7 +69,7 @@ public interface ValidationManager {
* of an incoming message).
* Throwing this will delete the incoming message and its metadata
* marking it as invalid in the database.
* Never rethrow DbException as InvalidMessageException
* Never rethrow DbException as InvalidMessageException!
*/
boolean incomingMessage(Transaction txn, Message m, Metadata meta)
throws DbException, InvalidMessageException;