[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
modular database backends
From: |
Peter Novodvorsky |
Subject: |
modular database backends |
Date: |
27 May 2001 22:21:17 +0400 |
User-agent: |
Gnus/5.090004 (Oort Gnus v0.04) Emacs/21.0.103 |
Hello!
I always thought about BTS as database and tools to work with
it. And these things are different. In gnats I see opposite thing: database,
tools and servers share one source and tools sometimes do too much.
So I've began work on making database backends to gnats modular.
Just now, gnats has two "backends", network (gnatsd) and filsystem. If
we make system of backends modular we could have SQL backend, etc., etc.
Second thing I don't like in GNATS, it doesn't has ACLs. This
modular framework should support them. Here is the header file that
will briefly describe what I mean:
struct _gnats_database {
URI *U;
FILE *serv_read;
FILE *serv_write;
void *module_handle;
int (* init) (ErrorDesc *err, gnats_database);
int (* add_pr) (ErrorDesc *err, gnats_database, PR);
int (* update_pr) (ErrorDesc *err, gnats_database, PR);
int (* query_pr) (ErrorDesc *err, gnats_database, QueryExpr);
int (* disconnect) (ErrorDesc *err, gnats_database);
};
typedef struct _gnats_database *gnats_database;
gnats_database gnats_new_database (ErrorDesc *err, URI *U);
int gnats_destroy_database (gnats_database db);
module_handle is object handle that is returned by dlopen.
URI is:
struct _URI
{
char *scheme;
char *host;
char *user;
char *pwd;
char *path;
unsigned int port;
};
typedef struct _URI URI;
And there is a function
URI *gnats_parse_uri (const char *gnats_uri, int length);
that takes URI (for example
gnatsd4x://nidd:address@hidden:1529/database_name) and converts
it in such structure (gnatsd4x is 4.0 gnatsd protocol).
I'm currently implementing gnatsd4x backend. After this I'll
make query-pr, pr-edit, gnatsd and other tools to work with this model.
And then I'll begin to make SQL backend.
If everything will be OK in the end following will be possible:
user -> client -> gnatsd -> SQL server (MySQL, Postgres)
What do you think of this crazy idea?
Thanks,
--
Peter Novodvorsky http://www.altlinux.ru/ AltLinux Team, Russia
Debian.Org http://debian.org/~nidd
Debian --- no need to wait for tomorrow.