[Bug 54010] Plugins should have async API to create accounts
bugzilla-daemon at freedesktop.org
bugzilla-daemon at freedesktop.org
Tue Aug 28 11:43:23 CEST 2012
https://bugs.freedesktop.org/show_bug.cgi?id=54010
--- Comment #3 from Simon McVittie <simon.mcvittie at collabora.co.uk> 2012-08-28 09:43:23 UTC ---
(I haven't reviewed in detail til we agree on an approach.)
The fallback chain through attempts to create accounts, asynchronously, seems
rather undesirable: if you have, say, 5 plugins, then it takes 5 async
round-trips (of which the first 4 are just "do you want to store this account?"
"not really") before we actually do anything. Could we perhaps change it to be
more like this?
create() -> unique ID, a special constant not syntactically allowed
in account names meaning "in progress" (maybe #define
MCP_ACCOUNT_CREATION_IN_PROGRESS to "<in progress>"?),
or NULL to decline
complete_account_creation_async(), _finish() -> unique ID
(should only be called if MCP_ACCOUNT_CREATION_IN_PROGRESS
was returned)
Then we could do (pseudocode):
foreach (storage_plugin)
{
id = storage_plugin.create(...)
if (!tp_strdiff (id, MCP_ACCOUNT_CREATION_IN_PROGRESS))
{
storage_plugin.complete_account_creation_async(...,
lambda id: raise error or actually create the account (id));
break;
}
else if (id != NULL)
{
actually create the account (id);
break;
}
/* else continue to next backend */
}
if (nobody took responsibility)
raise error;
and even though you can't necessarily know what the account's ID is until you
have actually done the "complete account creation" step, you can at least know
whether this plugin is going to be the one to store the account or not. I'm
assuming that plugins are at least intelligent enough to know what they can and
can't store in a synchronous way?
I'm currently thinking about whether to take Bug #35896 as an excuse to write
an actually helpful plugin API with a sensible data model. Perhaps we can
discuss that on IRC later?
--
Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA Contact for the bug.
You are the assignee for the bug.
More information about the telepathy-bugs
mailing list