Commit Graph

32 Commits

Author SHA1 Message Date
akwizgran
e589d44d9f Where possible, do IO outside transactions and locks. 2011-09-21 18:04:21 +01:00
akwizgran
43a6a22f4a Don't call finish() unless at least one message ID was written. 2011-09-21 17:52:34 +01:00
akwizgran
8dd7ec93e7 DatabaseComponent.generateAck() now returns a boolean.
The return value indicates whether any batch IDs were written.
AckWriter.finish() and Database.removeBatchesToAck() are only called
if at least one batch ID was written.
2011-09-21 17:51:17 +01:00
akwizgran
95c3fb4fed Removed getCapacity() from BatchWriter interface. 2011-09-21 12:37:19 +01:00
akwizgran
5548eb32cd DatabaseComponent.generateBatch() now returns a boolean.
This allows a connection to know whether to try writing another batch
immediately, or to wait for an event from the DB.
2011-09-20 14:45:07 +01:00
akwizgran
75446b7f7e Collapsed ack handling into a single transaction.
The locks were being held across all transactions anyway, so there was
no granularity advantage to using multiple transactions.
2011-09-19 18:51:27 +01:00
akwizgran
3dd3742a96 Folded findLostBatches() into receiveAck(). 2011-09-19 18:45:19 +01:00
akwizgran
7aeb6029a6 Assertions and comments. 2011-09-19 16:42:27 +01:00
akwizgran
4b97be897e Don't attempt to retrieve ratings for anonymous messages. 2011-09-19 16:25:49 +01:00
akwizgran
44c8f9ceaa Folded ReadWriteLockDatabaseComponent into its parent. 2011-09-19 15:29:40 +01:00
akwizgran
7ef44fbab1 Updated javadoc and renamed type parameters. 2011-09-19 15:01:55 +01:00
akwizgran
5f05a7f898 Unit tests for private messages. 2011-09-16 11:33:55 +01:00
akwizgran
005e7d5207 Added a random salt to prevent ID clashes between anonymous messages. 2011-09-13 17:56:44 +01:00
akwizgran
b78cfa6c88 More DB support for private messages - needs unit tests. 2011-09-13 15:40:33 +01:00
akwizgran
2670d7b821 DB support for private messages. 2011-09-13 15:12:36 +01:00
akwizgran
de5caca578 Basic database support for private messages. 2011-09-13 14:43:48 +01:00
akwizgran
1d25b5a92e Use null instead of MessageId.NONE and AuthorId.NONE, as for other
optional fields.
2011-09-13 14:04:23 +01:00
akwizgran
ff0909a0e9 Listeners for subscription changes. 2011-08-02 09:22:54 +01:00
akwizgran
adee3e121c Added support for registering listeners with the database that are
called when new messages are available, and a new method
hasSendableMessages(ContactId) that listeners can call to see whether
it's worth trying to create a batch.
2011-07-27 20:27:43 +01:00
akwizgran
10edc05dff Database portion of the offer/request/transfer protocol (untested). 2011-07-26 15:40:34 +01:00
akwizgran
e13b0437c3 Rewrote the bundle reading and writing code to eliminate copying. Signatures and digests are now calculated on the fly as the data is read or written. This is a little bit tricky in the case of reading because ReaderImpl uses a lookahead byte, so the signature and message digest need to lag one byte behind. 2011-07-13 16:39:31 +01:00
akwizgran
e0509db45d Protocol refactoring. Each bundle now consists of a signed header and zero or more signed batches. There is no overall signature on the bundle, since the bundle's contents may need to be processed before the entire bundle has been read. The protocol does not prevent an adversary from removing batches from a bundle, reordering batches, moving them from one bundle to another, etc. However, since each batch is signed and acknowledged independently, no such guarantees are required. Bundle IDs will go away when the retransmission mechanism is changed. 2011-07-12 12:55:46 +01:00
akwizgran
4f5eb21180 Builders for batches and bundles. 2011-07-11 12:25:04 +01:00
akwizgran
b548820f77 Transport details for contacts can be stored in the database (these are arbitrary key/value pairs that describe how to reach the contact using a particular transport). Moved the generic ContactId and Rating classes out of the database package of the API. 2011-07-06 16:50:01 +01:00
akwizgran
13b3d4cc03 Unit tests and bugfixes for DatabaseComponent. Merged code from various unique ID classes into a common superclass. 2011-07-05 16:58:44 +01:00
akwizgran
f97393f160 Unit tests, refactoring and bugfixes for the database. Replies to messages in
other groups no longer affect sendability, which makes it safe to delete all
messages from a group when unsubscribing.
2011-07-05 14:16:29 +01:00
akwizgran
eb752ada62 Factored out the database cleaner. 2011-07-04 18:11:27 +01:00
akwizgran
0ed2a7c9e7 Javadocs and unit tests. 2011-07-01 12:07:00 +01:00
akwizgran
b29a024c2a Changed "neighbour" to "contact" throughout (messy, but it's only going to get messier later). Also reordered some methods in DatabaseComponent impls. 2011-06-29 13:16:33 +01:00
akwizgran
ed0174a91b Added the ability to remove neighbours from the database (untested). 2011-06-29 12:54:00 +01:00
akwizgran
d193f23e4c Replaced printlns with logging, moved delete() to FileUtils. 2011-06-27 10:38:30 +01:00
akwizgran
cd4f99df3d Initial commit with new directory structure. 2011-06-21 18:01:28 +01:00