Major ass commit

Added new "Datastore" parameter to simconfig.xml which is passed to storage engines via a new Initialise() function.
0.1-prestable
Adam Frisby 2007-04-27 21:11:02 +00:00
parent feca5d22c6
commit 6ce5b6e439
6 changed files with 46 additions and 11 deletions

View File

@ -36,6 +36,7 @@ namespace OpenSim.Framework.Interfaces
/// </summary> /// </summary>
public interface ILocalStorage public interface ILocalStorage
{ {
void Initialise(string datastore);
void StorePrim(PrimData prim); void StorePrim(PrimData prim);
void RemovePrim(LLUUID primID); void RemovePrim(LLUUID primID);
void LoadPrimitives(ILocalStorageReceiver receiver); void LoadPrimitives(ILocalStorageReceiver receiver);

View File

@ -36,6 +36,8 @@ namespace OpenSim
public string UserRecvKey = ""; public string UserRecvKey = "";
private bool isSandbox; private bool isSandbox;
public string DataStore;
public RegionInfo() public RegionInfo()
{ {
@ -144,6 +146,17 @@ namespace OpenSim
{ {
this.RegionLocY = (uint)Convert.ToUInt32(attri); this.RegionLocY = (uint)Convert.ToUInt32(attri);
} }
// Local storage datastore
attri = "";
attri = configData.GetAttribute("Datastore");
if (attri == "")
{
string datastore = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Filename for local storage", "localworld.yap");
configData.SetAttribute("Datastore", datastore);
this.DataStore = datastore;
}
//Sim Listen Port //Sim Listen Port
attri = ""; attri = "";
attri = configData.GetAttribute("SimListenPort"); attri = configData.GetAttribute("SimListenPort");

View File

@ -44,6 +44,8 @@ namespace OpenSim.world
private AssetCache _assetCache; private AssetCache _assetCache;
private Mutex updateLock; private Mutex updateLock;
public string m_datastore;
/// <summary> /// <summary>
/// Creates a new World class, and a region to go with it. /// Creates a new World class, and a region to go with it.
/// </summary> /// </summary>
@ -257,6 +259,8 @@ namespace OpenSim.world
{ {
ILocalStorage plug = (ILocalStorage)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); ILocalStorage plug = (ILocalStorage)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
store = plug; store = plug;
store.Initialise(this.m_datastore);
break; break;
} }

View File

@ -56,6 +56,11 @@ namespace OpenSim.Storage.LocalStorageBDB
//vendorDb = (DbBTree)db.Open(null, VendorDbName, null, DbType.BTree, Db.OpenFlags.Create, 0); //vendorDb = (DbBTree)db.Open(null, VendorDbName, null, DbType.BTree, Db.OpenFlags.Create, 0);
} }
public void Initialise(string file)
{
// Blank
}
public void StorePrim(PrimData prim) public void StorePrim(PrimData prim)
{ {
DbEntry key = new DbEntry(); DbEntry key = new DbEntry();

View File

@ -41,21 +41,28 @@ namespace OpenSim.Storage.LocalStorageDb4o
public class Db4LocalStorage : ILocalStorage public class Db4LocalStorage : ILocalStorage
{ {
private IObjectContainer db; private IObjectContainer db;
private string datastore;
public Db4LocalStorage() public Db4LocalStorage()
{ {
try
{
db = Db4oFactory.OpenFile("localworld.yap");
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Db4LocalStorage creation");
}
catch(Exception e)
{
db.Close();
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Db4LocalStorage :Constructor - Exception occured");
OpenSim.Framework.Console.MainConsole.Instance.WriteLine(e.ToString());
}
} }
public void Initialise(string dfile)
{
datastore = dfile;
try
{
db = Db4oFactory.OpenFile(datastore);
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Db4LocalStorage creation");
}
catch (Exception e)
{
db.Close();
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Db4LocalStorage :Constructor - Exception occured");
OpenSim.Framework.Console.MainConsole.Instance.WriteLine(e.ToString());
}
}
public void StorePrim(PrimData prim) public void StorePrim(PrimData prim)
{ {

View File

@ -59,6 +59,11 @@ namespace OpenSim.Storage.LocalStorageSQLite
} }
} }
public void Initialise(string file)
{
// Blank
}
public void StorePrim(PrimData prim) public void StorePrim(PrimData prim)
{ {
IDbCommand cmd = db.CreateCommand(); IDbCommand cmd = db.CreateCommand();