1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332
|
#ifndef __SGE_SPOOLING_H
#define __SGE_SPOOLING_H
/*___INFO__MARK_BEGIN__*/
/*************************************************************************
*
* The Contents of this file are made available subject to the terms of
* the Sun Industry Standards Source License Version 1.2
*
* Sun Microsystems Inc., March, 2001
*
*
* Sun Industry Standards Source License Version 1.2
* =================================================
* The contents of this file are subject to the Sun Industry Standards
* Source License Version 1.2 (the "License"); You may not use this file
* except in compliance with the License. You may obtain a copy of the
* License at http://gridengine.sunsource.net/Gridengine_SISSL_license.html
*
* Software provided under this License is provided on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
* See the License for the specific provisions governing your rights and
* obligations concerning the Software.
*
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
*
* Copyright: 2001 by Sun Microsystems, Inc.
*
* All Rights Reserved.
*
************************************************************************/
/*___INFO__MARK_END__*/
#include <time.h>
#include "mir/sge_mirror.h"
#include "spool/sge_spooling.h"
#include "sgeobj/sge_spooling_SPC_L.h"
#include "sgeobj/sge_spooling_SPR_L.h"
#include "sgeobj/sge_spooling_SPT_L.h"
#include "sgeobj/sge_spooling_SPTR_L.h"
#include "sgeobj/sge_spooling_SPM_L.h"
/****** spool/--Spooling ***************************************
*
* NAME
* Spooling -- Spooling framework
*
* FUNCTION
* The spooling framework provides an abstraction layer between the
* application requiring the spooling of configuration and data,
* and the concrete data representation layer.
*
* SEE ALSO
* spool/spool_create_context()
* spool/spool_free_context()
*
* spool/spool_set_default_context()
* spool/spool_get_default_context()
*
* spool/spool_context_search_rule()
* spool/spool_context_create_rule()
* spool/spool_context_search_type()
* spool/spool_context_create_type()
*
* spool/spool_type_search_default_rule()
* spool/spool_type_add_rule()
*
* spool/spool_startup_context()
* spool/spool_shutdown_context()
*
* spool/spool_read_list()
* spool/spool_read_object()
*
* spool/spool_write_object()
*
* spool/spool_delete_object()
*
* spool/spool_compare_objects()
*
****************************************************************************
*/
/****** spool/-Spooling-Typedefs ***************************************
*
* NAME
* Typedefs -- type definitions for the spooling framework
*
* SYNOPSIS
* typedef bool (*spooling_startup_func)(lList **answer_list,
* const lListElem *rule,
* bool check);
* typedef bool (*spooling_shutdown_func)(lList **answer_list,
* const lListElem *rule);
*
* typedef bool (*spooling_list_func)(lList **answer_list,
* const lListElem *type,
* const lListElem *rule,
* lList **list,
* const sge_object_type object_type);
*
* typedef bool (*spooling_write_func)(lList **answer_list,
* const lListElem *type,
* const lListElem *rule,
* const lListElem *object,
* const char *key,
* const sge_object_type object_type);
*
* typedef lListElem *(*spooling_read_func)(lList **answer_list,
* const lListElem *type,
* const lListElem *rule,
* const char *key,
* const sge_object_type object_type);
*
* typedef bool (*spooling_delete_func)(lList **answer_list,
* const lListElem *type,
* const lListElem *rule,
* const char *key,
* const sge_object_type object_type);
*
* typedef bool (*spooling_validate_func)(lList **answer_list,
* const lListElem *type,
* const lListElem *rule,
* lListElem *object,
* const sge_object_type object_type);
*
* FUNCTION
* These functions have to be provided by a target implementation for the
* spooling framework.
*
* The startup and shutdown function initialize the spooling system and
* shut it down (e.g. establish a database connection and close it again.
*
* The list, read, write and delete functions are performing the data
* storage and retrieval into / from the used storage system.
*
* Instances of these function types will be used as callback in calls
* to spool_startup_context, spool_shutdown_context, spool_read_list etc.
*
* SEE ALSO
* spool/spool_startup_context()
* spool/spool_shutdown_context()
*
* spool/spool_read_list()
* spool/spool_read_object()
*
* spool/spool_write_object()
*
* spool/spool_delete_object()
*
****************************************************************************
*/
typedef enum {
SPM_init,
SPM_history,
SPM_backup,
SPM_purge,
SPM_vacuum,
SPM_info
} spooling_maintenance_command;
typedef enum {
STC_begin,
STC_commit,
STC_rollback
} spooling_transaction_command;
typedef const char *
(*spooling_get_method_func)(void);
typedef lListElem *
(*spooling_create_context_func)(lList **answer_list, const char *args);
typedef bool
(*spooling_option_func)(lList **answer_list, lListElem *rule,
const char *option);
typedef bool
(*spooling_startup_func)(lList **answer_list, const lListElem *rule,
bool check);
typedef bool
(*spooling_shutdown_func)(lList **answer_list, const lListElem *rule);
typedef bool
(*spooling_maintenance_func)(lList **answer_list, const lListElem *rule,
const spooling_maintenance_command cmd,
const char *args);
typedef bool
(*spooling_trigger_func)(lList **answer_list, const lListElem *rule,
time_t trigger, time_t *next_trigger);
typedef bool
(*spooling_transaction_func)(lList **answer_list, const lListElem *rule,
spooling_transaction_command cmd);
typedef bool
(*spooling_list_func)(lList **answer_list,
const lListElem *type, const lListElem *rule,
lList **list,
const sge_object_type object_type);
typedef bool
(*spooling_write_func)(lList **answer_list,
const lListElem *type, const lListElem *rule,
const lListElem *object, const char *key,
const sge_object_type object_type);
typedef lListElem *
(*spooling_read_func)(lList **answer_list,
const lListElem *type, const lListElem *rule,
const char *key,
const sge_object_type object_type);
typedef bool
(*spooling_delete_func)(lList **answer_list,
const lListElem *type, const lListElem *rule,
const char *key,
const sge_object_type object_type);
typedef bool
(*spooling_validate_func)(lList **answer_list,
const lListElem *type, const lListElem *rule,
lListElem *object,
const sge_object_type object_type);
typedef bool
(*spooling_validate_list_func)(lList **answer_list,
const lListElem *type, const lListElem *rule,
const sge_object_type object_type);
/* creation and maintenance of the spooling context */
lListElem *
spool_create_context(lList **answer_list, const char *name);
lListElem *
spool_free_context(lList **answer_list, lListElem *context);
void
spool_set_default_context(lListElem *context);
lListElem *
spool_get_default_context(void);
lListElem *
spool_context_search_rule(const lListElem *context, const char *name);
lListElem *
spool_context_create_rule(lList **answer_list, lListElem *context,
const char *name, const char *url,
spooling_option_func option_func,
spooling_startup_func startup_func,
spooling_shutdown_func shutdown_func,
spooling_maintenance_func maintenance_func,
spooling_trigger_func trigger_func,
spooling_transaction_func transaction_func,
spooling_list_func list_func,
spooling_read_func read_func,
spooling_write_func write_func,
spooling_delete_func delete_func,
spooling_validate_func validate_func,
spooling_validate_list_func validate_list_func);
lListElem *
spool_context_search_type(const lListElem *context,
const sge_object_type object_type);
lListElem *
spool_context_create_type(lList **answer_list, lListElem *context,
const sge_object_type object_type);
lListElem *
spool_type_search_default_rule(const lListElem *spool_type);
lListElem
*spool_type_add_rule(lList **answer_list, lListElem *spool_type,
const lListElem *rule, lBool is_default);
bool
spool_set_option(lList **answer_list, lListElem *context, const char *option);
/* startup and shutdown */
bool
spool_startup_context(lList **answer_list, lListElem *context, bool check);
bool
spool_shutdown_context(lList **answer_list, lListElem *context);
bool
spool_maintain_context(lList **answer_list, lListElem *context,
const spooling_maintenance_command cmd,
const char *args);
bool
spool_trigger_context(lList **answer_list, lListElem *context,
time_t trigger, time_t *next_trigger);
bool spool_transaction(lList **answer_list, lListElem *context,
spooling_transaction_command cmd);
/* reading */
bool
spool_read_list(lList **answer_list, const lListElem *context,
lList **list, const sge_object_type object_type);
lListElem *
spool_read_object(lList **answer_list, const lListElem *context,
const sge_object_type object_type, const char *key);
/* writing */
bool
spool_write_object(lList **answer_list, const lListElem *context,
const lListElem *object, const char *key,
const sge_object_type object_type,
bool do_job_spooling);
/* deleting */
bool
spool_delete_object(lList **answer_list, const lListElem *context,
const sge_object_type object_type, const char *key,
bool do_job_spooling);
/* compare spooled attributes of 2 objects */
bool
spool_compare_objects(lList **answer_list, const lListElem *context,
const sge_object_type object_type,
const lListElem *ep1, const lListElem *ep2);
const char *get_spooling_method(void);
#endif /* __SGE_SPOOLING_H */
|