Changed the format of transport properties from (key, value) pairs to

(transport name, key, value) triples. This makes it possible for each
transport plugin to update its locally stored properties atomically.
This commit is contained in:
akwizgran
2011-08-04 11:07:28 +01:00
parent 5be9d953ee
commit ec29c4d1d3
16 changed files with 264 additions and 172 deletions

View File

@@ -58,7 +58,8 @@ public interface DatabaseComponent {
* Adds a new contact to the database with the given transport properties
* and returns an ID for the contact.
*/
ContactId addContact(Map<String, String> transports) throws DbException;
ContactId addContact(Map<String, Map<String, String>> transports)
throws DbException;
/** Adds a locally generated message to the database. */
void addLocallyGeneratedMessage(Message m) throws DbException;
@@ -111,10 +112,11 @@ public interface DatabaseComponent {
Collection<Group> getSubscriptions() throws DbException;
/** Returns the local transport properties. */
Map<String, String> getTransports() throws DbException;
Map<String, Map<String, String>> getTransports() throws DbException;
/** Returns the transport properties for the given contact. */
Map<String, String> getTransports(ContactId c) throws DbException;
Map<String, Map<String, String>> getTransports(ContactId c)
throws DbException;
/** Returns the contacts to which the given group is visible. */
Collection<ContactId> getVisibility(GroupId g) throws DbException;
@@ -152,9 +154,11 @@ public interface DatabaseComponent {
void setRating(AuthorId a, Rating r) throws DbException;
/**
* Sets the local transport properties, replacing any existing properties.
* Sets the local transport properties for the transport with the given
* name, replacing any existing properties for that transport.
*/
void setTransports(Map<String, String> transports) throws DbException;
void setTransports(String name, Map<String, String> transports)
throws DbException;
/**
* Makes the given group visible to the given set of contacts and invisible

View File

@@ -12,7 +12,7 @@ public interface Transports {
static final int MAX_SIZE = (1024 * 1024) - 100;
/** Returns the transports contained in the update. */
Map<String, String> getTransports();
Map<String, Map<String, String>> getTransports();
/**
* Returns the update's timestamp. Updates that are older than the newest

View File

@@ -7,5 +7,6 @@ import java.util.Map;
public interface TransportWriter {
/** Writes the contents of the update. */
void writeTransports(Map<String, String> transports) throws IOException;
void writeTransports(Map<String, Map<String, String>> transports)
throws IOException;
}