Package entropy :: Package db :: Module skel

Source Code for Module entropy.db.skel

  1  # -*- coding: utf-8 -*- 
  2  """ 
  3   
  4      @author: Fabio Erculiani <lxnay@sabayonlinux.org> 
  5      @contact: lxnay@sabayonlinux.org 
  6      @copyright: Fabio Erculiani 
  7      @license: GPL-2 
  8   
  9      B{Entropy Framework repository database prototype classes module}. 
 10  """ 
 11   
 12   
13 -class EntropyRepositoryPlugin(object):
14 """ 15 This is the base class for implementing EntropyRepository plugin hooks. 16 You have to subclass this, implement not implemented methods and provide 17 it to EntropyRepository class as described below. 18 19 Every plugin hook function features this signature: 20 int something_hook(entropy_repository_instance) 21 Where entropy_repository_instance is the calling EntropyRepository instance. 22 Every method should return a return status code which, when nonzero causes 23 a RepositoryPluginError exception to be thrown. 24 Every method returns 0 in the base class implementation. 25 """ 26
27 - def get_id(self):
28 """ 29 Return string identifier of myself. 30 31 @return: EntropyRepositoryPlugin identifier. 32 @rtype: string 33 """ 34 return str(self)
35
36 - def get_metadata(self):
37 """ 38 Developers reimplementing EntropyRepositoryPlugin can provide metadata 39 along with every instance. 40 If you want to provide read-only metadata, this method should really 41 return a copy of the metadata object, otherwise, return its direct 42 reference. 43 Metadata format is a map-like object (dictionary, dict()). 44 By default this method does return an empty dict. 45 Make sure that your metadata dictionaries around don't have keys in 46 common, otherwise those will be randomly overwritten eachothers. 47 48 @return: plugin metadata 49 @rtype: dict 50 """ 51 return {}
52
53 - def add_plugin_hook(self, entropy_repository_instance):
54 """ 55 Called during EntropyRepository plugin addition. 56 57 @param entropy_repository_instance: EntropyRepository instance 58 @type entropy_repository_instance: EntropyRepository 59 @return: execution status code, return nonzero for errors, this will 60 raise a RepositoryPluginError exception. 61 @rtype: int 62 """ 63 return 0
64
65 - def remove_plugin_hook(self, entropy_repository_instance):
66 """ 67 Called during EntropyRepository plugin removal. 68 69 @param entropy_repository_instance: EntropyRepository instance 70 @type entropy_repository_instance: EntropyRepository 71 @return: execution status code, return nonzero for errors, this will 72 raise a RepositoryPluginError exception. 73 @rtype: int 74 """ 75 return 0
76
77 - def commit_hook(self, entropy_repository_instance):
78 """ 79 Called during EntropyRepository data commit. 80 81 @param entropy_repository_instance: EntropyRepository instance 82 @type entropy_repository_instance: EntropyRepository 83 @return: execution status code, return nonzero for errors, this will 84 raise a RepositoryPluginError exception. 85 @rtype: int 86 """ 87 return 0
88
89 - def close_repo_hook(self, entropy_repository_instance):
90 """ 91 Called during EntropyRepository instance shutdown (closeDB). 92 93 @param entropy_repository_instance: EntropyRepository instance 94 @type entropy_repository_instance: EntropyRepository 95 @return: execution status code, return nonzero for errors, this will 96 raise a RepositoryPluginError exception. 97 @rtype: int 98 """ 99 return 0
100
101 - def add_package_hook(self, entropy_repository_instance, idpackage, 102 package_data):
103 """ 104 Called after the addition of a package from EntropyRepository. 105 106 @param entropy_repository_instance: EntropyRepository instance 107 @type entropy_repository_instance: EntropyRepository 108 @param idpackage: Entropy repository package identifier 109 @type idpackage: int 110 @param package_data: package metadata used for insertion 111 (see addPackage) 112 @type package_data: dict 113 @return: execution status code, return nonzero for errors, this will 114 raise a RepositoryPluginError exception. 115 @rtype: int 116 """ 117 return 0
118
119 - def remove_package_hook(self, entropy_repository_instance, idpackage, 120 from_add_package):
121 """ 122 Called after the removal of a package from EntropyRepository. 123 124 @param entropy_repository_instance: EntropyRepository instance 125 @type entropy_repository_instance: EntropyRepository 126 @param idpackage: Entropy repository package identifier 127 @type idpackage: int 128 @param from_add_package: inform whether removePackage() is called inside 129 addPackage() 130 @return: execution status code, return nonzero for errors, this will 131 raise a RepositoryPluginError exception. 132 @rtype: int 133 """ 134 return 0
135
136 - def clear_cache_hook(self, entropy_repository_instance):
137 """ 138 Called during EntropyRepository cache cleanup (clearCache). 139 140 @param entropy_repository_instance: EntropyRepository instance 141 @type entropy_repository_instance: EntropyRepository 142 @return: execution status code, return nonzero for errors, this will 143 raise a RepositoryPluginError exception. 144 @rtype: int 145 """ 146 return 0
147
148 - def initialize_repo_hook(self, entropy_repository_instance):
149 """ 150 Called during EntropyRepository data initialization (not instance init). 151 152 @param entropy_repository_instance: EntropyRepository instance 153 @type entropy_repository_instance: EntropyRepository 154 @return: execution status code, return nonzero for errors, this will 155 raise a RepositoryPluginError exception. 156 @rtype: int 157 """ 158 return 0
159
160 - def accept_license_hook(self, entropy_repository_instance):
161 """ 162 Called during EntropyRepository acceptLicense call. 163 164 @param entropy_repository_instance: EntropyRepository instance 165 @type entropy_repository_instance: EntropyRepository 166 @return: execution status code, return nonzero for errors, this will 167 raise a RepositoryPluginError exception. 168 @rtype: int 169 """ 170 return 0
171
172 - def treeupdates_move_action_hook(self, entropy_repository_instance, 173 idpackage):
174 """ 175 Called after EntropyRepository treeupdates move action execution for 176 given idpackage in given EntropyRepository instance. 177 178 @param entropy_repository_instance: EntropyRepository instance 179 @type entropy_repository_instance: EntropyRepository 180 @param idpackage: Entropy repository package identifier 181 @type idpackage: int 182 @return: execution status code, return nonzero for errors, this will 183 raise a RepositoryPluginError exception. 184 @rtype: int 185 """ 186 return 0
187
188 - def treeupdates_slot_move_action_hook(self, entropy_repository_instance, 189 idpackage):
190 """ 191 Called after EntropyRepository treeupdates slot move action 192 execution for given idpackage in given EntropyRepository instance. 193 194 @param entropy_repository_instance: EntropyRepository instance 195 @type entropy_repository_instance: EntropyRepository 196 @param idpackage: Entropy repository package identifier 197 @type idpackage: int 198 @return: execution status code, return nonzero for errors, this will 199 raise a RepositoryPluginError exception. 200 @rtype: int 201 """ 202 return 0
203
204 - def reverse_dependencies_tree_generation_hook(self, 205 entropy_repository_instance):
206 """ 207 This hook is called inside 208 EntropyRepository.generateReverseDependenciesMetadata() method at 209 the very end of the function code. 210 Every time that repository is "tainted" with new packages, sooner or 211 later that function is called. 212 213 @param entropy_repository_instance: EntropyRepository instance 214 @type entropy_repository_instance: EntropyRepository 215 @return: execution status code, return nonzero for errors, this will 216 raise a RepositoryPluginError exception. 217 @rtype: int 218 """ 219 return 0
220