~zyga/checkbox/misc

Viewing all changes in revision 3933.

  • Committer: Zygmunt Krynicki
  • Date: 2015-08-03 09:25:27 UTC
  • Revision ID: zygmunt.krynicki@canonical.com-20150803092527-g3kp6nb7g5qj8zfv
plainbox:session:state: add SessionDeviceContext.get_unit()

This patch adds an O(1) method for looking up a unit with a given
identifier in the session device context (so a unit that exists on a
given device.

This is done by tracking the addition and removal of appropriate units
and using a lookaside map that maintains the up-to-date state.

This solves the annoying problem that many apps solve by doing this
themselves or by computing a less effective solution.

Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>

expand all expand all

Show diffs side-by-side

added added

removed removed

Lines of Context: