• Welcome to SC4 Devotion Forum Archives.

CustomContent using CouchDB (an alternative)

Started by JoeST, September 29, 2009, 02:25:55 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

JoeST

so, instead of creating our own 'database' and everything, I decided to brainstorm a way of using CouchDB as its a distributive, document driven database system specifically designed to work both as a client side application database (like the back end of a browser for example) or a centralized db (the BBC use it for something big).  It is primarily written in Erlang (though there are probably ports to other languages) and the main querying language is Javascript. Each document (instead of tables there is just a series of JSON documents) has a unique ID and a unique revision ID (change tracking ;) ).

So, lets say Simtropolis has a CityMania package database that looks something like this (the whole database can be seen as a single JSON doc):


{
    _info
    {
        root_url: http://citymania.simtropolis.com/,
        mirror_list: [ _info_mirror1.ID, _info_SecondMirror.ID, etc... ],
        blurb: <[CDATA[this is simtropolis, blurbyblurbyblurby]]>,
        contact: dirktator@simtropolis.com,
        forum_url: http://simtropolis.com/forums/citimania/,
        etc...
    },
    _info_mirror1
    {
        root_url: http://mirror1.com/citymania/,
        blurb: This is a mirror supplied by whoever. it is used if simtropolis is unavaliable,
        contact: citymania-mirror@mirror1.com,
        etc...
    },
   
    aCreator
    {
        blurb: this user creates mainly skyrises etc...,
        contact: aCreator@example.org,
        plugins:
        [
            pluginA.ID,
            anotherPlugin.ID,
            etc...
        ],
        rating: 10,
        etc...
    },
    creatorNo2 { ... },
    pluginA
    {
        local_url: /aCreator/pluginA.zip,
        blurb: this plugin is a skyrise found in the middle of a rural village somewhere in the middle of nowhere,
        download-count: 200,
        dependencies [ plugin2.ID, fourthPlugin.ID, etc... ],
        etc...
    }
    plugin2 { ... },
}


This database is shared over all the mirrors, and then distributed to any client that wishes to download from Simtropolis. When you look something up it checks the local db. It also periodically checks the server for an updated database, and warns you if yours is out of date (the database updating is very simple, can be done via RSS/ATOM).

If you attempt to download a plugin, it first checks whether there is a response from simtropolis, and then (if ST is down) iterates through the mirror list looking for a server that is available. Once it finds an available server, it appends the plugins local_url to the servers root_url and downloads the file. If the plugin has dependencies it will prompt the user asking for permission to download them, and then precede through the list, getting them.

If the dependency is not hosted on this server, then a URI to the server it is hosted on is stuck in the $plugin.dependencies array, for example SC4D:plugin.ID or simpeg.com/citymania:plugin.ID and it either passes you to the respective db if you have it locally or if it is a one off, it just uses a server-side-script on the external db.

The creator can include licenses and EULA's to their work, that the users will be prompted to accept before the install takes place. These can each have their own Document in the database. An example being a creation team having a global page:

Code (a team license) Select

    teamA
    {
        blurb: we are Team A, specialist in awesome,
        license: accept or dont, that is the requirement.
    }


and the plugin property has a team property that holds teamA.id and includes teamA.license when attempting to install, the same can be done for a personal license using the plugin.author and author.license or just the plugin.license properties.

Just an idea.

Joe
Copperminds and Cuddleswarms

catty

Quote from: JoeST on September 29, 2009, 02:25:55 AM
... Just an idea.
Joe

On reading your post it sounds like it would work very much as the Synaptic Package Manager does in Linux and I've always found that to be great for downloading programs and their dependencies etc.

http://www.nongnu.org/synaptic/

It would certainly make it a lot easier to manage Custom Content

Great Idea  :thumbsup:


I meant," said Ipslore bitterly, "what is there in this world that truly makes living worthwhile?" DEATH thought about it. "CATS," he said eventually, "CATS ARE NICE.

croxis

Well, technically synaptic is just a gui front end for apt, which is a front end for dkpg.... ;)
I'm trying to find technical documentation on how apt works o try and explain it to these guys, as I think it is a perfect system for the kind of content being offered (version control, dependency management). Alas all I can find are man pages.

JoeST

so is mine not good enough?... :(

lol, well I cant wait ;)

Joe
Copperminds and Cuddleswarms

catty

I meant," said Ipslore bitterly, "what is there in this world that truly makes living worthwhile?" DEATH thought about it. "CATS," he said eventually, "CATS ARE NICE.

croxis

#5
This is how ubuntu/debian does their repository servers: http://www.debian.org/doc/manuals/repository-howto/repository-howto

It is essentially a simple web server with files in specific places.  I have a hunch that couchdb would really help us.  My hope is something so that things can be simple for a content creator to maintain their own site, or a massive site being able to manage thousands of items.

JoeST

well we dont have to do anything special regarding architectures, and dont have to supply source's and my idea can be extended easily to do these kinda things anyway :D
Copperminds and Cuddleswarms

croxis

You do know we are in the chatroom ;)  It's like SMSing the person in the same room as you!

JoeST

Copperminds and Cuddleswarms