Subdivide the assets table

User:lulurun

Main idea
My proposal is to subdivide asset table into 2 tables:
 * user_asset
 * used by UGAI servers
 * for user owned assets
 * objects in inventory
 * appearance
 * attachment, ...
 * region_asset
 * used by region servers
 * for region owned assets
 * background sounds
 * textures on prims
 * sun, moon, ...
 * terrain maptile

related to avatar portability



Advantages
Major points first.

1. increase the dispersity of asset data, clarify the responsibility of each server. This would cause some problems:
 * Currently, all of the asset data is stored in assets table, managed by assetserver.
 * assets table keeps growing in a fast pace.
 * hard to determine which asset is belongs to inactive regions (when you want to "clean" the assets table).
 * assetserver not only serves users' data but also regions' data, if something happened to assetserver both of avatar and prims will become gray.

such like:
 * To separate assets table can not only solve these problems, but also brings minor benefits
 * reduce the responsibility of assetserver
 * disperse the asset requests(especially for big grid service)
 * lower the risk of losing data, ...

2. for Data Portability in virtual world
 * For grid admin,
 * you can concentrate on managing only user(not region owner) relevant information like "users, avatarappearance, inventory"
 * it can reduce the vulnerability caused by foreign assets.
 * no complains about "no texture on prims" any more.
 * when a region leaves your grid, you don't have to worry about its assets becoming garbage.
 * on the other hand, this also good for region owners.
 * For when a user registers their region server with a grid,
 * When you want to switch your sim to a new grid, "prims, primshapes, terrain, region_asset" are always tied-up together. the only thing you need to do is to edit UGAI servers URI in your OpenSim.ini
 * For standalone-mode user - probably creators,
 * Avatars and buildings are saved separatly, export/import objects will become more simple. Or you can provide the DB file directly.

3. make grid-mode more flexible
 * Here are some pictures, they are showing some configuration patterns after the subdividing:

http://openugai.sourceforge.net/?page=assets_subdividing

4. reduce the possibility of assetid conflict by reducing the scope of assetid.

Disadvantages
I can hardly imagine the disadvantages so far except many changes are need to be done. anything you think maybe a disadvantage is very appreciated.

Implementation

 * Things need not to be changed:
 * The fields of "assets" table need not to be changed (at least for the subdividing).
 * Current implementation of AssetServer need not to be changed.


 * Things need to add:
 * Add new table "RegionAssets".
 * Add DB access support for the new table under OpenSim.Data.*
 * Add RegionAssetService
 * including a RegionAssetLoader which reads assets/AssetSet.xml stores asset data to RegionAsset table
 * LocalRegionAssetService (directly select from RegionAssets table)
 * This is the pattern 1 at http://openugai.sourceforge.net/?page=assets_subdividing
 * RemoteRegionAssetService
 * This is the pattern 2-4 at http://openugai.sourceforge.net/?page=assets_subdividing
 * Of course to use which kind of service should be able to config in "OpenSim.ini".


 * Things need to be changed
 * regionserver should not fetch assets from only one assetserver, So, One of the major changes we have to do is:

in "GridAssetCient.cs" L50: protected override AssetBase GetAsset(AssetRequest req) to protected override AssetBase GetAsset(AssetRequest req, string asset_url) L79: protected override AssetBase StoreAsset(AssetRequest req) to protected override AssetBase StoreAsset(AssetRequest req, string asset_url)

Migration From Existing System
Since this subdividing does not change the front services, there are not so many things to be done for the migration.


 * Grid admin
 * UGAI servers should work as it used to be. (nothing changes)
 * you can forbid foreign assets by assigning assetserver a private address(a lot of ways to do).
 * if you want cleanup unreferenced assets, ... try your best, this work won't be needed again.


 * Region owner
 * you can keep your contents completly in your local server from mow on.
 * if you want get back your assets that already been stored in other AssetServer, ... troublesome　but possible.


 * VW User
 * nothing changes.


 * Developer
 * you need to watch mantis frequently.

What do you think ?
please feel free to leave comments in this section :)