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.c File Reference

Source file for the GATResourceBroker class. More...

#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include "GAT.h"
#include "GATInternal.h"
#include "GATRegistry.h"
#include "GATResourceBrokerCPI.h"

Include dependency graph for GATResourceBroker.c:

Include dependency graph

Go to the source code of this file.

Functions

 GATLIST_IMPLEMENT (extern, GATResource, GATList_GATResource, GATType_GATResource)
 GATOBJECT_DEFINE_VTABLE (GATResourceBroker)
 GATOBJECT_DEFINE_CONVERTERS (GATResourceBroker) struct GATResourceBroker_S
GATResult GATResourceBroker_GetCPIInstanceData (GATResourceBroker object, void **data)
GATResult GATResourceBroker_SetJobEnvironment (GATResourceBroker broker, GATJobDescription description, GATJobID_const gatjobid)
GATResourceBroker GATResourceBroker_Create (GATContext context, GATPreferences_const preferences, GATString vo_name)
 GATResourceBroker_Create Create a new GATResourceBroker object.

void GATResourceBroker_Destroy (GATResourceBroker *object)
 void GATResourceBroker_Destroy(GATResourceBroker *resource)

GATResult GATResourceBroker_Equals (GATResourceBroker_const lhs, GATResourceBroker_const rhs, GATBool *isequal)
 GATResourceBroker_Equals Compare two GATResourceBroker objects.

GATResult GATResourceBroker_Clone (GATResourceBroker_const handle, GATResourceBroker *new_handle)
 GATResourceBroker_Clone Clone the given GATResourceBroker.

GATType GATResourceBroker_GetType (GATResourceBroker_const object)
 GATType GATResourceBroker_GetType(GATResourceBroker_const resource) Return the type of the GATResourceBroker.

GATResult GATResourceBroker_GetInterface (GATResourceBroker_const object, GATInterface iftype, void const **ifp)
 int GATResourceBroker_GetInterface(GATResourceBroker_const file, GATInterface iftype, void const **ifp) Get an interface supported by a GATObject

GATResult GATResourceBroker_ReserveResource_Description (GATResourceBroker broker, GATResourceDescription_const description, GATTime_const time_of_start, GATTimePeriod_const duration, GATReservation *reservation)
 GATResourceBroker_ReserveResource_Description reserve a resource matching the description.

GATResult GATResourceBroker_ReserveResource (GATResourceBroker broker, GATResource_const resource, GATTime_const time_of_start, GATTimePeriod_const duration, GATReservation *reservation)
 GATResourceBroker_ReserveResource Reserve a given resource.

GATResult GATResourceBroker_FindResources (GATResourceBroker broker, GATResourceDescription_const description, GATList_GATResource *resources)
 GATResourceBroker_FindResources Find a list of matching resources.

GATResult GATResourceBroker_SubmitJob (GATResourceBroker broker, GATJobDescription_const description, GATJob *job)
 GATResourceBroker_SubmitJob Submit a new job.


Variables

const char * rcsid = "$Header: /export/cvs-gridlab/wp-1/Codes/GATEngine/C-reference/src/GATResourceBroker.c,v 1.18 2004/04/20 12:33:22 hartmutkaiser Exp $"
GATResourceBroker_vtable GATResourceBroker__vtable


Detailed Description

Source file for the GATResourceBroker class.

An instance of this class is used to broker Resources. A resource can either be a node or a component.

Date:
Thu Oct 23 2003
Version:
Header:
/export/cvs-gridlab/wp-1/Codes/GATEngine/C-reference/src/GATResourceBroker.c,v 1.18 2004/04/20 12:33:22 hartmutkaiser Exp

Copyright (C) Hartmut Kaiser This file is part of the GAT Engine. Contributed by Hartmut Kaiser <hartmutkaiser [at] t-online [dot] de>.

