From 17421593528f4126256dea6d0c844da9c218fdb7 Mon Sep 17 00:00:00 2001 From: mingchen Date: Mon, 4 Jun 2007 14:09:19 +0000 Subject: Parcel Manager Changes: *Added Parcel Backup Support for DB4. Other storages currently do not save *Added parcelIDList in ParcelManager to speed up parcel fetching at position *Added ParcelData.cs and ParcelData class for better storage support *Documentation for parcel added *2 Parcel Related bug fixes --- .../LocalStorageBerkeleyDB/BDBLocalStorage.cs | 11 ++++++ .../LocalStorageDb4o/Db4LocalStorage.cs | 43 +++++++++++++++++++++- .../LocalStorageSQLite/SQLiteLocalStorage.cs | 10 +++++ 3 files changed, 63 insertions(+), 1 deletion(-) (limited to 'OpenSim/OpenSim.Storage') diff --git a/OpenSim/OpenSim.Storage/LocalStorageBerkeleyDB/BDBLocalStorage.cs b/OpenSim/OpenSim.Storage/LocalStorageBerkeleyDB/BDBLocalStorage.cs index d4db8c0..7c8ee88 100644 --- a/OpenSim/OpenSim.Storage/LocalStorageBerkeleyDB/BDBLocalStorage.cs +++ b/OpenSim/OpenSim.Storage/LocalStorageBerkeleyDB/BDBLocalStorage.cs @@ -86,6 +86,17 @@ namespace OpenSim.Storage.LocalStorageBDB { } + + public void SaveParcels(ParcelData[] parcel_data) + { + } + + + public void LoadParcels(ILocalStorageParcelReceiver recv) + { + recv.NoParcelDataFromStorage(); + } + public void ShutDown() { sim.GetDb().Close(); diff --git a/OpenSim/OpenSim.Storage/LocalStorageDb4o/Db4LocalStorage.cs b/OpenSim/OpenSim.Storage/LocalStorageDb4o/Db4LocalStorage.cs index 5dceb7f..087db96 100644 --- a/OpenSim/OpenSim.Storage/LocalStorageDb4o/Db4LocalStorage.cs +++ b/OpenSim/OpenSim.Storage/LocalStorageDb4o/Db4LocalStorage.cs @@ -28,11 +28,13 @@ using System; using System.Collections.Generic; using Db4objects.Db4o; using Db4objects.Db4o.Query; + using libsecondlife; using OpenSim.Framework.Interfaces; using OpenSim.Framework.Types; using OpenSim.Framework.Terrain; + namespace OpenSim.Storage.LocalStorageDb4o { /// @@ -173,10 +175,49 @@ namespace OpenSim.Storage.LocalStorageDb4o db.Commit(); } + public void SaveParcels(ParcelData[] parcel_data) + { + OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Parcel Backup: Saving Parcels..."); + IObjectSet result = db.Get(typeof(ParcelData)); + foreach (ParcelData parcel in result) + { + db.Delete(parcel); + } + OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Parcel Backup: Removing old entries complete. Adding new entries."); + int i; + for (i = 0; i < parcel_data.GetLength(0); i++) + { + OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Adding : " + i); + db.Set(parcel_data[i]); + + } + db.Commit(); + OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Parcel Backup: Parcel Save Complete"); + } + + public void LoadParcels(ILocalStorageParcelReceiver recv) + { + OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Parcel Backup: Loading Parcels..."); + IObjectSet result = db.Get(typeof(ParcelData)); + if (result.Count > 0) + { + OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Parcel Backup: Parcels exist in database."); + foreach (ParcelData parcelData in result) + { + recv.ParcelFromStorage(parcelData); + } + } + else + { + OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Parcel Backup: No parcels exist. Creating basic parcel."); + recv.NoParcelDataFromStorage(); + } + OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Parcel Backup: Parcels Restored"); + } public void ShutDown() { db.Commit(); db.Close(); } } -} +} \ No newline at end of file diff --git a/OpenSim/OpenSim.Storage/LocalStorageSQLite/SQLiteLocalStorage.cs b/OpenSim/OpenSim.Storage/LocalStorageSQLite/SQLiteLocalStorage.cs index 368405b..1f4c6be 100644 --- a/OpenSim/OpenSim.Storage/LocalStorageSQLite/SQLiteLocalStorage.cs +++ b/OpenSim/OpenSim.Storage/LocalStorageSQLite/SQLiteLocalStorage.cs @@ -167,6 +167,16 @@ namespace OpenSim.Storage.LocalStorageSQLite } + public void SaveParcels(ParcelData[] parcel_manager) + { + + } + + public void LoadParcels(ILocalStorageParcelReceiver recv) + { + recv.NoParcelDataFromStorage(); + } + public void ShutDown() { db.Close(); -- cgit v1.1