Changes

Jump to: navigation, search

GEPS 032: Database Backend API

1,875 bytes added, 11:23, 12 May 2015
no edit summary
This is an idea refined from [[GEPS 010: Relational Backend]]. However, without the relational components.
 
==Plan==
 
Exactly what is required for a class to implement a fully functional database for Gramps is only determined by examination of the existing BSDDB class. This involves the following components:
 
1. data and metadata update, add, and delete
2. transactions for batch or atomic changes
3. signal handling
 
Once a full Gramps Database class is created, there needs to be a way of:
 
1. selecting which backend to use for new databases
2. selecting the database to load (Family Tree Manager)
 
We will use the directory structure, as we do now. In each directory, the type of database needs to be identified. This could be done in two ways:
 
1. well-defined database backend types. These could be registered, like any plugin/addon.
2. is there really any reason for Gramps to have to have the code for the db backend? All that is necessary is for the backend to create the Database instance.
 
It makes sense that we will reuse and share the backends, so we should use option 1, and develop a database backend plugin type.
 
Because there are so many functions for the database layer, extensive testing should be created to test all functions to ensure that a backend works correctly.
 
We should factor-out all BSDDB dependencies, and make BSDDB the first database backend plugin. The plugin API should include functions for:
 
* making a new database, given a directory
* loading the database, given the directory
 
Other things that might need to be changed:
 
Listing the databases (-l and -L). That might include changing the current listing:
 
<pre>
Family Tree "test_family, gramps40":
Bsddb version: (5, 1, 29)
Last accessed: 11/17/2013 08:47:12 AM
Locked?: no
Number of people: Unknown
Path: /home/dblank/.gramps/grampsdb/528787d0
Schema version: Unknown
</pre>
==Progress==
The first step is to separate all of the gramps.gen.db code into reusable and extendable components.  This has begun with the [http://sourceforge.net/p/gramps/source/ci/master/tree/gramps/gen/db/dictionary.py DictionaryDB] {{bug|4972}}, which is a in-memory replacement for the BSDDB. Still needs the indexes, and metadata support (gender names, bookmarks, etc). Also, the Dictionary transaction is non-existent. Currently, the best working replacement backend is gramps.webapp.dbdjango.
==Backends==
Backends to considerdeveloping:
* MongoDB

Navigation menu