Changes from Version 1 of YumDBusAPI

timlau (IP:
02/11/11 10:42:26 (8 years ago)



  • YumDBusAPI

    v0 v1  
     1= Yum DBus API = 
     3This is a proposal for a API for a Yum DBus daemon service. 
     4It is implemented as a Dbus system service with the name 'org.baseurl.Yum' and an interface named 'org.baseurl.yum.Interface' 
     6There is a prof of concept located here: 
     10API marked with (DONE) has been implemented in the POC. 
     12Check this README to see how to test 
     16The idea is to give other applications access the services that yum provides, undependend of the programing language they are 
     17written in. And most languages has DBus bindings. 
     19The DBus service will be auto launch when someone tries to access it. 
     20Yum will only lock when some consummer grabs the lock and the yum object will be deleted when the lock is released. 
     21So it dont have any big memory impact when not in use. We could close down the service when it unlocked if we want that. 
     22The daemon uses PolicyKit1 to check for acccess, so if the consummer is non root, the user will get a dialog asking for  
     23root password, so non root application can easy use the yum services, without security issues. 
     25= Points to be worked out: = 
     26 * API functions we what to provide 
     27    * What should they do 
     28    * What parameter should they take 
     29    * What should they return an in what format. 
     30 * Should it be included in the yum source tree or should it live alone ??? 
     31    * if inside yum: 
     32        * the daemon code could live in yum.daemon 
     33        * a client wrapper class could live in yum.client  
     34          - Wrap the DBus daemon interface in a pythonic way to make it easier to use from a python application. 
     35    * if outside yum 
     36        * how should it be named : yumdaemon (yumdaemon & yumdaemon.client) 
     37        * we could include wrappers for other languages (If someone wants to write them)         
     39= API Definitions: (Work in Progress) = 
     42== Data == 
     44<Package Id> = "name,epoch,version,release,arch,repoid" (Comma separated string)[[BR]] 
     45<Transaction Id> = "name,epoch,version,release,arch,repoid,ts_state" (Comma separated string) 
     47== Locking == 
     49=== lock() (DONE) === 
     50start a new yum instance and set the yum lock 
     52=== unlock() (DONE) === 
     53release the yum lock and delete the current yum instance 
     56== Config == 
     57=== get_config(option) === 
     58return value from config 
     60=== set_config(option, value, persistant) === 
     61set config option=value (for current session or persistant) 
     65=== Repository === 
     67=== enable_repo(repo_id, persistant) === 
     69Enable repo 
     71=== disable_repo(repo_id, persistant) === 
     73Disable repo 
     75=== get_repositories(repo_type) === 
     77get list with repos [[BR]] 
     78repo_type ::= enabled|disabled|all|source|debuginfo 
     80=== get_repo(repo_id) === 
     82return information about a repo 
     84=== set_repo(repo_id, repo_info) === 
     86change repo info or create new one is not exists[[BR]] 
     87repo_info = {'name' : values,.......} 
     90=== Packages === 
     92=== get_packages(pkg_narrow) (DONE) === 
     94Return list of package ids[[BR]] 
     95pkg_narrow = installed|available|updates|obsoletes|..... 
     97=== get_packages_by_name(pattern, newest_only) (DONE) === 
     99get a list of package ids where name matches pattern[[BR]] 
     100pattern ::= <pattern string> (ex. 'yum', 'yum*')[[BR]] 
     103=== get_attribute(pkg_id, attribute) (DONE) === 
     105return an attribute value from at give pkg_id.[[BR]] 
     106attribute = <Yum Package attribute Name> (Ex. 'summanry', 'description')[[BR]] 
     107it return a string there contains a python repr of the attribute[[BR]] 
     108':none' will be returned if attribute dont exist.[[BR]] 
     109':not-found' will be returned if no package matching pkg_id is found[[BR]] 
     113== Search: == 
     115=== search(fields, keys, match_all) === 
     117return a list of package ids for matching packages[[BR]] 
     118fields = a list of package attributes to search in (Name, summary, description etc)[[BR]] 
     119keys = a list of key words to search for.[[BR]] 
     120match_all = define if all keys should match or partial match is allowed (boolean)[[BR]] 
     124== History == 
     126=== get_history(elements) === 
     128return a list with a number of history ids (integers) 
     130elements = the number of elements to return 
     132=== get_history_info(id) === 
     134return a dict with details about a give history id 
     137=== redo_history(id) === 
     139redo a given history id 
     142=== undo_history(id) === 
     144undo given history id 
     147== Transaction == 
     149=== add_transaction(pkg_id, action) (DONE) === 
     151Add a package to the current transaction for an given action[[BR]] 
     152action = install|update|remove|reinstall|downgrade|localinstall[[BR]] 
     153localinstall takes a path to a .rpm file as pkg_id[[BR]] 
     154return a list of transaction ids for the packages added to the transaction[[BR]] 
     156=== build_transaction() (DONE) === 
     158resolve the dependencies of the current transaction.[[BR]] 
     159return a (return code, output) pair[[BR]] 
     160return code = 2 is transaction was resolved without problems[[BR]] 
     161if no problems output will contains a repr of a list containing tuples of (action, package info list)[[BR]] 
     162if problmes output will contain a list of desolve problem messages.[[BR]] 
     165=== run_transaction() (DONE) === 
     167will run the current transaction (Download, signature check, test transaction, transaction) 
     171== Signals: (DBus signals sendt by yum's callback handlers) == 
     173=== !UpdateProgress(self,name,frac,fread,ftime) (DONE) === 
     174This signal will be sent a evey progress callback when something is being downloaded (metadata, packages etc) 
     176name: filename[[BR]] 
     177frac: Progress fracment (0 -> 1)[[BR]] 
     178fread: formated string containing BytesRead[[BR]] 
     179ftime : formated string containing remaining or elapsed time[[BR]] 
     181=== !TransactionEvent(self,event) (DONE) === 
     182This signal will be in differnet part of the transaction flow 
     184event: an action keyword of where we are in the transaction process.[[BR]] 
     185'start-build'          : when starting to depsolve[[BR]] 
     186'end-build'            : when depsolve is completed[[BR]] 
     187'start-run'            : when starting to execute the current transaction[[BR]] 
     188'end-run'              : when current transaction is ended without error[[BR]] 
     189'fail'                 : when current transaction is ended with errors[[BR]] 
     190'download'             : when package downloading is started[[BR]] 
     191'signature-check'      : when package signature check is started[[BR]] 
     192'run-test-transaction' : when rpm test transaction starts[[BR]] 
     193'run-transaction'      : when rpm transaction starts[[BR]] 
     196=== RPMProgress(self, pkg_id, action, te_current, te_total, ts_current, ts_total) (DONE) === 
     197package: A package id or simple string of a package name[[BR]] 
     198action: the action being performed ( install,cleanup .....)[[BR]] 
     199te_current: Current number of bytes processed in the transaction element being processed[[BR]] 
     200te_total: Total number of bytes in the transaction element being processed[[BR]] 
     201ts_current: number of processes completed in whole transaction[[BR]] 
     202ts_total: total number of processes in the transaction.[[BR]]