diff --git a/components/net/sf/briar/db/Database.java b/components/net/sf/briar/db/Database.java index 796c163c6..977df1292 100644 --- a/components/net/sf/briar/db/Database.java +++ b/components/net/sf/briar/db/Database.java @@ -30,13 +30,13 @@ import net.sf.briar.api.transport.ConnectionWindow; * Locking is provided by the DatabaseComponent implementation. To prevent * deadlock, locks must be acquired in the following order: *
- * Locking: contacts read, messageStatuses write.
+ * Locking: contact read, messageStatus write.
*/
void addBatchToAck(T txn, ContactId c, BatchId b) throws DbException;
@@ -80,7 +80,7 @@ interface Database
- * Locking: contacts write, transports write.
+ * Locking: contact write, transport write.
*/
ContactId addContact(T txn,
Map
- * Locking: messages write.
+ * Locking: message write.
*/
boolean addGroupMessage(T txn, Message m) throws DbException;
/**
* Records a sent batch as needing to be acknowledged.
*
- * Locking: contacts read, messages read, messageStatuses write.
+ * Locking: contact read, message read, messageStatus write.
*/
void addOutstandingBatch(T txn, ContactId c, BatchId b,
Collection
- * Locking: contacts read, messages write.
+ * Locking: contact read, message write.
*/
boolean addPrivateMessage(T txn, Message m, ContactId c) throws DbException;
/**
* Subscribes to the given group.
*
- * Locking: subscriptions write.
+ * Locking: subscription write.
*/
void addSubscription(T txn, Group g) throws DbException;
/**
* Returns true if the database contains the given contact.
*
- * Locking: contacts read.
+ * Locking: contact read.
*/
boolean containsContact(T txn, ContactId c) throws DbException;
/**
* Returns true if the database contains the given message.
*
- * Locking: messages read.
+ * Locking: message read.
*/
boolean containsMessage(T txn, MessageId m) throws DbException;
/**
* Returns true if the user subscribes to the given group.
*
- * Locking: subscriptions read.
+ * Locking: subscription read.
*/
boolean containsSubscription(T txn, GroupId g) throws DbException;
@@ -142,7 +142,7 @@ interface Database
- * Locking: subscriptions read.
+ * Locking: subscription read.
*/
boolean containsSubscription(T txn, GroupId g, long time)
throws DbException;
@@ -152,7 +152,7 @@ interface Database
- * Locking: contacts read, subscriptions read.
+ * Locking: contact read, subscription read.
*/
boolean containsVisibleSubscription(T txn, GroupId g, ContactId c,
long time) throws DbException;
@@ -161,14 +161,14 @@ interface Database
- * Locking: contacts read, messageStatuses read.
+ * Locking: contact read, messageStatus read.
*/
Collection
- * Locking: transports read.
+ * Locking: transport read.
*/
TransportConfig getConfig(T txn, TransportId t) throws DbException;
@@ -176,7 +176,7 @@ interface Database
- * Locking: contacts read, windows write.
+ * Locking: contact read, window write.
*/
long getConnectionNumber(T txn, ContactId c, TransportId t)
throws DbException;
@@ -185,7 +185,7 @@ interface Database
- * Locking: contacts read, windows read.
+ * Locking: contact read, window read.
*/
ConnectionWindow getConnectionWindow(T txn, ContactId c, TransportId t)
throws DbException;
@@ -193,7 +193,7 @@ interface Database
- * Locking: contacts read.
+ * Locking: contact read.
*/
Collection
- * Locking: messages read.
+ * Locking: message read.
*/
long getFreeSpace() throws DbException;
@@ -211,14 +211,14 @@ interface Database
- * Locking: messages read.
+ * Locking: message read.
*/
MessageId getGroupMessageParent(T txn, MessageId m) throws DbException;
/**
* Returns the local transport properties for the given transport.
*
- * Locking: transports read.
+ * Locking: transport read.
*/
TransportProperties getLocalProperties(T txn, TransportId t)
throws DbException;
@@ -226,7 +226,7 @@ interface Database
- * Locking: transports read.
+ * Locking: transport read.
*/
Map
- * Locking: contacts read, messages read, messageStatuses read.
+ * Locking: contact read, message read, messageStatus read.
*/
Collection
- * Locking: messages read.
+ * Locking: message read.
*/
byte[] getMessage(T txn, MessageId m) throws DbException;
/**
* Returns the body of the message identified by the given ID.
*
- * Locking: messages read.
+ * Locking: message read.
*/
byte[] getMessageBody(T txn, MessageId m) throws DbException;
/**
* Returns the headers of all messages in the given group.
*
- * Locking: messages read.
+ * Locking: message read.
*/
Collection
- * Locking: contacts read, messages read, messageStatuses read,
- * subscriptions read.
+ * Locking: contact read, message read, messageStatus read,
+ * subscription read.
*/
byte[] getMessageIfSendable(T txn, ContactId c, MessageId m)
throws DbException;
@@ -275,7 +275,7 @@ interface Database
- * Locking: messages read.
+ * Locking: message read.
*/
Collection
- * Locking: messages read.
+ * Locking: message read.
*/
int getNumberOfSendableChildren(T txn, MessageId m) throws DbException;
@@ -293,21 +293,21 @@ interface Database
- * Locking: messages read.
+ * Locking: message read.
*/
Collection
- * Locking: ratings read.
+ * Locking: rating read.
*/
Rating getRating(T txn, AuthorId a) throws DbException;
/**
* Returns all remote properties for the given transport.
*
- * Locking: contacts read, transports read.
+ * Locking: contact read, transport read.
*/
Map
- * Locking: messages read.
+ * Locking: message read.
*/
int getSendability(T txn, MessageId m) throws DbException;
@@ -323,8 +323,8 @@ interface Database
- * Locking: contacts read, messages read, messageStatuses read,
- * subscriptions read.
+ * Locking: contact read, message read, messageStatus read,
+ * subscription read.
*/
Collection
- * Locking: contacts read, messages read, messageStatuses read,
- * subscriptions read.
+ * Locking: contact read, message read, messageStatus read,
+ * subscription read.
*/
Collection
- * Locking: contacts read.
+ * Locking: contact read.
*/
byte[] getSharedSecret(T txn, ContactId c) throws DbException;
/**
* Returns the groups to which the user subscribes.
*
- * Locking: subscriptions read.
+ * Locking: subscription read.
*/
Collection
- * Locking: contacts read, subscriptions read.
+ * Locking: contact read, subscription read.
*/
Collection
- * Locking: contacts read, subscriptions read.
+ * Locking: contact read, subscription read.
*/
long getSubscriptionsModified(T txn, ContactId c) throws DbException;
@@ -372,14 +372,14 @@ interface Database
- * Locking: contacts read, subscriptions read.
+ * Locking: contact read, subscription read.
*/
long getSubscriptionsSent(T txn, ContactId c) throws DbException;
/**
* Returns the time at which the local transports were last modified.
*
- * Locking: transports read.
+ * Locking: transport read.
*/
long getTransportsModified(T txn) throws DbException;
@@ -387,14 +387,14 @@ interface Database
- * Locking: contacts read, transports read.
+ * Locking: contact read, transport read.
*/
long getTransportsSent(T txn, ContactId c) throws DbException;
/**
* Returns the contacts to which the given group is visible.
*
- * Locking: contacts read, subscriptions read.
+ * Locking: contact read, subscription read.
*/
Collection
- * Locking: contacts read, messages read, messageStatuses read.
+ * Locking: contact read, message read, messageStatus read.
*/
boolean hasSendableMessages(T txn, ContactId c) throws DbException;
@@ -417,7 +417,7 @@ interface Database
- * Locking: contacts read, messages read, messageStatuses write.
+ * Locking: contact read, message read, messageStatus write.
*/
void removeAckedBatch(T txn, ContactId c, BatchId b) throws DbException;
@@ -425,7 +425,7 @@ interface Database
- * Locking: contacts read, messageStatuses write.
+ * Locking: contact read, messageStatus write.
*/
void removeBatchesToAck(T txn, ContactId c, Collection
- * Locking: contacts write, messages write, messageStatuses write,
- * subscriptions write, transports write.
+ * Locking: contact write, message write, messageStatus write,
+ * subscription write, transport write.
*/
void removeContact(T txn, ContactId c) throws DbException;
@@ -443,14 +443,14 @@ interface Database
- * Locking: contacts read, messages read, messageStatuses write.
+ * Locking: contact read, message read, messageStatus write.
*/
void removeLostBatch(T txn, ContactId c, BatchId b) throws DbException;
/**
* Removes a message (and all associated state) from the database.
*
- * Locking: contacts read, messages write, messageStatuses write.
+ * Locking: contact read, message write, messageStatus write.
*/
void removeMessage(T txn, MessageId m) throws DbException;
@@ -458,8 +458,8 @@ interface Database
- * Locking: contacts read, messages write, messageStatuses write,
- * subscriptions write.
+ * Locking: contact read, message write, messageStatus write,
+ * subscription write.
*/
void removeSubscription(T txn, GroupId g) throws DbException;
@@ -467,7 +467,7 @@ interface Database
- * Locking: transports write.
+ * Locking: transport write.
*/
void setConfig(T txn, TransportId t, TransportConfig config)
throws DbException;
@@ -476,7 +476,7 @@ interface Database
- * Locking: contacts read, windows write.
+ * Locking: contact read, window write.
*/
void setConnectionWindow(T txn, ContactId c, TransportId t,
ConnectionWindow w) throws DbException;
@@ -485,7 +485,7 @@ interface Database
- * Locking: transports write.
+ * Locking: transport write.
*/
void setLocalProperties(T txn, TransportId t, TransportProperties p)
throws DbException;
@@ -493,21 +493,21 @@ interface Database
- * Locking: ratings write.
+ * Locking: rating write.
*/
Rating setRating(T txn, AuthorId a, Rating r) throws DbException;
/**
* Sets the sendability score of the given message.
*
- * Locking: messages write.
+ * Locking: message write.
*/
void setSendability(T txn, MessageId m, int sendability) throws DbException;
/**
* Sets the status of the given message with respect to the given contact.
*
- * Locking: contacts read, messages read, messageStatuses write.
+ * Locking: contact read, message read, messageStatus write.
*/
void setStatus(T txn, ContactId c, MessageId m, Status s)
throws DbException;
@@ -518,8 +518,8 @@ interface Database
- * Locking: contacts read, messages read, messageStatuses write,
- * subscriptions read.
+ * Locking: contact read, message read, messageStatus write,
+ * subscription read.
*/
boolean setStatusSeenIfVisible(T txn, ContactId c, MessageId m)
throws DbException;
@@ -528,7 +528,7 @@ interface Database
- * Locking: contacts read, subscriptions write.
+ * Locking: contact read, subscription write.
*/
void setSubscriptions(T txn, ContactId c, Map
- * Locking: contacts read, subscriptions write.
+ * Locking: contact read, subscription write.
*/
void setSubscriptionsModified(T txn, Collection
- * Locking: contacts read, subscriptions write.
+ * Locking: contact read, subscription write.
*/
void setSubscriptionsSent(T txn, ContactId c, long timestamp)
throws DbException;
@@ -556,7 +556,7 @@ interface Database
- * Locking: contacts read, transports write.
+ * Locking: contact read, transport write.
*/
void setTransports(T txn, ContactId c,
Map
- * Locking: contacts read, transports write.
+ * Locking: contact read, transport write.
*/
void setTransportsModified(T txn, long timestamp) throws DbException;
@@ -573,7 +573,7 @@ interface Database
- * Locking: contacts read, transports write.
+ * Locking: contact read, transport write.
*/
void setTransportsSent(T txn, ContactId c, long timestamp)
throws DbException;
@@ -582,7 +582,7 @@ interface Database
- * Locking: contacts read, subscriptions write.
+ * Locking: contact read, subscription write.
*/
void setVisibility(T txn, GroupId g, Collection
- * Locking: contacts read, messages write, messageStatuses write.
+ * Locking: contact read, message write, messageStatus write.
* @param sender may be null for a locally generated message.
*/
private boolean storeGroupMessage(T txn, Message m, ContactId sender)
@@ -247,7 +247,7 @@ DatabaseCleaner.Callback {
/**
* Calculates and returns the sendability score of a message.
*
- * Locking: messages write.
+ * Locking: message write.
*/
private int calculateSendability(T txn, Message m) throws DbException {
int sendability = 0;
@@ -265,7 +265,7 @@ DatabaseCleaner.Callback {
* a change in the message's sendability. Returns the number of ancestors
* that have changed from sendable to not sendable, or vice versa.
*
- * Locking: messages write.
+ * Locking: message write.
* @param increment True if the message's sendability has changed from 0 to
* greater than 0, or false if it has changed from greater than 0 to 0.
*/
@@ -334,7 +334,7 @@ DatabaseCleaner.Callback {
* the given contact, depending on whether the message is outgoing or
* incoming, respectively.
*
- * Locking: contacts read, messages write, messageStatuses write.
+ * Locking: contact read, message write, messageStatus write.
*/
private boolean storePrivateMessage(T txn, Message m, ContactId c,
boolean incoming) throws DbException {
@@ -354,7 +354,7 @@ DatabaseCleaner.Callback {
/**
* Returns true if the database contains the given contact.
*
- * Locking: contacts read.
+ * Locking: contact read.
*/
private boolean containsContact(ContactId c) throws DbException {
T txn = db.startTransaction();
@@ -1010,8 +1010,8 @@ DatabaseCleaner.Callback {
* Attempts to store a collection of messages received from the given
* contact, and returns true if any were stored.
*
- * Locking: contacts read, messages write, messageStatuses write,
- * subscriptions read.
+ * Locking: contact read, message write, messageStatus write,
+ * subscription read.
*/
private boolean storeMessages(T txn, ContactId c,
Collection
- * Locking: messages write.
+ * Locking: message write.
* @param increment True if the user's rating for the author has changed
* from not good to good, or false if it has changed from good to not good.
*/
@@ -1483,7 +1483,7 @@ DatabaseCleaner.Callback {
/**
* Removes the given message (and all associated state) from the database.
*
- * Locking: contacts read, messages write, messageStatuses write.
+ * Locking: contact read, message write, messageStatus write.
*/
private void removeMessage(T txn, MessageId m) throws DbException {
int sendability = db.getSendability(txn, m);