]> CyberLeo.Net >> Repos - FreeBSD/releng/10.0.git/blob - contrib/subversion/subversion/libsvn_subr/cache.h
- Copy stable/10 (r259064) to releng/10.0 as part of the
[FreeBSD/releng/10.0.git] / contrib / subversion / subversion / libsvn_subr / cache.h
1 /*
2  * cache.h: cache vtable interface
3  *
4  * ====================================================================
5  *    Licensed to the Apache Software Foundation (ASF) under one
6  *    or more contributor license agreements.  See the NOTICE file
7  *    distributed with this work for additional information
8  *    regarding copyright ownership.  The ASF licenses this file
9  *    to you under the Apache License, Version 2.0 (the
10  *    "License"); you may not use this file except in compliance
11  *    with the License.  You may obtain a copy of the License at
12  *
13  *      http://www.apache.org/licenses/LICENSE-2.0
14  *
15  *    Unless required by applicable law or agreed to in writing,
16  *    software distributed under the License is distributed on an
17  *    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
18  *    KIND, either express or implied.  See the License for the
19  *    specific language governing permissions and limitations
20  *    under the License.
21  * ====================================================================
22  */
23
24 #ifndef SVN_LIBSVN_SUBR_CACHE_H
25 #define SVN_LIBSVN_SUBR_CACHE_H
26
27 #include "private/svn_cache.h"
28
29 #ifdef __cplusplus
30 extern "C" {
31 #endif /* __cplusplus */
32
33 typedef struct svn_cache__vtable_t {
34   /* See svn_cache__get(). */
35   svn_error_t *(*get)(void **value,
36                       svn_boolean_t *found,
37                       void *cache_implementation,
38                       const void *key,
39                       apr_pool_t *result_pool);
40
41   /* See svn_cache__set(). */
42   svn_error_t *(*set)(void *cache_implementation,
43                       const void *key,
44                       void *value,
45                       apr_pool_t *scratch_pool);
46
47   /* See svn_cache__iter(). */
48   svn_error_t *(*iter)(svn_boolean_t *completed,
49                        void *cache_implementation,
50                        svn_iter_apr_hash_cb_t func,
51                        void *baton,
52                        apr_pool_t *scratch_pool);
53
54   /* See svn_cache__is_cachable(). */
55   svn_boolean_t (*is_cachable)(void *cache_implementation,
56                                apr_size_t size);
57
58   /* See svn_cache__get_partial(). */
59   svn_error_t *(*get_partial)(void **value,
60                               svn_boolean_t *found,
61                               void *cache_implementation,
62                               const void *key,
63                               svn_cache__partial_getter_func_t func,
64                               void *baton,
65                               apr_pool_t *result_pool);
66
67   /* See svn_cache__set_partial(). */
68   svn_error_t *(*set_partial)(void *cache_implementation,
69                               const void *key,
70                               svn_cache__partial_setter_func_t func,
71                               void *baton,
72                               apr_pool_t *scratch_pool);
73
74   /* See svn_cache__get_info(). */
75   svn_error_t *(*get_info)(void *cache_implementation,
76                            svn_cache__info_t *info,
77                            svn_boolean_t reset,
78                            apr_pool_t *result_pool);
79 } svn_cache__vtable_t;
80
81 struct svn_cache__t {
82   const svn_cache__vtable_t *vtable;
83
84   /* See svn_cache__set_error_handler(). */
85   svn_cache__error_handler_t error_handler;
86   void *error_baton;
87
88   /* Private data for the cache implementation. */
89   void *cache_internal;
90
91   /* Total number of calls to getters. */
92   apr_uint64_t reads;
93
94   /* Total number of calls to set(). */
95   apr_uint64_t writes;
96
97   /* Total number of getter calls that returned a cached item. */
98   apr_uint64_t hits;
99
100   /* Total number of function calls that returned an error. */
101   apr_uint64_t failures;
102 };
103
104
105 #ifdef __cplusplus
106 }
107 #endif /* __cplusplus */
108
109 #endif /* SVN_LIBSVN_SUBR_CACHE_H */