1/* checksum-reps-table.h : internal interface to ops on `checksum-reps' table 2 * 3 * ==================================================================== 4 * Licensed to the Apache Software Foundation (ASF) under one 5 * or more contributor license agreements. See the NOTICE file 6 * distributed with this work for additional information 7 * regarding copyright ownership. The ASF licenses this file 8 * to you under the Apache License, Version 2.0 (the 9 * "License"); you may not use this file except in compliance 10 * with the License. You may obtain a copy of the License at 11 * 12 * http://www.apache.org/licenses/LICENSE-2.0 13 * 14 * Unless required by applicable law or agreed to in writing, 15 * software distributed under the License is distributed on an 16 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 * KIND, either express or implied. See the License for the 18 * specific language governing permissions and limitations 19 * under the License. 20 * ==================================================================== 21 */ 22 23#ifndef SVN_LIBSVN_FS_CHECKSUM_REPS_TABLE_H 24#define SVN_LIBSVN_FS_CHECKSUM_REPS_TABLE_H 25 26#include "svn_fs.h" 27#include "svn_error.h" 28#include "svn_checksum.h" 29#include "../trail.h" 30#include "../fs.h" 31 32#ifdef __cplusplus 33extern "C" { 34#endif /* __cplusplus */ 35 36 37/* Open a `checksum-reps' table in ENV. If CREATE is non-zero, create 38 one if it doesn't exist. Set *CHECKSUM_REPS_P to the new table. 39 Return a Berkeley DB error code. */ 40int svn_fs_bdb__open_checksum_reps_table(DB **checksum_reps_p, 41 DB_ENV *env, 42 svn_boolean_t create); 43 44/* Set *REP_KEY to the representation key stored as the value of key 45 CHECKSUM in the `checksum-reps' table. Do this as part of TRAIL. 46 Use POOL for allocations. 47 48 If no such node revision ID is stored for CHECKSUM, return 49 SVN_ERR_FS_NO_SUCH_CHECKSUM_REP. */ 50svn_error_t *svn_fs_bdb__get_checksum_rep(const char **rep_key, 51 svn_fs_t *fs, 52 svn_checksum_t *checksum, 53 trail_t *trail, 54 apr_pool_t *pool); 55 56/* Store in the `checksum-reps' table a mapping of CHECKSUM to 57 representation key REP_KEY in FS. Do this as part of TRAIL. Use 58 POOL for temporary allocations. 59 60 WARNING: NEVER store a record that maps a checksum to a mutable 61 representation. Ever. Under pain of dismemberment and death. */ 62svn_error_t *svn_fs_bdb__set_checksum_rep(svn_fs_t *fs, 63 svn_checksum_t *checksum, 64 const char *rep_key, 65 trail_t *trail, 66 apr_pool_t *pool); 67 68/* Delete from the `checksum-reps' table the mapping of CHECKSUM to a 69 representation key in FS. Do this as part of TRAIL. Use POOL for 70 temporary allocations. */ 71svn_error_t *svn_fs_bdb__delete_checksum_rep(svn_fs_t *fs, 72 svn_checksum_t *checksum, 73 trail_t *trail, 74 apr_pool_t *pool); 75 76/* Reserve a unique reuse ID in the `checksum-reps' table in FS for a 77 new instance of a re-used representation as part of TRAIL. Return 78 the slot's id in *REUSE_ID_P, allocated in POOL. */ 79svn_error_t *svn_fs_bdb__reserve_rep_reuse_id(const char **reuse_id_p, 80 svn_fs_t *fs, 81 trail_t *trail, 82 apr_pool_t *pool); 83 84 85#ifdef __cplusplus 86} 87#endif /* __cplusplus */ 88 89#endif /* SVN_LIBSVN_FS_CHECKSUM_REPS_TABLE_H */ 90