globus_object_cache.h

Go to the documentation of this file.
00001 /*
00002  * Copyright 1999-2006 University of Chicago
00003  * 
00004  * Licensed under the Apache License, Version 2.0 (the "License");
00005  * you may not use this file except in compliance with the License.
00006  * You may obtain a copy of the License at
00007  * 
00008  * http://www.apache.org/licenses/LICENSE-2.0
00009  * 
00010  * Unless required by applicable law or agreed to in writing, software
00011  * distributed under the License is distributed on an "AS IS" BASIS,
00012  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013  * See the License for the specific language governing permissions and
00014  * limitations under the License.
00015  */
00016 
00022 #ifndef GLOBUS_OBJECT_CACHE_H
00023 #define GLOBUS_OBJECT_CACHE_H
00024 
00025 #include "globus_common_include.h"
00026 #include "globus_fifo.h"
00027 #include "globus_list.h"
00028 #include "globus_hashtable.h"
00029 
00030 #include "globus_object.h"
00031  
00032 #ifdef __cplusplus
00033 extern "C" {
00034 #endif
00035 
00036 /**********************************************************************
00037  * Object Cache API Types
00038  *   globus_object_cache_t          --   container
00039  **********************************************************************/
00040 
00041 typedef struct globus_object_cache_s {
00042   globus_hashtable_t   handlemap;
00043   globus_fifo_t        handles;  /* in case we add a cache list function */
00044   unsigned long        capacity_limit;
00045   unsigned long        entry_count;
00046 } globus_object_cache_t;
00047 
00048 
00049 /**********************************************************************
00050  * Object Cache API
00051  **********************************************************************/
00052 
00053 extern void
00054 globus_object_cache_init (globus_object_cache_t * cache);
00055 /* does nothing if cache is NULL */
00056 
00057 extern void
00058 globus_object_cache_destroy (globus_object_cache_t * cache);
00059 /* does nothing if cache is  NULL */
00060 
00061 extern void
00062 globus_object_cache_insert (globus_object_cache_t * cache,
00063                             void *                  new_handle,
00064                             globus_object_t *       new_object);
00065 /* does nothing if cache is NULL, or new_handle is already mapped in cache,
00066  * or new_object is NULL */
00067 
00068 extern globus_object_t * 
00069 globus_object_cache_lookup (globus_object_cache_t * cache,
00070                             void *                  handle);
00071 /* returns object stored in cache with handle, or 
00072  * returns NULL if not mapped or if cache is NULL */
00073 
00074 extern globus_object_t *
00075 globus_object_cache_remove (globus_object_cache_t * cache,
00076                             void *                  handle);
00077 /* returns object removed from cache with handle, or
00078  * returns NULL if not mapped or if cache is NULL */
00079 
00080 extern globus_fifo_t *
00081 globus_object_cache_list (globus_object_cache_t * cache);
00082 /* returns fifo containing existing handles in order inserted, or
00083  * returns NULL if cache is NULL */
00084 
00085 
00086 #ifdef __cplusplus
00087 }
00088 #endif
00089 
00090 #endif /* GLOBUS_OBJECT_CACHE_H */

Generated on 20 Jun 2015 for globus_common by  doxygen 1.4.7