GridLab
Grid Application Toolkit

A simple API for Grid Applications
GAT

Menu



Main Page   Alphabetical List   Compound List   File List   Compound Members   File Members  

GATResourceBroker.h

Go to the documentation of this file.
00001 /** @file GATResourceBroker.h
00002  *  Header file for the GATResourceBroker class.
00003  *
00004  *  An instance of this class is used to broker Resources. A resource can 
00005  *  either be a node or a component.
00006  *
00007  *  @date Thu Oct 23 2003
00008  *
00009  *  @version $Header: /export/cvs-gridlab/wp-1/Codes/GATEngine/C-reference/src/GATResourceBroker.h,v 1.12 2004/03/24 19:30:58 hartmutkaiser Exp $
00010  *
00011  *  Copyright (C) Hartmut Kaiser
00012  *  This file is part of the GAT Engine.
00013  *  Contributed by Hartmut Kaiser <hartmutkaiser [at] t-online [dot] de>.
00014  *
00015  *  Use, modification and distribution is subject to the Gridlab Software
00016  *  License. (See accompanying file GLlicense.txt or copy at
00017  *  http://www.gridlab.org/GLlicense.txt)
00018  */
00019 
00020 #if !defined(_GATRESOURCEBROKER_H_)
00021 #define  _GATRESOURCEBROKER_H_
00022 
00023 /* GAT Header Files */
00024 #include "GATObject.h"
00025 #include "GATType.h"
00026 #include "GATTime.h"
00027 #include "GATList.h"
00028 #include "GATTimePeriod.h"
00029 #include "GATJob.h"
00030 #include "GATJobDescription.h"
00031 #include "GATResourceDescription.h"
00032 
00033 /* Structures, unions and enums */
00034 
00035 #ifdef __cplusplus
00036 extern "C" {
00037 #endif
00038 
00039 /* Declare the needed GATList_GATResource */
00040 GATLIST_DECLARE_QUALIFIED(extern, GATResource, GATList_GATResource);
00041 
00042 /* Declare the converters to/from GATObject */
00043 GATOBJECT_DECLARE_CONVERTERS(GATResourceBroker);
00044 
00045 /** GATResourceBroker_Create
00046  *  @brief Create a new GATResourceBroker object
00047  *
00048  *  The function @c GATResourceBroker_Create creates a new 
00049  *  GATResourceBroker object
00050  *
00051  *  @param context The GAT context to use while thie initialisation of the 
00052  *        new object.
00053  *  @param preferences The preferences to use wile selecting the adaptor for 
00054  *        the corresponding CPI.
00055  *  @param vo_name The name of the virtual organisation to use.
00056  *
00057  *  @return Returns a handle to the newly created GATResourceBroker object.
00058  *        Returns 0 (zero) if an error occurs.
00059  */
00060 GATResourceBroker 
00061   GATResourceBroker_Create(GATContext context, GATPreferences_const preferences,
00062     GATString vo_name);
00063 
00064 /** void GATResourceBroker_Destroy(GATResourceBroker *resource)
00065  *
00066  *  The function GATResourceBroker_Destroy is the destructor used to
00067  *  free all the memory allocated by an GATResourceBroker instance.
00068  *
00069  *  @param description The pointer to the GATResourceBroker to destroy
00070  */
00071 void
00072   GATResourceBroker_Destroy(GATResourceBroker *object);
00073 
00074 /** GATResourceBroker_Equals
00075  *  @brief Compare two GATResourceBroker objects
00076  *
00077  *  The function @c GATResourceBroker_Equals compares two objects of the
00078  *  @c GATResourceBroker type.
00079  *
00080  *  @param lhs The first list to compare
00081  *  @param rhs The second list to compare
00082  *  @param isequal The pointer to the location, where the outcome of the 
00083  *        function has to be stored.
00084  *
00085  *  @return An error code.
00086  */
00087 GATResult
00088   GATResourceBroker_Equals(GATResourceBroker_const lhs,
00089     GATResourceBroker_const rhs, GATBool *isequal);
00090 
00091 /** GATResourceBroker_Clone
00092  *  @brief Clone the given GATResourceBroker
00093  *
00094  *  The function @c GATResourceBroker_Clone generates a (deep) copy of 
00095  *  the given GATResourceBroker. 
00096  *
00097  *  @param description The object to clone
00098  *  @param new_object The pointer, through which the result is to be 
00099  *        returned.
00100  *
00101  *  @return An error type.
00102  */
00103 GATResult
00104   GATResourceBroker_Clone(GATResourceBroker_const object, 
00105     GATResourceBroker *new_object);
00106 
00107 /** GATType GATResourceBroker_GetType(GATResourceBroker_const resource)
00108  *  @brief Return the type of the GATResourceBroker
00109  *
00110  *  The function @c GATResourceBroker_GetType always returns 
00111  *  @c #GATType_GATResourceBroker. 
00112  *
00113  *  @param object The object to inspect
00114  *
00115  *  @return Returns always @c #GATType_GATResourceBroker. 
00116  */
00117 GATType
00118   GATResourceBroker_GetType(GATResourceBroker_const object);
00119 
00120 /** int GATResourceBroker_GetInterface(GATResourceBroker_const file, GATInterface iftype, void const **ifp)
00121  *  @brief Get an interface supported by a GATObject
00122  *
00123  *  The function GATResourceBroker_GetInterface allows to get a pointer to an 
00124  *  additional interface supported by this GATResourceBroker.
00125  *
00126  *  @param object The object to be asked for the new interface.
00127  *  @param iftype The interface the object is to be asked for.
00128  *  @param ifp The pointer, through which the result is to be returned.
00129  *
00130  *  @return An error type.
00131  */
00132 GATResult 
00133   GATResourceBroker_GetInterface(GATResourceBroker_const object, 
00134     GATInterface iftype, void const **ifp);
00135 
00136 /** GATResourceBroker_ReserveResource_Description
00137  *  @brief reserve a resource matching the description
00138  *
00139  *  The function @c GATResourceBroker_ReserveResource_Description tries to find 
00140  *  a resource, which matches the provided description and returns a 
00141  *  reservation for this resource.
00142  *
00143  *  @param broker The resource broker to use for this operation.
00144  *  @param description The resource description needed for selecting the 
00145  *        required resource.
00146  *  @param time The (optional) time, when the reservation has to start.
00147  *  @param duration The (optional) time period for which to reserve the
00148  *        resource.
00149  *  @param reservation The pointer to the GATReservation variable to use to 
00150  *        return the resulting reservation.
00151  *
00152  *  @return An error code.
00153  */
00154 GATResult
00155   GATResourceBroker_ReserveResource_Description(GATResourceBroker broker, 
00156     GATResourceDescription_const description, GATTime_const zeit, 
00157     GATTimePeriod_const duration, GATReservation *reservation);
00158     
00159 /** GATResourceBroker_ReserveResource
00160  *  @brief Reserve a given resource.
00161  *
00162  *  The function @c GATResourceBroker_ReserveResource tries to reserve
00163  *  the given resource and returns a reservation for this resource.
00164  *
00165  *  @param broker The resource broker to use for this operation.
00166  *  @param context The associated GAT context.
00167  *  @param resource The resource to reserve.
00168  *  @param time The (optional) time, when the reservation has to start.
00169  *  @param duration The (optional) time period for which to reserve the 
00170  *        resource.
00171  *  @param reservation The pointer to the GATReservation variable to use to 
00172  *        return the resulting reservation.
00173  *
00174  *  @return An error value.
00175  */
00176 GATResult
00177   GATResourceBroker_ReserveResource(GATResourceBroker broker, 
00178     GATResource_const resource, GATTime_const zeit, 
00179     GATTimePeriod_const duration, GATReservation *reservation);
00180 
00181 /** GATResourceBroker_FindResources
00182  *  @brief Find a list of matching resources.
00183  *
00184  *  The function GATResourceBroker_FindResources tries to find all resources
00185  *  matching the given description and returns the found resources as a list.
00186  *
00187  *  @param broker The resource broker to use for this operation.
00188  *  @param description The description to match while searching for resources.
00189  *  @param resources The pointer to a variable receiving the resulting list of
00190  *        matching resources.
00191  *
00192  *  @return An error value.
00193  */
00194 GATResult
00195   GATResourceBroker_FindResources(GATResourceBroker broker, 
00196     GATResourceDescription_const description, GATList_GATResource *resources);
00197 
00198 /** GATResourceBroker_SubmitJob
00199  *  @brief Submit a new job.
00200  *
00201  *  The function GATResourceBroker_SubmitJob submits a new job to the resource
00202  *  described by the given job description.
00203  *
00204  *  @param broker The resource broker to use for this operation.
00205  *  @param description The job description containing the information about the
00206  *        job iteslf and the resource to use.
00207  *  @param job The pointer to a variable receiving the resulting GATJob object
00208  *        handle.
00209  *
00210  *  @return An error value.
00211  */
00212 GATResult
00213   GATResourceBroker_SubmitJob(GATResourceBroker broker,
00214     GATJobDescription_const description, GATJob *job);
00215     
00216 #ifdef __cplusplus
00217 } /* extern "C" */
00218 #endif
00219 
00220 #endif /* !defined(_GATRESOURCEBROKER_H_) */
00221