mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-13 19:29:06 +01:00
added a cache to the IdentityManager, changed its signature, modified when and where the author is stored
made the author creation single-threaded again in the LifecycleManager, removed redundant code
This commit is contained in:
@@ -4,49 +4,23 @@ import org.briarproject.api.db.DbException;
|
||||
import org.briarproject.api.db.Transaction;
|
||||
import org.briarproject.api.identity.Author.Status;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
public interface IdentityManager {
|
||||
|
||||
/** Registers a hook to be called whenever a local pseudonym is added. */
|
||||
void registerAddIdentityHook(AddIdentityHook hook);
|
||||
/** Stores the local pseudonym. */
|
||||
void registerLocalAuthor(LocalAuthor a) throws DbException;
|
||||
|
||||
/** Registers a hook to be called whenever a local pseudonym is removed. */
|
||||
void registerRemoveIdentityHook(RemoveIdentityHook hook);
|
||||
|
||||
/** Stores a local pseudonym. */
|
||||
void addLocalAuthor(LocalAuthor a) throws DbException;
|
||||
|
||||
/** Returns the local pseudonym with the given ID. */
|
||||
LocalAuthor getLocalAuthor(AuthorId a) throws DbException;
|
||||
|
||||
/** Returns the local pseudonym with the given ID. */
|
||||
LocalAuthor getLocalAuthor(Transaction txn, AuthorId a) throws DbException;
|
||||
|
||||
/** Returns the main local identity. */
|
||||
/** Returns the cached main local identity, non-blocking, or loads it from
|
||||
* the db, blocking*/
|
||||
LocalAuthor getLocalAuthor() throws DbException;
|
||||
|
||||
/** Returns the main local identity within the given Transaction. */
|
||||
/** Returns the cached main local identity, non-blocking, or loads it from
|
||||
* the db, blocking, within the given Transaction. */
|
||||
LocalAuthor getLocalAuthor(Transaction txn) throws DbException;
|
||||
|
||||
/** Returns all local pseudonyms. */
|
||||
Collection<LocalAuthor> getLocalAuthors() throws DbException;
|
||||
|
||||
/** Removes a local pseudonym and all associated state. */
|
||||
void removeLocalAuthor(AuthorId a) throws DbException;
|
||||
|
||||
/** Returns the trust-level status of the author */
|
||||
Status getAuthorStatus(AuthorId a) throws DbException;
|
||||
|
||||
/** Returns the trust-level status of the author */
|
||||
Status getAuthorStatus(Transaction txn, AuthorId a) throws DbException;
|
||||
|
||||
interface AddIdentityHook {
|
||||
void addingIdentity(Transaction txn, LocalAuthor a) throws DbException;
|
||||
}
|
||||
|
||||
interface RemoveIdentityHook {
|
||||
void removingIdentity(Transaction txn, LocalAuthor a)
|
||||
throws DbException;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user