Exemplo n.º 1
0
GError *
meta1_backend_init(struct meta1_backend_s **out, const char *ns,
		struct sqlx_repository_s *repo, struct grid_lbpool_s *glp)
{
	EXTRA_ASSERT(out != NULL);
	EXTRA_ASSERT(repo != NULL);
	EXTRA_ASSERT(glp != NULL);

	if (!*ns || strlen(ns) >= LIMIT_LENGTH_NSNAME)
		return BADREQ("Invalid namespace name");

	struct meta1_backend_s *m1 = g_malloc0(sizeof(*m1));
	g_strlcpy (m1->ns_name, ns, sizeof(m1->ns_name));
	m1->type = NAME_SRVTYPE_META1;
	m1->lb = glp;
	m1->repo = repo;
	m1->prefixes = meta1_prefixes_init();
	m1->svcupdate = service_update_policies_create();
	*out = m1;
	return NULL;
}
Exemplo n.º 2
0
struct meta1_backend_s *
meta1_backend_init(const gchar *ns, struct sqlx_repository_s *repo,
		struct grid_lbpool_s *glp)
{
	struct meta1_backend_s *m1;

	EXTRA_ASSERT(ns != NULL);
	EXTRA_ASSERT(*ns != '\0');
	EXTRA_ASSERT(glp != NULL);
	EXTRA_ASSERT(repo != NULL);

	m1 = g_malloc0(sizeof(*m1));
	metautils_strlcpy_physical_ns(m1->backend.ns_name, ns,
			sizeof(m1->backend.ns_name));
	m1->backend.type = NAME_SRVTYPE_META1;
	m1->backend.lb = glp;
	m1->backend.repo = repo;
	m1->prefixes = meta1_prefixes_init();
	m1->svcupdate = service_update_policies_create();

	return m1;
}