Changes from Version 1 of YumDBusAPI

Show
Ignore:
Author:
timlau (IP: 195.212.29.84)
Timestamp:
02/11/11 10:42:26 (7 years ago)
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • YumDBusAPI

    v0 v1  
     1= Yum DBus API = 
     2 
     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' 
     5 
     6There is a prof of concept located here: 
     7 
     8https://github.com/timlau/YumTools/tree/master/yum-daemon 
     9 
     10API marked with (DONE) has been implemented in the POC. 
     11 
     12Check this README to see how to test 
     13 
     14https://github.com/timlau/YumTools/blob/master/yum-daemon/README 
     15 
     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. 
     18 
     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. 
     24 
     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)         
     38 
     39= API Definitions: (Work in Progress) = 
     40 
     41 
     42== Data == 
     43 
     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) 
     46                 
     47== Locking == 
     48 
     49=== lock() (DONE) === 
     50start a new yum instance and set the yum lock 
     51 
     52=== unlock() (DONE) === 
     53release the yum lock and delete the current yum instance 
     54 
     55---- 
     56== Config == 
     57=== get_config(option) === 
     58return value from config 
     59 
     60=== set_config(option, value, persistant) === 
     61set config option=value (for current session or persistant) 
     62 
     63     
     64---- 
     65=== Repository === 
     66 
     67=== enable_repo(repo_id, persistant) === 
     68 
     69Enable repo 
     70 
     71=== disable_repo(repo_id, persistant) === 
     72 
     73Disable repo 
     74 
     75=== get_repositories(repo_type) === 
     76 
     77get list with repos [[BR]] 
     78repo_type ::= enabled|disabled|all|source|debuginfo 
     79 
     80=== get_repo(repo_id) === 
     81 
     82return information about a repo 
     83 
     84=== set_repo(repo_id, repo_info) === 
     85 
     86change repo info or create new one is not exists[[BR]] 
     87repo_info = {'name' : values,.......} 
     88 
     89---- 
     90=== Packages === 
     91 
     92=== get_packages(pkg_narrow) (DONE) === 
     93 
     94Return list of package ids[[BR]] 
     95pkg_narrow = installed|available|updates|obsoletes|..... 
     96         
     97=== get_packages_by_name(pattern, newest_only) (DONE) === 
     98 
     99get a list of package ids where name matches pattern[[BR]] 
     100pattern ::= <pattern string> (ex. 'yum', 'yum*')[[BR]] 
     101 
     102 
     103=== get_attribute(pkg_id, attribute) (DONE) === 
     104 
     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]] 
     110 
     111 
     112---- 
     113== Search: == 
     114 
     115=== search(fields, keys, match_all) === 
     116 
     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]] 
     121 
     122 
     123---- 
     124== History == 
     125 
     126=== get_history(elements) === 
     127 
     128return a list with a number of history ids (integers) 
     129 
     130elements = the number of elements to return 
     131 
     132=== get_history_info(id) === 
     133 
     134return a dict with details about a give history id 
     135 
     136 
     137=== redo_history(id) === 
     138 
     139redo a given history id 
     140 
     141 
     142=== undo_history(id) === 
     143 
     144undo given history id 
     145 
     146---- 
     147== Transaction == 
     148 
     149=== add_transaction(pkg_id, action) (DONE) === 
     150 
     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]] 
     155 
     156=== build_transaction() (DONE) === 
     157 
     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]] 
     163 
     164 
     165=== run_transaction() (DONE) === 
     166 
     167will run the current transaction (Download, signature check, test transaction, transaction) 
     168 
     169 
     170---- 
     171== Signals: (DBus signals sendt by yum's callback handlers) == 
     172 
     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) 
     175 
     176name: filename[[BR]] 
     177frac: Progress fracment (0 -> 1)[[BR]] 
     178fread: formated string containing BytesRead[[BR]] 
     179ftime : formated string containing remaining or elapsed time[[BR]] 
     180 
     181=== !TransactionEvent(self,event) (DONE) === 
     182This signal will be in differnet part of the transaction flow 
     183 
     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]] 
     194 
     195 
     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]] 
     203