Removed SubscriptionUpdate and SubscriptionAck.

This commit is contained in:
akwizgran
2016-01-27 16:31:07 +00:00
parent e85b2161e4
commit 9fdc510843
27 changed files with 27 additions and 885 deletions

View File

@@ -17,8 +17,6 @@ import org.briarproject.api.sync.MessageId;
import org.briarproject.api.sync.MessageStatus;
import org.briarproject.api.sync.Offer;
import org.briarproject.api.sync.Request;
import org.briarproject.api.sync.SubscriptionAck;
import org.briarproject.api.sync.SubscriptionUpdate;
import org.briarproject.api.transport.TransportKeys;
import java.io.IOException;
@@ -113,20 +111,6 @@ public interface DatabaseComponent {
Collection<byte[]> generateRequestedBatch(ContactId c, int maxLength,
int maxLatency) throws DbException;
/**
* Returns a subscription ack for the given contact, or null if no
* subscription ack is due.
*/
SubscriptionAck generateSubscriptionAck(ContactId c) throws DbException;
/**
* Returns a subscription update for the given contact, for transmission
* over a transport with the given latency. Returns null if no update is
* due.
*/
SubscriptionUpdate generateSubscriptionUpdate(ContactId c, int maxLatency)
throws DbException;
/**
* Returns all groups belonging to the given client to which the user could
* subscribe.
@@ -246,14 +230,6 @@ public interface DatabaseComponent {
/** Processes a request from the given contact. */
void receiveRequest(ContactId c, Request r) throws DbException;
/** Processes a subscription ack from the given contact. */
void receiveSubscriptionAck(ContactId c, SubscriptionAck a)
throws DbException;
/** Processes a subscription update from the given contact. */
void receiveSubscriptionUpdate(ContactId c, SubscriptionUpdate u)
throws DbException;
/** Removes a contact (and all associated state) from the database. */
void removeContact(ContactId c) throws DbException;

View File

@@ -17,10 +17,4 @@ public interface PacketReader {
boolean hasRequest() throws IOException;
Request readRequest() throws IOException;
boolean hasSubscriptionAck() throws IOException;
SubscriptionAck readSubscriptionAck() throws IOException;
boolean hasSubscriptionUpdate() throws IOException;
SubscriptionUpdate readSubscriptionUpdate() throws IOException;
}

View File

@@ -7,6 +7,4 @@ public interface PacketTypes {
byte MESSAGE = 1;
byte OFFER = 2;
byte REQUEST = 3;
byte SUBSCRIPTION_ACK = 6;
byte SUBSCRIPTION_UPDATE = 7;
}

View File

@@ -18,9 +18,5 @@ public interface PacketWriter {
void writeRequest(Request r) throws IOException;
void writeSubscriptionAck(SubscriptionAck a) throws IOException;
void writeSubscriptionUpdate(SubscriptionUpdate u) throws IOException;
void flush() throws IOException;
}

View File

@@ -1,16 +0,0 @@
package org.briarproject.api.sync;
/** A packet acknowledging a {@link SubscriptionUpdate}. */
public class SubscriptionAck {
private final long version;
public SubscriptionAck(long version) {
this.version = version;
}
/** Returns the version number of the acknowledged update. */
public long getVersion() {
return version;
}
}

View File

@@ -1,28 +0,0 @@
package org.briarproject.api.sync;
import java.util.Collection;
/** A packet updating the recipient's view of the sender's subscriptions. */
public class SubscriptionUpdate {
private final Collection<Group> groups;
private final long version;
public SubscriptionUpdate(Collection<Group> groups, long version) {
this.groups = groups;
this.version = version;
}
/**
* Returns the groups to which the sender subscribes, and which the sender
* has made visible to the recipient.
*/
public Collection<Group> getGroups() {
return groups;
}
/** Returns the update's version number. */
public long getVersion() {
return version;
}
}

View File

@@ -14,10 +14,10 @@ public interface SyncConstants {
int MAX_PACKET_PAYLOAD_LENGTH = 32 * 1024; // 32 KiB
/** The maximum number of groups a user may subscribe to. */
int MAX_SUBSCRIPTIONS = 200;
int MAX_SUBSCRIPTIONS = 200; // TODO: Remove
/** The maximum length of a group descriptor in bytes. */
int MAX_GROUP_DESCRIPTOR_LENGTH = 100;
int MAX_GROUP_DESCRIPTOR_LENGTH = 100; // TODO: Remove
/** The maximum length of a message in bytes. */
int MAX_MESSAGE_LENGTH = MAX_PACKET_PAYLOAD_LENGTH - PACKET_HEADER_LENGTH;