2 * cache.h: cache vtable interface
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
13 * http://www.apache.org/licenses/LICENSE-2.0
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
21 * ====================================================================
24 #ifndef SVN_LIBSVN_SUBR_CACHE_H
25 #define SVN_LIBSVN_SUBR_CACHE_H
27 #include "private/svn_cache.h"
31 #endif /* __cplusplus */
33 typedef struct svn_cache__vtable_t {
34 /* See svn_cache__get(). */
35 svn_error_t *(*get)(void **value,
37 void *cache_implementation,
39 apr_pool_t *result_pool);
41 /* See svn_cache__has_key(). */
42 svn_error_t *(*has_key)(svn_boolean_t *found,
43 void *cache_implementation,
45 apr_pool_t *scratch_pool);
47 /* See svn_cache__set(). */
48 svn_error_t *(*set)(void *cache_implementation,
51 apr_pool_t *scratch_pool);
53 /* See svn_cache__iter(). */
54 svn_error_t *(*iter)(svn_boolean_t *completed,
55 void *cache_implementation,
56 svn_iter_apr_hash_cb_t func,
58 apr_pool_t *scratch_pool);
60 /* See svn_cache__is_cachable(). */
61 svn_boolean_t (*is_cachable)(void *cache_implementation,
64 /* See svn_cache__get_partial(). */
65 svn_error_t *(*get_partial)(void **value,
67 void *cache_implementation,
69 svn_cache__partial_getter_func_t func,
71 apr_pool_t *result_pool);
73 /* See svn_cache__set_partial(). */
74 svn_error_t *(*set_partial)(void *cache_implementation,
76 svn_cache__partial_setter_func_t func,
78 apr_pool_t *scratch_pool);
80 /* See svn_cache__get_info(). */
81 svn_error_t *(*get_info)(void *cache_implementation,
82 svn_cache__info_t *info,
84 apr_pool_t *result_pool);
85 } svn_cache__vtable_t;
88 const svn_cache__vtable_t *vtable;
90 /* See svn_cache__set_error_handler(). */
91 svn_cache__error_handler_t error_handler;
94 /* Private data for the cache implementation. */
97 /* Total number of calls to getters. */
100 /* Total number of calls to set(). */
103 /* Total number of getter calls that returned a cached item. */
106 /* Total number of function calls that returned an error. */
107 apr_uint64_t failures;
109 /* Cause all getters to act as though the cache contains no data.
110 (Currently this never becomes set except in maintainer builds.) */
111 svn_boolean_t pretend_empty;
117 #endif /* __cplusplus */
119 #endif /* SVN_LIBSVN_SUBR_CACHE_H */