Use 'retention' rather than 'expiry' to describe DB's retention period.

This will avoid a name clash when retransmission is implemented.
This commit is contained in:
akwizgran
2013-01-29 14:33:43 +00:00
parent 3e1c41c62f
commit c3c349970b
13 changed files with 360 additions and 357 deletions

View File

@@ -11,8 +11,8 @@ import net.sf.briar.api.TransportProperties;
import net.sf.briar.api.db.event.DatabaseListener;
import net.sf.briar.api.protocol.Ack;
import net.sf.briar.api.protocol.AuthorId;
import net.sf.briar.api.protocol.ExpiryAck;
import net.sf.briar.api.protocol.ExpiryUpdate;
import net.sf.briar.api.protocol.RetentionAck;
import net.sf.briar.api.protocol.RetentionUpdate;
import net.sf.briar.api.protocol.Group;
import net.sf.briar.api.protocol.GroupId;
import net.sf.briar.api.protocol.Message;
@@ -98,24 +98,24 @@ public interface DatabaseComponent {
Collection<byte[]> generateBatch(ContactId c, int maxLength,
Collection<MessageId> requested) throws DbException;
/**
* Generates an expiry ack for the given contact. Returns null if no ack
* is due.
*/
ExpiryAck generateExpiryAck(ContactId c) throws DbException;
/**
* Generates an expiry update for the given contact. Returns null if no
* update is due.
*/
ExpiryUpdate generateExpiryUpdate(ContactId c) throws DbException;
/**
* Generates an offer for the given contact. Returns null if there are no
* messages to offer.
*/
Offer generateOffer(ContactId c, int maxMessages) throws DbException;
/**
* Generates a retention ack for the given contact. Returns null if no ack
* is due.
*/
RetentionAck generateRetentionAck(ContactId c) throws DbException;
/**
* Generates a retention update for the given contact. Returns null if no
* update is due.
*/
RetentionUpdate generateRetentionUpdate(ContactId c) throws DbException;
/**
* Generates a subscription ack for the given contact. Returns null if no
* ack is due.
@@ -200,12 +200,6 @@ public interface DatabaseComponent {
/** Processes an ack from the given contact. */
void receiveAck(ContactId c, Ack a) throws DbException;
/** Processes an expiry ack from the given contact. */
void receiveExpiryAck(ContactId c, ExpiryAck a) throws DbException;
/** Processes an expiry update from the given contact. */
void receiveExpiryUpdate(ContactId c, ExpiryUpdate u) throws DbException;
/** Processes a message from the given contact. */
void receiveMessage(ContactId c, Message m) throws DbException;
@@ -219,6 +213,13 @@ public interface DatabaseComponent {
*/
Request receiveOffer(ContactId c, Offer o) 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,23 +0,0 @@
package net.sf.briar.api.protocol;
/**
* A packet updating the recipient's view of the expiry time of the sender's
* database.
*/
public class ExpiryUpdate {
private final long expiry, version;
public ExpiryUpdate(long expiry, long version) {
this.expiry = expiry;
this.version = version;
}
public long getExpiryTime() {
return expiry;
}
public long getVersionNumber() {
return version;
}
}

View File

@@ -9,12 +9,6 @@ public interface ProtocolReader {
boolean hasAck() throws IOException;
Ack readAck() throws IOException;
boolean hasExpiryAck() throws IOException;
ExpiryAck readExpiryAck() throws IOException;
boolean hasExpiryUpdate() throws IOException;
ExpiryUpdate readExpiryUpdate() throws IOException;
boolean hasMessage() throws IOException;
UnverifiedMessage readMessage() throws IOException;
@@ -24,6 +18,12 @@ public interface ProtocolReader {
boolean hasRequest() throws IOException;
Request readRequest() throws IOException;
boolean hasRetentionAck() throws IOException;
RetentionAck readRetentionAck() throws IOException;
boolean hasRetentionUpdate() throws IOException;
RetentionUpdate readRetentionUpdate() throws IOException;
boolean hasSubscriptionAck() throws IOException;
SubscriptionAck readSubscriptionAck() throws IOException;

View File

@@ -10,16 +10,16 @@ public interface ProtocolWriter {
void writeAck(Ack a) throws IOException;
void writeExpiryAck(ExpiryAck a) throws IOException;
void writeExpiryUpdate(ExpiryUpdate e) throws IOException;
void writeMessage(byte[] raw) throws IOException;
void writeOffer(Offer o) throws IOException;
void writeRequest(Request r) throws IOException;
void writeRetentionAck(RetentionAck a) throws IOException;
void writeRetentionUpdate(RetentionUpdate u) throws IOException;
void writeSubscriptionAck(SubscriptionAck a) throws IOException;
void writeSubscriptionUpdate(SubscriptionUpdate u) throws IOException;

View File

@@ -1,11 +1,11 @@
package net.sf.briar.api.protocol;
/** A packet acknowledging a (@link ExpiryUpdate} */
public class ExpiryAck {
/** A packet acknowledging a (@link RetentionUpdate} */
public class RetentionAck {
private final long version;
public ExpiryAck(long version) {
public RetentionAck(long version) {
this.version = version;
}

View File

@@ -0,0 +1,23 @@
package net.sf.briar.api.protocol;
/**
* 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 getVersionNumber() {
return version;
}
}

View File

@@ -6,11 +6,11 @@ public interface Types {
int AUTHOR = 0;
int GROUP = 1;
int ACK = 2;
int EXPIRY_ACK = 3;
int EXPIRY_UPDATE = 4;
int MESSAGE = 5;
int OFFER = 6;
int REQUEST = 7;
int MESSAGE = 3;
int OFFER = 4;
int REQUEST = 5;
int RETENTION_ACK = 6;
int RETENTION_UPDATE = 7;
int SUBSCRIPTION_ACK = 8;
int SUBSCRIPTION_UPDATE = 9;
int TRANSPORT_ACK = 10;