mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-13 03:09:04 +01:00
Refactor ValidationManager and fix some bugs. #619
This commit is contained in:
@@ -1,12 +1,14 @@
|
||||
package org.briarproject.api.sync;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
public abstract class BaseMessageContext {
|
||||
|
||||
private final Collection<MessageId> dependencies;
|
||||
|
||||
public BaseMessageContext(Collection<MessageId> dependencies) {
|
||||
public BaseMessageContext(@NotNull Collection<MessageId> dependencies) {
|
||||
this.dependencies = dependencies;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,22 +1,24 @@
|
||||
package org.briarproject.api.sync;
|
||||
|
||||
import org.briarproject.api.db.Metadata;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
|
||||
public class MessageContext extends BaseMessageContext {
|
||||
|
||||
private final Metadata metadata;
|
||||
|
||||
public MessageContext(Metadata metadata,
|
||||
Collection<MessageId> dependencies) {
|
||||
public MessageContext(@NotNull Metadata metadata,
|
||||
@NotNull Collection<MessageId> dependencies) {
|
||||
|
||||
super(dependencies);
|
||||
this.metadata = metadata;
|
||||
}
|
||||
|
||||
public MessageContext(Metadata metadata) {
|
||||
this(metadata, null);
|
||||
public MessageContext(@NotNull Metadata metadata) {
|
||||
this(metadata, Collections.<MessageId>emptyList());
|
||||
}
|
||||
|
||||
public Metadata getMetadata() {
|
||||
|
||||
@@ -12,7 +12,7 @@ public interface ValidationManager {
|
||||
|
||||
enum State {
|
||||
|
||||
UNKNOWN(0), INVALID(1), PENDING(2), VALID(3), DELIVERED(4);
|
||||
UNKNOWN(0), INVALID(1), PENDING(2), DELIVERED(3);
|
||||
|
||||
private final int value;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user