The idea is to give other applications access the services that yum provides, undependend of the programing language they are
written in. And most languages has DBus bindings.

The DBus service will be auto launch when someone tries to access it.
Yum will only lock when some consummer grabs the lock and the yum object will be deleted when the lock is released.
So it dont have any big memory impact when not in use. We could close down the service when it unlocked if we want that.
The daemon uses PolicyKit?1 to check for acccess, so if the consummer is non root, the user will get a dialog asking for
root password, so non root application can easy use the yum services, without security issues.

Points to be worked out:

API functions we what to provide

What should they do

What parameter should they take

What should they return an in what format.

Should it be included in the yum source tree or should it live alone ???

if inside yum:

the daemon code could live in yum.daemon

a client wrapper class could live in yum.client

Wrap the DBus daemon interface in a pythonic way to make it easier to use from a python application.

if outside yum

how should it be named : yumdaemon (yumdaemon & yumdaemon.client)

we could include wrappers for other languages (If someone wants to write them)

GetPackages_by_name(pattern, newest_only) (DONE)

GetAttribute(pkg_id, attribute) (DONE)

return an attribute value from at give pkg_id.
attribute = <Yum Package attribute Name> (Ex. 'summanry', 'description')
it return a string there contains a python repr of the attribute
':none' will be returned if attribute dont exist.
':not-found' will be returned if no package matching pkg_id is found

Search:

Search(fields, keys, match_all)

return a list of package ids for matching packages
fields = a list of package attributes to search in (Name, summary, description etc)
keys = a list of key words to search for.
match_all = define if all keys should match or partial match is allowed (boolean)

History

GetHistory(elements)

return a list with a number of history ids (integers)

elements = the number of elements to return

GetHistoryInfo(id)

return a dict with details about a give history id

RedoHistory(id)

redo a given history id

UndoHistory(id)

undo given history id

Transaction

AddTransaction(pkg_id, action) (DONE)

Add a package to the current transaction for an given action
action = install|update|remove|reinstall|downgrade|localinstall
localinstall takes a path to a .rpm file as pkg_id
return a list of transaction ids for the packages added to the transaction

BuildTransaction() (DONE)

resolve the dependencies of the current transaction.
return a (return code, output) pair
return code = 2 is transaction was resolved without problems
if no problems output will contains a repr of a list containing tuples of (action, package info list)
if problmes output will contain a list of desolve problem messages.

RunTransaction() (DONE)

will run the current transaction (Download, signature check, test transaction, transaction)

Signals: (DBus signals sendt by yum's callback handlers)

UpdateProgress(self,name,frac,fread,ftime) (DONE)

This signal will be sent a evey progress callback when something is being downloaded (metadata, packages etc)

TransactionEvent(self,event) (DONE)

This signal will be in differnet part of the transaction flow

event: an action keyword of where we are in the transaction process.
'start-build' : when starting to depsolve
'end-build' : when depsolve is completed
'start-run' : when starting to execute the current transaction
'end-run' : when current transaction is ended without error
'fail' : when current transaction is ended with errors
'download' : when package downloading is started
'signature-check' : when package signature check is started
'run-test-transaction' : when rpm test transaction starts
'run-transaction' : when rpm transaction starts

package: A package id or simple string of a package name
action: the action being performed ( install,cleanup .....)
te_current: Current number of bytes processed in the transaction element being processed
te_total: Total number of bytes in the transaction element being processed
ts_current: number of processes completed in whole transaction
ts_total: total number of processes in the transaction.