mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-13 11:19:04 +01:00
Add placeholder BlockSource implementation to DB.
This commit is contained in:
@@ -208,6 +208,24 @@ public interface DatabaseComponent {
|
||||
Collection<Message> generateRequestedBatch(Transaction txn, ContactId c,
|
||||
int maxLength, int maxLatency) throws DbException;
|
||||
|
||||
/**
|
||||
* Returns the number of blocks in the given message.
|
||||
* <p>
|
||||
* Read-only.
|
||||
*/
|
||||
int getBlockCount(Transaction txn, MessageId m) throws DbException;
|
||||
|
||||
/**
|
||||
* Returns the given block of the given message.
|
||||
* <p>
|
||||
* Read-only.
|
||||
*
|
||||
* @throws NoSuchBlockException if 'blockNumber' is greater than or equal
|
||||
* to the number of blocks in the message
|
||||
*/
|
||||
byte[] getBlock(Transaction txn, MessageId m, int blockNumber)
|
||||
throws DbException;
|
||||
|
||||
/**
|
||||
* Returns the contact with the given ID.
|
||||
* <p/>
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
package org.briarproject.bramble.api.db;
|
||||
|
||||
/**
|
||||
* Thrown when a database operation is attempted for a block that is not in
|
||||
* the database. This exception may occur due to concurrent updates and does
|
||||
* not indicate a database error.
|
||||
*/
|
||||
public class NoSuchBlockException extends DbException {
|
||||
}
|
||||
Reference in New Issue
Block a user