ctdb->max_lacount = count;
}
+/*
+ set the directory for the local databases
+*/
+void ctdb_set_tdb_dir(struct ctdb_context *ctdb, const char *dir)
+{
+ ctdb->db_directory = talloc_strdup(ctdb, dir);
+}
+
/*
add a node to the list of active nodes
*/
/* add the node id to the database name, so when we run on loopback
we don't conflict in the local filesystem */
- name = talloc_asprintf(ctdb_db, "%s.%u", name, ctdb_get_vnn(ctdb));
+ name = talloc_asprintf(ctdb_db, "%s/%s", ctdb->db_directory, name);
/* when we have a separate daemon this will need to be a real
file, not a TDB_INTERNAL, so the parent can access it to
{
struct ctdb_context *ctdb;
const char *db_list = "test.tdb";
+ const char *db_dir = ".";
char *s, *tok;
struct poptOption popt_options[] = {
POPT_AUTOHELP
POPT_CTDB_CMDLINE
{ "dblist", 0, POPT_ARG_STRING, &db_list, 0, "list of databases", NULL },
+ { "dbdir", 0, POPT_ARG_STRING, &db_dir, 0, "directory for the tdb files", NULL },
POPT_TABLEEND
};
int opt;
ctdb = ctdb_cmdline_init(ev);
+ ctdb_set_tdb_dir(ctdb, db_dir);
+
/* attach to the list of databases */
s = talloc_strdup(ctdb, db_list);
for (tok=strtok(s, ", "); tok; tok=strtok(NULL, ", ")) {
*/
int ctdb_set_transport(struct ctdb_context *ctdb, const char *transport);
+/*
+ set the directory for the local databases
+*/
+void ctdb_set_tdb_dir(struct ctdb_context *ctdb, const char *dir);
+
/*
set some flags
*/
struct event_context *ev;
struct ctdb_address address;
const char *name;
+ const char *db_directory;
uint32_t vnn; /* our own vnn */
uint32_t num_nodes;
uint32_t num_connected;