Removed message expiry code. #180

This commit is contained in:
akwizgran
2015-12-16 11:56:19 +00:00
parent 01ecfb435a
commit 6e61504d24
29 changed files with 104 additions and 1330 deletions

View File

@@ -16,8 +16,6 @@ import org.briarproject.api.sync.Message;
import org.briarproject.api.sync.MessageId;
import org.briarproject.api.sync.Offer;
import org.briarproject.api.sync.Request;
import org.briarproject.api.sync.RetentionAck;
import org.briarproject.api.sync.RetentionUpdate;
import org.briarproject.api.sync.SubscriptionAck;
import org.briarproject.api.sync.SubscriptionUpdate;
import org.briarproject.api.sync.TransportAck;
@@ -108,20 +106,6 @@ public interface DatabaseComponent {
Collection<byte[]> generateRequestedBatch(ContactId c, int maxLength,
int maxLatency) throws DbException;
/**
* Returns a retention ack for the given contact, or null if no retention
* ack is due.
*/
RetentionAck generateRetentionAck(ContactId c) throws DbException;
/**
* Returns a retention update for the given contact, for transmission
* over a transport with the given latency. Returns null if no update is
* due.
*/
RetentionUpdate generateRetentionUpdate(ContactId c, int maxLatency)
throws DbException;
/**
* Returns a subscription ack for the given contact, or null if no
* subscription ack is due.
@@ -263,13 +247,6 @@ public interface DatabaseComponent {
/** Processes a request from the given contact. */
void receiveRequest(ContactId c, Request r) throws DbException;
/** Processes a retention ack from the given contact. */
void receiveRetentionAck(ContactId c, RetentionAck a) throws DbException;
/** Processes a retention update from the given contact. */
void receiveRetentionUpdate(ContactId c, RetentionUpdate u)
throws DbException;
/** Processes a subscription ack from the given contact. */
void receiveSubscriptionAck(ContactId c, SubscriptionAck a)
throws DbException;

View File

@@ -1,9 +0,0 @@
package org.briarproject.api.event;
/**
* An event that is broadcast when one or messages expire from the database,
* potentially changing the database's retention time.
*/
public class MessageExpiredEvent extends Event {
}

View File

@@ -1,20 +0,0 @@
package org.briarproject.api.event;
import org.briarproject.api.ContactId;
/**
* An event that is broadcast when the retention time of a contact's database
* changes.
*/
public class RemoteRetentionTimeUpdatedEvent extends Event {
private final ContactId contactId;
public RemoteRetentionTimeUpdatedEvent(ContactId contactId) {
this.contactId = contactId;
}
public ContactId getContactId() {
return contactId;
}
}

View File

@@ -18,21 +18,15 @@ public interface PacketReader {
boolean hasRequest() throws IOException;
Request readRequest() throws IOException;
boolean hasRetentionAck() throws IOException;
org.briarproject.api.sync.RetentionAck readRetentionAck() throws IOException;
boolean hasRetentionUpdate() throws IOException;
org.briarproject.api.sync.RetentionUpdate readRetentionUpdate() throws IOException;
boolean hasSubscriptionAck() throws IOException;
org.briarproject.api.sync.SubscriptionAck readSubscriptionAck() throws IOException;
SubscriptionAck readSubscriptionAck() throws IOException;
boolean hasSubscriptionUpdate() throws IOException;
org.briarproject.api.sync.SubscriptionUpdate readSubscriptionUpdate() throws IOException;
SubscriptionUpdate readSubscriptionUpdate() throws IOException;
boolean hasTransportAck() throws IOException;
TransportAck readTransportAck() throws IOException;
boolean hasTransportUpdate() throws IOException;
org.briarproject.api.sync.TransportUpdate readTransportUpdate() throws IOException;
TransportUpdate readTransportUpdate() throws IOException;
}

View File

@@ -7,8 +7,6 @@ public interface PacketTypes {
byte MESSAGE = 1;
byte OFFER = 2;
byte REQUEST = 3;
byte RETENTION_ACK = 4;
byte RETENTION_UPDATE = 5;
byte SUBSCRIPTION_ACK = 6;
byte SUBSCRIPTION_UPDATE = 7;
byte TRANSPORT_ACK = 8;

View File

@@ -14,21 +14,17 @@ public interface PacketWriter {
void writeMessage(byte[] raw) throws IOException;
void writeOffer(org.briarproject.api.sync.Offer o) throws IOException;
void writeOffer(Offer o) throws IOException;
void writeRequest(Request r) throws IOException;
void writeRetentionAck(org.briarproject.api.sync.RetentionAck a) throws IOException;
void writeSubscriptionAck(SubscriptionAck a) throws IOException;
void writeRetentionUpdate(org.briarproject.api.sync.RetentionUpdate u) throws IOException;
void writeSubscriptionUpdate(SubscriptionUpdate u) throws IOException;
void writeSubscriptionAck(org.briarproject.api.sync.SubscriptionAck a) throws IOException;
void writeTransportAck(TransportAck a) throws IOException;
void writeSubscriptionUpdate(org.briarproject.api.sync.SubscriptionUpdate u) throws IOException;
void writeTransportAck(org.briarproject.api.sync.TransportAck a) throws IOException;
void writeTransportUpdate(org.briarproject.api.sync.TransportUpdate u) throws IOException;
void writeTransportUpdate(TransportUpdate u) throws IOException;
void flush() throws IOException;
}

View File

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

View File

@@ -1,23 +0,0 @@
package org.briarproject.api.sync;
/**
* A packet updating the recipient's view of the retention time of the sender's
* database.
*/
public class RetentionUpdate {
private final long retention, version;
public RetentionUpdate(long retention, long version) {
this.retention = retention;
this.version = version;
}
public long getRetentionTime() {
return retention;
}
public long getVersion() {
return version;
}
}