mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-13 19:29:06 +01:00
Add Message Dependencies to Database
This adds a new table to the database to hold message dependencies. It introduces two more message states: pending and delivered The valid column in the database was renamed to state to better reflect its new extended meaning. The DatabaseComponent was extended with three methods for: * adding dependencies * getting dependencies of a message * getting messages that depend on a message (dependents) * getting messages to be delivered (by startup hook) * getting pending messages to be possibly delivered (by startup hook) In order to reflect the new states, things that were previously true for VALID messages have been changed to now be true for DELIVERED messages. Since pending messages should not be available to clients, many database queries have been modified to only return results for delivered messages. All added methods and changes should come with updated unit tests. Please note that the database version was bumped in this commit.
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
package org.briarproject.api.event;
|
||||
|
||||
import org.briarproject.api.sync.ClientId;
|
||||
import org.briarproject.api.sync.Message;
|
||||
import org.briarproject.api.sync.ValidationManager;
|
||||
import static org.briarproject.api.sync.ValidationManager.State;
|
||||
|
||||
/**
|
||||
* An event that is broadcast when a message state changed.
|
||||
*/
|
||||
public class MessageStateChangedEvent extends Event {
|
||||
|
||||
private final Message message;
|
||||
private final ClientId clientId;
|
||||
private final boolean local;
|
||||
private final State state;
|
||||
|
||||
public MessageStateChangedEvent(Message message, ClientId clientId,
|
||||
boolean local, State state) {
|
||||
this.message = message;
|
||||
this.clientId = clientId;
|
||||
this.local = local;
|
||||
this.state = state;
|
||||
}
|
||||
|
||||
public Message getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
public ClientId getClientId() {
|
||||
return clientId;
|
||||
}
|
||||
|
||||
public boolean isLocal() {
|
||||
return local;
|
||||
}
|
||||
|
||||
public State getState() {
|
||||
return state;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user