mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-12 18:59:06 +01:00
Changed "neighbour" to "contact" throughout (messy, but it's only going to get messier later). Also reordered some methods in DatabaseComponent impls.
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
package net.sf.briar.api.db;
|
||||
|
||||
/** Uniquely identifies a neighbour. */
|
||||
public class NeighbourId {
|
||||
/** Uniquely identifies a contact. */
|
||||
public class ContactId {
|
||||
|
||||
private final int id;
|
||||
|
||||
public NeighbourId(int id) {
|
||||
public ContactId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ public class NeighbourId {
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if(o instanceof NeighbourId) return id == ((NeighbourId) o).id;
|
||||
if(o instanceof ContactId) return id == ((ContactId) o).id;
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -29,14 +29,14 @@ public interface DatabaseComponent {
|
||||
/** Waits for any open transactions to finish and closes the database. */
|
||||
void close() throws DbException;
|
||||
|
||||
/** Adds a new contact to the database. */
|
||||
void addContact(ContactId c) throws DbException;
|
||||
|
||||
/** Adds a locally generated message to the database. */
|
||||
void addLocallyGeneratedMessage(Message m) throws DbException;
|
||||
|
||||
/** Adds a new neighbour to the database. */
|
||||
void addNeighbour(NeighbourId n) throws DbException;
|
||||
|
||||
/** Generates a bundle of messages for the given neighbour. */
|
||||
void generateBundle(NeighbourId n, Bundle b) throws DbException;
|
||||
/** Generates a bundle of messages for the given contact. */
|
||||
void generateBundle(ContactId c, Bundle b) throws DbException;
|
||||
|
||||
/** Returns the user's rating for the given author. */
|
||||
Rating getRating(AuthorId a) throws DbException;
|
||||
@@ -45,13 +45,13 @@ public interface DatabaseComponent {
|
||||
Set<GroupId> getSubscriptions() throws DbException;
|
||||
|
||||
/**
|
||||
* Processes a bundle of messages received from the given neighbour. Some
|
||||
* Processes a bundle of messages received from the given contact. Some
|
||||
* or all of the messages in the bundle may be stored.
|
||||
*/
|
||||
void receiveBundle(NeighbourId n, Bundle b) throws DbException;
|
||||
void receiveBundle(ContactId c, Bundle b) throws DbException;
|
||||
|
||||
/** Removes a neighbour (and all associated state) from the database. */
|
||||
void removeNeighbour(NeighbourId n) throws DbException;
|
||||
/** Removes a contact (and all associated state) from the database. */
|
||||
void removeContact(ContactId c) throws DbException;
|
||||
|
||||
/** Records the user's rating for the given author. */
|
||||
void setRating(AuthorId a, Rating r) throws DbException;
|
||||
|
||||
@@ -1,17 +1,11 @@
|
||||
package net.sf.briar.api.db;
|
||||
|
||||
/** The status of a message with respect to a neighbour. */
|
||||
/** The status of a message with respect to a particular contact. */
|
||||
public enum Status {
|
||||
/**
|
||||
* The message has not been sent to, received from, or acked by the
|
||||
* neighbour.
|
||||
*/
|
||||
/** The message has not been sent, received, or acked. */
|
||||
NEW,
|
||||
/**
|
||||
* The message has been sent to, but not received from or acked by, the
|
||||
* neighbour.
|
||||
*/
|
||||
/** The message has been sent, but not received or acked. */
|
||||
SENT,
|
||||
/** The message has been received from or acked by the neighbour. */
|
||||
/** The message has been received or acked. */
|
||||
SEEN
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user