Use, modification and distribution is subject to the Gridlab Software License. (See accompanying file GLlicense.txt or copy at http://www.gridlab.org/GLlicense.txt)

Definition in file GATResourceBroker.c.


Function Documentation

GATLIST_IMPLEMENT extern   ,
GATResource   ,
GATList_GATResource   ,
GATType_GATResource   
 

Definition at line 233 of file GATResourceDescription.c.

GATOBJECT_DEFINE_VTABLE GATResourceBroker   
 

GATOBJECT_DEFINE_CONVERTERS GATResourceBroker   
 

Definition at line 44 of file GATResourceBroker.c.

References cpi, data, and GATResourceBroker.

GATResult GATResourceBroker_GetCPIInstanceData GATResourceBroker    object,
void **    data
[static]
 

Definition at line 550 of file GATResourceBroker.c.

References data, GAT_CREATE_STATUS, GAT_INVALID_HANDLE, GAT_INVALID_PARAMETER, GAT_RETURN_STATUS, GAT_USES_STATUS, and GATResourceBroker.

GATResult GATResourceBroker_SetJobEnvironment GATResourceBroker    broker,
GATJobDescription    description,
GATJobID_const    gatjobid
[static]
 

Definition at line 583 of file GATResourceBroker.c.

References GAT_CREATE_STATUS, GAT_INVALID_HANDLE, GAT_RETURN_STATUS, GAT_USES_STATUS, GATContext_internal_GetSelf(), GATJobDescription, GATJobDescription_internal_GetEnvironment(), GATJobID_const, GATResourceBroker, GATSelf_const, GATSelf_internal_GetGATJobId(), GATString_GetBuffer(), and GATTable_Add_String().

Referenced by GATResourceBroker_SubmitJob().

GATResourceBroker GATResourceBroker_Create GATContext    context,
GATPreferences_const    preferences,
GATString    vo_name
 

GATResourceBroker_Create Create a new GATResourceBroker object.

The function GATResourceBroker_Create creates a new GATResourceBroker object

Parameters:
context  The GAT context to use while the initialisation of the new object.
preferences  The preferences to use while selecting the adaptor for the corresponding CPI.
Returns:
Returns a handle to the newly created GATResourceBroker object. Returns 0 (zero) if an error occurs.

Definition at line 94 of file GATResourceBroker.c.

References GAT_MEMORYFAILURE, GAT_NO_MATCHING_CPI, GAT_NO_REGISTERED_CPI, GAT_SUCCEEDED, GAT_SUCCESS, GATBool, GATContext_GetPreferences(), GATContext_internal_GetRegistry(), GATFalse, GATPreferences_const, GATRegistry_const, GATResourceBroker, GATResourceBroker__vtable, GATResourceBroker_Destroy(), GATResourceBrokerCPI_CreateInstance(), GATResult, GATString_Clone(), and GATTrue.

Referenced by main().

void GATResourceBroker_Destroy GATResourceBroker   object
 

void GATResourceBroker_Destroy(GATResourceBroker *resource)

The function GATResourceBroker_Destroy is the destructor used to free all the memory allocated by an GATResourceBroker instance.

Parameters:
description  The pointer to the GATResourceBroker to destroy

Definition at line 179 of file GATResourceBroker.c.

References GATResourceBroker, GATResourceBrokerCPI_DestroyInstance(), and GATString_Destroy().

Referenced by GATResourceBroker_Clone(), GATResourceBroker_Create(), and main().

GATResult GATResourceBroker_Equals GATResourceBroker_const    lhs,
GATResourceBroker_const    rhs,
GATBool   isequal
 

GATResourceBroker_Equals Compare two GATResourceBroker objects.

The function GATResourceBroker_Equals compares two objects of the GATResourceBroker type.

Parameters:
lhs  The first list to compare
rhs  The second list to compare
isequal  The pointer to the GATBool variable, which should receive the result if the comparision
Returns:
An error code.

Definition at line 210 of file GATResourceBroker.c.

References GAT_INVALID_HANDLE, GAT_INVALID_PARAMETER, GAT_SUCCEEDED, GAT_SUCCESS, GATBool, GATFalse, GATResourceBroker_const, GATResourceBrokerCPI_EqualsInstance(), GATResult, GATString_Equals(), and GATTrue.

GATResult GATResourceBroker_Clone GATResourceBroker_const    handle,
GATResourceBroker   new_handle
 

GATResourceBroker_Clone Clone the given GATResourceBroker.

The function GATResourceBroker_Clone generates a (deep) copy of the given GATResourceBroker.

Parameters:
description  The object to clone
new_object  The pointer, through which the result is to be returned.
Returns:
An error type.

Definition at line 258 of file GATResourceBroker.c.

References assert, GAT_CREATE_STATUS, GAT_CURRENT_STATUS, GAT_FAILED, GAT_INVALID_HANDLE, GAT_INVALID_PARAMETER, GAT_MEMORYFAILURE, GAT_SUCCEEDED, GAT_USES_STATUS, GATResourceBroker, GATResourceBroker__vtable, GATResourceBroker_const, GATResourceBroker_Destroy(), GATResourceBrokerCPI_CloneInstance(), GATString_Clone(), and handle.

GATType GATResourceBroker_GetType GATResourceBroker_const    object
 

GATType GATResourceBroker_GetType(GATResourceBroker_const resource) Return the type of the GATResourceBroker.

The function GATResourceBroker_GetType always returns #GATType_GATResourceBroker.

Parameters:
object  The object to inspect
Returns:
Returns always #GATType_GATResourceBroker.

Definition at line 350 of file GATResourceBroker.c.

References GAT_UNUSED_PARAMETER, GATResourceBroker_const, and GATType_GATResourceBroker.

GATResult GATResourceBroker_GetInterface GATResourceBroker_const    object,
GATInterface    iftype,
void const **    ifp
 

int GATResourceBroker_GetInterface(GATResourceBroker_const file, GATInterface iftype, void const **ifp) Get an interface supported by a GATObject

The function GATResourceBroker_GetInterface allows to get a pointer to an additional interface supported by this GATResourceBroker.

Parameters:
object  The object to be asked for the new interface.
iftype  The interface the object is to be asked for.
ifp  The pointer, through which the result is to be returned.
Returns:
An error type.

Definition at line 369 of file GATResourceBroker.c.

References GAT_CREATE_STATUS, GAT_INVALID_HANDLE, GAT_INVALID_PARAMETER, GAT_NO_INTERFACE, GAT_RETURN_STATUS, GAT_STATUS_APIENTRY, GAT_UNUSED_PARAMETER, GATInterface, and GATResourceBroker_const.

GATResult GATResourceBroker_ReserveResource_Description GATResourceBroker    broker,
GATResourceDescription_const    description,
GATTime_const    time_of_start,
GATTimePeriod_const    duration,
GATReservation   reservation
 

GATResourceBroker_ReserveResource_Description reserve a resource matching the description.

The function GATResourceBroker_ReserveResource_Description tries to find a resource, which matches the provided description and returns a reservation for this resource.

Parameters:
broker  The resource broker to use for this operation.
description  The resource description needed for selecting the required resource.
time  The (optional) time, when the reservation has to start.
duration  The (optional) time period for which to reserve the resource.
reservation  The pointer to the GATReservation variable to use to return the resulting reservation.
Returns:
An error code.

Definition at line 413 of file GATResourceBroker.c.

References GAT_CREATE_STATUS, GAT_INVALID_HANDLE, GAT_RETURN_STATUS, GAT_STATUS_APIENTRY, GATReservation, GATResourceBroker, GATResourceBrokerCPI_ReserveResource_Description(), GATResourceDescription_const, GATTime_const, and GATTimePeriod_const.

GATResult GATResourceBroker_ReserveResource GATResourceBroker    broker,
GATResource_const    resource,
GATTime_const    time_of_start,
GATTimePeriod_const    duration,
GATReservation   reservation
 

GATResourceBroker_ReserveResource Reserve a given resource.

The function GATResourceBroker_ReserveResource tries to reserve the given resource and returns a reservation for this resource.

Parameters:
broker  The resource broker to use for this operation.
context  The associated GAT context.
resource  The resource to reserve.
time  The (optional) time, when the reservation has to start.
duration  The (optional) time period for which to reserve the resource.
reservation  The pointer to the GATReservation variable to use to return the resulting reservation.
Returns:
An error value.

Definition at line 446 of file GATResourceBroker.c.

References GAT_CREATE_STATUS, GAT_INVALID_HANDLE, GAT_RETURN_STATUS, GAT_STATUS_APIENTRY, GATReservation, GATResource_const, GATResourceBroker, GATResourceBrokerCPI_ReserveResource(), GATTime_const, and GATTimePeriod_const.

GATResult GATResourceBroker_FindResources GATResourceBroker    broker,
GATResourceDescription_const    description,
GATList_GATResource *    resources
 

GATResourceBroker_FindResources Find a list of matching resources.

The function GATResourceBroker_FindResources tries to find all resources matching the given description and returns the found resources as a list.

Parameters:
broker  The resource broker to use for this operation.
description  The description to match while searching for resources.
resources  The pointer to a variable receiving the resulting list of matching resources.
Returns:
An error value.

Definition at line 474 of file GATResourceBroker.c.

References GAT_CREATE_STATUS, GAT_INVALID_HANDLE, GAT_RETURN_STATUS, GAT_STATUS_APIENTRY, GATResourceBroker, GATResourceBrokerCPI_FindResources(), and GATResourceDescription_const.

Referenced by main().

GATResult GATResourceBroker_SubmitJob GATResourceBroker    broker,
GATJobDescription_const    description,
GATJob   job
 

GATResourceBroker_SubmitJob Submit a new job.

The function GATResourceBroker_SubmitJob submits a new job to the resource described by the given job description.

Parameters:
broker  The resource broker to use for this operation.
description  The job description containing the information about the job iteslf and the resource to use.
job  The pointer to a variable receiving the resulting GATJob object handle.
Returns:
An error value.

Definition at line 501 of file GATResourceBroker.c.

References GAT_CREATE_STATUS, GAT_INVALID_HANDLE, GAT_RETURN_STATUS, GAT_STATUS_APIENTRY, GATContext_internal_GetSelf(), GATJob, GATJob_internal_SetGATJobId(), GATJobDescription, GATJobDescription_Clone(), GATJobDescription_const, GATJobDescription_Destroy(), GATResourceBroker, GATResourceBroker_SetJobEnvironment(), GATResourceBrokerCPI_SubmitJob(), GATResult, GATSelf_const, GATSelf_internal_CreateGATJobId(), and GATString_Destroy().

Referenced by main().


Variable Documentation

const char* rcsid = "$Header: /export/cvs-gridlab/wp-1/Codes/GATEngine/C-reference/src/GATResourceBroker.c,v 1.18 2004/04/20 12:33:22 hartmutkaiser Exp $" [static]
 

Definition at line 20 of file GATResourceBroker.c.

GATResourceBroker_vtable GATResourceBroker__vtable
 

Initial value:

 {
  GATResourceBroker_GetType,
  GATResourceBroker_Destroy,
  GATResourceBroker_Equals,
  GATResourceBroker_Clone,
  GATResourceBroker_GetInterface,
  GATResourceBroker_GetCPIInstanceData
}

Definition at line 68 of file GATResourceBroker.c.

Referenced by GATResourceBroker_Clone(), and GATResourceBroker_Create().