1 /* uuid.c : operations on repository uuids
3 * ====================================================================
4 * Copyright (c) 2000-2004 CollabNet. All rights reserved.
6 * This software is licensed as described in the file COPYING, which
7 * you should have received as part of this distribution. The terms
8 * are also available at http://subversion.tigris.org/license-1.html.
9 * If newer versions of this license are posted there, you may use a
10 * newer version instead, at your option.
12 * This software consists of voluntary contributions made by many
13 * individuals. For exact contribution history, see the revision
14 * history and logs, available at http://subversion.tigris.org/.
15 * ====================================================================
24 #include "bdb/uuids-table.h"
25 #include "../libsvn_fs/fs-loader.h"
27 #include "private/svn_fs_util.h"
38 txn_body_get_uuid(void *baton
, trail_t
*trail
)
40 struct get_uuid_args
*args
= baton
;
41 return svn_fs_bdb__get_uuid(trail
->fs
, args
->idx
, args
->uuid
,
47 svn_fs_base__get_uuid(svn_fs_t
*fs
,
51 base_fs_data_t
*bfd
= fs
->fsap_data
;
53 SVN_ERR(svn_fs__check_fs(fs
, TRUE
));
55 /* Check for a cached UUID first. Failing that, we hit the
59 *uuid
= apr_pstrdup(pool
, bfd
->uuid
);
63 struct get_uuid_args args
;
66 SVN_ERR(svn_fs_base__retry_txn(fs
, txn_body_get_uuid
, &args
, pool
));
68 /* Toss what we find into the cache. */
70 bfd
->uuid
= apr_pstrdup(fs
->pool
, *uuid
);
85 txn_body_set_uuid(void *baton
, trail_t
*trail
)
87 struct set_uuid_args
*args
= baton
;
88 return svn_fs_bdb__set_uuid(trail
->fs
, args
->idx
, args
->uuid
,
94 svn_fs_base__set_uuid(svn_fs_t
*fs
,
98 struct set_uuid_args args
;
99 base_fs_data_t
*bfd
= fs
->fsap_data
;
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
, pool
));
110 /* Toss our value into the cache. */
112 bfd
->uuid
= apr_pstrdup(fs
->pool
, uuid
);