Preliminaries for private group invitation protocol.

This commit is contained in:
akwizgran
2016-11-08 15:44:23 +00:00
parent 32f0b53d15
commit edbf5ff5b4
21 changed files with 179 additions and 84 deletions

View File

@@ -1,19 +0,0 @@
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(@NotNull Collection<MessageId> dependencies) {
this.dependencies = dependencies;
}
public Collection<MessageId> getDependencies() {
return dependencies;
}
}

View File

@@ -1,23 +1,27 @@
package org.briarproject.api.sync;
import org.briarproject.api.db.Metadata;
import org.jetbrains.annotations.NotNull;
import org.briarproject.api.nullsafety.NotNullByDefault;
import java.util.Collection;
import java.util.Collections;
public class MessageContext extends BaseMessageContext {
import javax.annotation.concurrent.Immutable;
@Immutable
@NotNullByDefault
public class MessageContext {
private final Metadata metadata;
private final Collection<MessageId> dependencies;
public MessageContext(@NotNull Metadata metadata,
@NotNull Collection<MessageId> dependencies) {
super(dependencies);
public MessageContext(Metadata metadata,
Collection<MessageId> dependencies) {
this.metadata = metadata;
this.dependencies = dependencies;
}
public MessageContext(@NotNull Metadata metadata) {
public MessageContext(Metadata metadata) {
this(metadata, Collections.<MessageId>emptyList());
}
@@ -25,4 +29,7 @@ public class MessageContext extends BaseMessageContext {
return metadata;
}
public Collection<MessageId> getDependencies() {
return dependencies;
}
}

View File

@@ -2,5 +2,7 @@ package org.briarproject.api.sync;
public interface MessageFactory {
Message createMessage(GroupId groupId, long timestamp, byte[] body);
Message createMessage(GroupId g, long timestamp, byte[] body);
Message createMessage(MessageId m, byte[] raw);
}