Store group details in the database. Some tests are still failing...

This commit is contained in:
akwizgran
2011-07-23 01:29:18 +01:00
parent de648daca5
commit 0edcb31d64
21 changed files with 322 additions and 147 deletions

View File

@@ -11,6 +11,7 @@ import net.sf.briar.api.protocol.AckWriter;
import net.sf.briar.api.protocol.AuthorId;
import net.sf.briar.api.protocol.Batch;
import net.sf.briar.api.protocol.BatchWriter;
import net.sf.briar.api.protocol.Group;
import net.sf.briar.api.protocol.GroupId;
import net.sf.briar.api.protocol.Message;
import net.sf.briar.api.protocol.SubscriptionWriter;
@@ -81,7 +82,7 @@ public interface DatabaseComponent {
Rating getRating(AuthorId a) throws DbException;
/** Returns the set of groups to which the user subscribes. */
Collection<GroupId> getSubscriptions() throws DbException;
Collection<Group> getSubscriptions() throws DbException;
/** Returns the local transport details. */
Map<String, String> getTransports() throws DbException;
@@ -108,7 +109,7 @@ public interface DatabaseComponent {
void setRating(AuthorId a, Rating r) throws DbException;
/** Subscribes to the given group. */
void subscribe(GroupId g) throws DbException;
void subscribe(Group g) throws DbException;
/**
* Unsubscribes from the given group. Any messages belonging to the group

View File

@@ -5,7 +5,10 @@ import java.security.PublicKey;
/** A group to which users may subscribe. */
public interface Group {
/** Returns the name of the group. */
/** Returns the group's unique identifier. */
GroupId getId();
/** Returns the group's name. */
String getName();
/**

View File

@@ -0,0 +1,6 @@
package net.sf.briar.api.protocol;
public interface GroupFactory {
Group createGroup(GroupId id, String name, byte[] salt, byte[] publicKey);
}

View File

@@ -5,7 +5,6 @@ import java.io.IOException;
/** An interface for creating a subscription update. */
public interface SubscriptionWriter {
// FIXME: This should work with groups, not IDs
/** Sets the contents of the update. */
void setSubscriptions(Iterable<GroupId> subs) throws IOException;
void setSubscriptions(Iterable<Group> subs) throws IOException;
}

View File

@@ -5,9 +5,8 @@ import java.util.Collection;
/** A packet updating the sender's subscriptions. */
public interface Subscriptions {
// FIXME: This should work with groups, not IDs
/** Returns the subscriptions contained in the update. */
Collection<GroupId> getSubscriptions();
Collection<Group> getSubscriptions();
/**
* Returns the update's timestamp. Updates that are older than the newest