Happy !

Debris / DebrisDB

Project infos

License MIT
Tags glorp, debris, fuel, db, sixx
Creation date 2015-01-20
Website

Monticello registration

About DebrisDB

This toolkit allows programmers to use the Glorp interface without a Glorp-system definition, and without needing any SQL servers up an running. If you use it right, you can back your application by Fuel files, SIXX files, any serializer, Gemstone, or Glorp/SQL, without modifying your application code. Therefore, it is perfect for prototyping concepts very quickly. It also fits the Gemstone model perfectly.

This code is being shared here with hopes to encourage the use of the Glorp-interface for data access. This code allows newcomers to be up and running with data storage through a Glorp-interface using Pharo backed by Fuel files within minutes. Debris' Quuve product has used this framework -- with more extensive user credentialing and datasource-specifications -- to run on Pharo backed by Fuel files as well as SQL, and on Gemstone backed by stones.

Because the non-SQL FaDataStores are held in memory, there are certain considerations regarding object-references and memory usage. See the Fuel used class-side method #fuelIgnoredInstanceVariableNames. Also, draw clean lines across DB's, and make certain you write your code to perform the appropriate lookups when crossing those lines, and one can use a mix of SQL and non-SQL persistence of data. One downside is that the entire model is held in memory using the default examples here, which is not a problem in Gemstone.

[!some features temporarily broken due to time constraints in separating these classes from the main Debris' code base, and both SIXX support and Gemstone compatibility are currently broken. We will be adding these capabilities back in during the following months, or possibly sooner. Please inquire if you need Gemstone support right away. ]

See FaDemoExamplesTestCase to get started.

- Use is simple to get up and running.

  1. Subclass from FaClassNamedDB to say MyApplicationDB.

  2. Then copy and modify FaDemoApplicationDataHub to define your repositories and control their locations. One can have as many repos as they need and in different or similar formats: Fuel, SIXX, etc.). These Repos can be co-mingled with SQL. The magic is in defining your (db)sessionMap(s) which use blocks to convert from a symbol to a DB-connection. You might find it most sensible to use a replacement for FaBasicUserDataHub, and then define explicitly define your repos, and permissions-configurations for the various classes of users of your data-stores.

  3. Then simply use the Glorp interface:

    FaDemoApplicationDataHub login: MyUserObject. "arg is ignored in this trivial example -- this would be done once for a process"

    MyApplicationDB session inUnitOfWorkDo: [:session | session deleteAll: (session readManyOf: MyClass where: [:each | each someAspect = blahBlah ] ) ].

Good luck from the Debris Team!