librelist archives

« back to archive

Main pluggable backends/storages for Photon

Main pluggable backends/storages for Photon

From:
Loic d'Anterroches
Date:
2011-03-24 @ 15:51
Hello,

now that the dust start to settle. Here is a proposal of the main
pluggable "backends" or "storages" for Photon. A storage is basically a
data store where a backend includes logic.

Backends: Auth, Acl/Permissions+Groups.
Storages: User, Session.

At the moment, you have the session storage and the authentication
backend. The user storage may be in fact a backend because it may
require some logic to get a list of users, get by attribute or so. For
the Acl, it is definitely a backend but I don't know yet about the
interface.

You can/will select the one you want directly in the configuration file.
It means that if you write an application for Photon, you need to accept
that these components can be changed as long as they provide the right
interface.

The goal in allowing you to swap these components as you wish, is
because one implementation cannot answer all the needs. Even if we have
one implementation for MongoDB, SQLite, your RDBMS etc. you may need
more than one implementation with a given storage.

For example, suppose you have an application with some access rights on
items. You can store the access rights with the user object, with the
item object or as an independent "table". Each of the storage format as
pros/contras and the selection of the right storage will dependent on
the way you access the data and the size of the data.

The out of the box configuration of Photon will of course include sane
"default" choices, but they will be "by design" limited (file based or
so) just to clearly state: you are the developer, if you go with MySQL,
pickup the right user storage to use your database because you are the
one in control. Put it will allow you to create a simple blog without
the need to have a database :)

I hope this explains a bit the concepts/ideas behind Photon.

loïc

--
Indefero - Project management and code hosting - http://www.indefero.net
Photon - High Performance PHP Framework - http://photon-project.com
Céondo Ltd - Web + Science = Fun - http://www.ceondo.com