summaryrefslogtreecommitdiff
path: root/src/meta/meta_ext.c
blob: 423b7d2e76bbd780a5c1ddd2506a5284eeb04bd4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
/*-
 * Copyright (c) 2014-2015 MongoDB, Inc.
 * Copyright (c) 2008-2014 WiredTiger, Inc.
 *	All rights reserved.
 *
 * See the file LICENSE for redistribution information.
 */

#include "wt_internal.h"

/*
 * __wt_ext_metadata_insert --
 *	Insert a row into the metadata (external API version).
 */
int
__wt_ext_metadata_insert(WT_EXTENSION_API *wt_api,
    WT_SESSION *wt_session, const char *key, const char *value)
{
	WT_CONNECTION_IMPL *conn;
	WT_SESSION_IMPL *session;

	conn = (WT_CONNECTION_IMPL *)wt_api->conn;
	if ((session = (WT_SESSION_IMPL *)wt_session) == NULL)
		session = conn->default_session;

	return (__wt_metadata_insert(session, key, value));
}

/*
 * __wt_ext_metadata_remove --
 *	Remove a row from the metadata (external API version).
 */
int
__wt_ext_metadata_remove(
    WT_EXTENSION_API *wt_api, WT_SESSION *wt_session, const char *key)
{
	WT_CONNECTION_IMPL *conn;
	WT_SESSION_IMPL *session;

	conn = (WT_CONNECTION_IMPL *)wt_api->conn;
	if ((session = (WT_SESSION_IMPL *)wt_session) == NULL)
		session = conn->default_session;

	return (__wt_metadata_remove(session, key));
}

/*
 * __wt_ext_metadata_search --
 *	Return a copied row from the metadata (external API version).
 *	The caller is responsible for freeing the allocated memory.
 */
int
__wt_ext_metadata_search(WT_EXTENSION_API *wt_api,
    WT_SESSION *wt_session, const char *key, char **valuep)
{
	WT_CONNECTION_IMPL *conn;
	WT_SESSION_IMPL *session;

	conn = (WT_CONNECTION_IMPL *)wt_api->conn;
	if ((session = (WT_SESSION_IMPL *)wt_session) == NULL)
		session = conn->default_session;

	return (__wt_metadata_search(session, key, valuep));
}

/*
 * __wt_ext_metadata_update --
 *	Update a row in the metadata (external API version).
 */
int
__wt_ext_metadata_update(WT_EXTENSION_API *wt_api,
    WT_SESSION *wt_session, const char *key, const char *value)
{
	WT_CONNECTION_IMPL *conn;
	WT_SESSION_IMPL *session;

	conn = (WT_CONNECTION_IMPL *)wt_api->conn;
	if ((session = (WT_SESSION_IMPL *)wt_session) == NULL)
		session = conn->default_session;

	return (__wt_metadata_update(session, key, value));
}

/*
 * __wt_metadata_get_ckptlist --
 *	Public entry point to __wt_meta_ckptlist_get (for wt list).
 */
int
__wt_metadata_get_ckptlist(
    WT_SESSION *session, const char *name, WT_CKPT **ckptbasep)
{
	return (__wt_meta_ckptlist_get(
	    (WT_SESSION_IMPL *)session, name, ckptbasep));
}

/*
 * __wt_metadata_free_ckptlist --
 *	Public entry point to __wt_meta_ckptlist_free (for wt list).
 */
void
__wt_metadata_free_ckptlist(WT_SESSION *session, WT_CKPT *ckptbase)
{
	__wt_meta_ckptlist_free((WT_SESSION_IMPL *)session, ckptbase);
}