mirror of
https://github.com/opensim/opensim.git
synced 2026-08-07 09:45:47 +08:00
Major ass commit
Added new "Datastore" parameter to simconfig.xml which is passed to storage engines via a new Initialise() function.
This commit is contained in:
@@ -36,6 +36,7 @@ namespace OpenSim.Framework.Interfaces
|
||||
/// </summary>
|
||||
public interface ILocalStorage
|
||||
{
|
||||
void Initialise(string datastore);
|
||||
void StorePrim(PrimData prim);
|
||||
void RemovePrim(LLUUID primID);
|
||||
void LoadPrimitives(ILocalStorageReceiver receiver);
|
||||
|
||||
@@ -36,6 +36,8 @@ namespace OpenSim
|
||||
public string UserRecvKey = "";
|
||||
private bool isSandbox;
|
||||
|
||||
public string DataStore;
|
||||
|
||||
public RegionInfo()
|
||||
{
|
||||
|
||||
@@ -144,6 +146,17 @@ namespace OpenSim
|
||||
{
|
||||
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
|
||||
attri = "";
|
||||
attri = configData.GetAttribute("SimListenPort");
|
||||
|
||||
@@ -44,6 +44,8 @@ namespace OpenSim.world
|
||||
private AssetCache _assetCache;
|
||||
private Mutex updateLock;
|
||||
|
||||
public string m_datastore;
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new World class, and a region to go with it.
|
||||
/// </summary>
|
||||
@@ -257,6 +259,8 @@ namespace OpenSim.world
|
||||
{
|
||||
ILocalStorage plug = (ILocalStorage)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
|
||||
store = plug;
|
||||
|
||||
store.Initialise(this.m_datastore);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -56,6 +56,11 @@ namespace OpenSim.Storage.LocalStorageBDB
|
||||
//vendorDb = (DbBTree)db.Open(null, VendorDbName, null, DbType.BTree, Db.OpenFlags.Create, 0);
|
||||
}
|
||||
|
||||
public void Initialise(string file)
|
||||
{
|
||||
// Blank
|
||||
}
|
||||
|
||||
public void StorePrim(PrimData prim)
|
||||
{
|
||||
DbEntry key = new DbEntry();
|
||||
|
||||
@@ -41,21 +41,28 @@ namespace OpenSim.Storage.LocalStorageDb4o
|
||||
public class Db4LocalStorage : ILocalStorage
|
||||
{
|
||||
private IObjectContainer db;
|
||||
private string datastore;
|
||||
|
||||
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)
|
||||
{
|
||||
|
||||
@@ -59,6 +59,11 @@ namespace OpenSim.Storage.LocalStorageSQLite
|
||||
}
|
||||
}
|
||||
|
||||
public void Initialise(string file)
|
||||
{
|
||||
// Blank
|
||||
}
|
||||
|
||||
public void StorePrim(PrimData prim)
|
||||
{
|
||||
IDbCommand cmd = db.CreateCommand();
|
||||
|
||||
Reference in New Issue
Block a user