Grid Community Toolkit  6.2.1705709074 (tag: v6.2.20240202)
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
globus_object_cache.h
Go to the documentation of this file.
1 /*
2  * Copyright 1999-2006 University of Chicago
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
22 #ifndef GLOBUS_OBJECT_CACHE_H
23 #define GLOBUS_OBJECT_CACHE_H
24 
25 #include "globus_common_include.h"
26 #include "globus_fifo.h"
27 #include "globus_list.h"
28 #include "globus_hashtable.h"
29 
30 #include "globus_object.h"
31 
32 #ifdef __cplusplus
33 extern "C" {
34 #endif
35 
36 /**********************************************************************
37  * Object Cache API Types
38  * globus_object_cache_t -- container
39  **********************************************************************/
40 
41 typedef struct globus_object_cache_s {
42  globus_hashtable_t handlemap;
43  globus_fifo_t handles; /* in case we add a cache list function */
44  unsigned long capacity_limit;
45  unsigned long entry_count;
46 } globus_object_cache_t;
47 
48 
49 /**********************************************************************
50  * Object Cache API
51  **********************************************************************/
52 
53 extern void
54 globus_object_cache_init (globus_object_cache_t * cache);
55 /* does nothing if cache is NULL */
56 
57 extern void
58 globus_object_cache_destroy (globus_object_cache_t * cache);
59 /* does nothing if cache is NULL */
60 
61 extern void
62 globus_object_cache_insert (globus_object_cache_t * cache,
63  void * new_handle,
64  globus_object_t * new_object);
65 /* does nothing if cache is NULL, or new_handle is already mapped in cache,
66  * or new_object is NULL */
67 
68 extern globus_object_t *
69 globus_object_cache_lookup (globus_object_cache_t * cache,
70  void * handle);
71 /* returns object stored in cache with handle, or
72  * returns NULL if not mapped or if cache is NULL */
73 
74 extern globus_object_t *
75 globus_object_cache_remove (globus_object_cache_t * cache,
76  void * handle);
77 /* returns object removed from cache with handle, or
78  * returns NULL if not mapped or if cache is NULL */
79 
80 extern globus_fifo_t *
81 globus_object_cache_list (globus_object_cache_t * cache);
82 /* returns fifo containing existing handles in order inserted, or
83  * returns NULL if cache is NULL */
84 
85 
86 #ifdef __cplusplus
87 }
88 #endif
89 
90 #endif /* GLOBUS_OBJECT_CACHE_H */
Linked List.
struct globus_fifo_s * globus_fifo_t
Definition: globus_fifo.h:48
Hash Table.
Globus FIFO.
Include System Headers.