1 /* uuid.c : operations on repository uuids
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
12 * http://www.apache.org/licenses/LICENSE-2.0
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
20 * ====================================================================
23 #include "svn_pools.h"
28 #include "bdb/uuids-table.h"
29 #include "../libsvn_fs/fs-loader.h"
31 #include "private/svn_fs_util.h"
42 txn_body_get_uuid(void *baton, trail_t *trail)
44 struct get_uuid_args *args = baton;
45 return svn_fs_bdb__get_uuid(trail->fs, args->idx, args->uuid,
51 svn_fs_base__populate_uuid(svn_fs_t *fs,
52 apr_pool_t *scratch_pool)
55 SVN_ERR(svn_fs__check_fs(fs, TRUE));
57 /* We hit the database. */
60 struct get_uuid_args args;
64 SVN_ERR(svn_fs_base__retry_txn(fs, txn_body_get_uuid, &args,
65 FALSE, scratch_pool));
69 /* Toss what we find into the cache. */
70 fs->uuid = apr_pstrdup(fs->pool, uuid);
86 txn_body_set_uuid(void *baton, trail_t *trail)
88 struct set_uuid_args *args = baton;
89 return svn_fs_bdb__set_uuid(trail->fs, args->idx, args->uuid,
95 svn_fs_base__set_uuid(svn_fs_t *fs,
99 struct set_uuid_args args;
101 SVN_ERR(svn_fs__check_fs(fs, TRUE));
104 uuid = svn_uuid_generate(pool);
108 SVN_ERR(svn_fs_base__retry_txn(fs, txn_body_set_uuid, &args, TRUE, pool));
110 /* Toss our value into the cache. */
112 fs->uuid = apr_pstrdup(fs->pool, uuid);