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__set(). */
42 svn_error_t *(*set)(void *cache_implementation,
45 apr_pool_t *scratch_pool);
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,
52 apr_pool_t *scratch_pool);
54 /* See svn_cache__is_cachable(). */
55 svn_boolean_t (*is_cachable)(void *cache_implementation,
58 /* See svn_cache__get_partial(). */
59 svn_error_t *(*get_partial)(void **value,
61 void *cache_implementation,
63 svn_cache__partial_getter_func_t func,
65 apr_pool_t *result_pool);
67 /* See svn_cache__set_partial(). */
68 svn_error_t *(*set_partial)(void *cache_implementation,
70 svn_cache__partial_setter_func_t func,
72 apr_pool_t *scratch_pool);
74 /* See svn_cache__get_info(). */
75 svn_error_t *(*get_info)(void *cache_implementation,
76 svn_cache__info_t *info,
78 apr_pool_t *result_pool);
79 } svn_cache__vtable_t;
82 const svn_cache__vtable_t *vtable;
84 /* See svn_cache__set_error_handler(). */
85 svn_cache__error_handler_t error_handler;
88 /* Private data for the cache implementation. */
91 /* Total number of calls to getters. */
94 /* Total number of calls to set(). */
97 /* Total number of getter calls that returned a cached item. */
100 /* Total number of function calls that returned an error. */
101 apr_uint64_t failures;
107 #endif /* __cplusplus */
109 #endif /* SVN_LIBSVN_SUBR_CACHE_H */