File: globus_object_cache.h

package info (click to toggle)
globus-common 15.26-3
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 3,648 kB
  • ctags: 3,162
  • sloc: ansic: 36,114; sh: 11,654; makefile: 407; perl: 351; xml: 322
file content (90 lines) | stat: -rw-r--r-- 2,750 bytes parent folder | download | duplicates (8)
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
/*
 * Copyright 1999-2006 University of Chicago
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 * http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

/**
 * @file globus_object_cache.h
 * @brief Object Cache
 */

#ifndef GLOBUS_OBJECT_CACHE_H
#define GLOBUS_OBJECT_CACHE_H

#include "globus_common_include.h"
#include "globus_fifo.h"
#include "globus_list.h"
#include "globus_hashtable.h"

#include "globus_object.h"
 
#ifdef __cplusplus
extern "C" {
#endif

/**********************************************************************
 * Object Cache API Types
 *   globus_object_cache_t          --   container
 **********************************************************************/

typedef struct globus_object_cache_s {
  globus_hashtable_t   handlemap;
  globus_fifo_t        handles;  /* in case we add a cache list function */
  unsigned long        capacity_limit;
  unsigned long        entry_count;
} globus_object_cache_t;


/**********************************************************************
 * Object Cache API
 **********************************************************************/

extern void
globus_object_cache_init (globus_object_cache_t * cache);
/* does nothing if cache is NULL */

extern void
globus_object_cache_destroy (globus_object_cache_t * cache);
/* does nothing if cache is  NULL */

extern void
globus_object_cache_insert (globus_object_cache_t * cache,
			    void *                  new_handle,
			    globus_object_t *       new_object);
/* does nothing if cache is NULL, or new_handle is already mapped in cache,
 * or new_object is NULL */

extern globus_object_t * 
globus_object_cache_lookup (globus_object_cache_t * cache,
			    void *                  handle);
/* returns object stored in cache with handle, or 
 * returns NULL if not mapped or if cache is NULL */

extern globus_object_t *
globus_object_cache_remove (globus_object_cache_t * cache,
			    void *                  handle);
/* returns object removed from cache with handle, or
 * returns NULL if not mapped or if cache is NULL */

extern globus_fifo_t *
globus_object_cache_list (globus_object_cache_t * cache);
/* returns fifo containing existing handles in order inserted, or
 * returns NULL if cache is NULL */


#ifdef __cplusplus
}
#endif

#endif /* GLOBUS_OBJECT_CACHE_H */