mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-13 11:19:04 +01:00
Introduce a MessageContext class for more flexibility
This change will allow to pass message dependencies from the client validators to the ValidationManager.
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
package org.briarproject.api.clients;
|
||||
|
||||
import org.briarproject.api.data.BdfDictionary;
|
||||
import org.briarproject.api.sync.BaseMessageContext;
|
||||
import org.briarproject.api.sync.MessageId;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
public class BdfMessageContext extends BaseMessageContext {
|
||||
|
||||
private final BdfDictionary dictionary;
|
||||
|
||||
public BdfMessageContext(BdfDictionary dictionary,
|
||||
Collection<MessageId> dependencies) {
|
||||
|
||||
super(dependencies);
|
||||
this.dictionary = dictionary;
|
||||
}
|
||||
|
||||
public BdfMessageContext(BdfDictionary dictionary) {
|
||||
this(dictionary, null);
|
||||
}
|
||||
|
||||
public BdfDictionary getDictionary() {
|
||||
return dictionary;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -5,6 +5,8 @@ import org.briarproject.api.db.Metadata;
|
||||
import org.briarproject.api.db.Transaction;
|
||||
import org.briarproject.api.sync.ClientId;
|
||||
import org.briarproject.api.sync.Group;
|
||||
import org.briarproject.api.sync.InvalidMessageException;
|
||||
import org.briarproject.api.sync.MessageContext;
|
||||
|
||||
public interface MessageQueueManager {
|
||||
|
||||
@@ -34,10 +36,11 @@ public interface MessageQueueManager {
|
||||
interface QueueMessageValidator {
|
||||
|
||||
/**
|
||||
* Validates the given message and returns its metadata if the message
|
||||
* is valid, or null if the message is invalid.
|
||||
* Validates the given message and returns its metadata and
|
||||
* dependencies.
|
||||
*/
|
||||
Metadata validateMessage(QueueMessage q, Group g);
|
||||
MessageContext validateMessage(QueueMessage q, Group g)
|
||||
throws InvalidMessageException;
|
||||
}
|
||||
|
||||
interface IncomingQueueMessageHook {
|
||||
|
||||
Reference in New Issue
Block a user