aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/OpenSim.Storage/LocalStorageDb4o
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/OpenSim.Storage/LocalStorageDb4o')
-rw-r--r--OpenSim/OpenSim.Storage/LocalStorageDb4o/Db4LocalStorage.cs43
1 files changed, 42 insertions, 1 deletions
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;
28using System.Collections.Generic; 28using System.Collections.Generic;
29using Db4objects.Db4o; 29using Db4objects.Db4o;
30using Db4objects.Db4o.Query; 30using Db4objects.Db4o.Query;
31
31using libsecondlife; 32using libsecondlife;
32using OpenSim.Framework.Interfaces; 33using OpenSim.Framework.Interfaces;
33using OpenSim.Framework.Types; 34using OpenSim.Framework.Types;
34using OpenSim.Framework.Terrain; 35using OpenSim.Framework.Terrain;
35 36
37
36namespace OpenSim.Storage.LocalStorageDb4o 38namespace OpenSim.Storage.LocalStorageDb4o
37{ 39{
38 /// <summary> 40 /// <summary>
@@ -173,10 +175,49 @@ namespace OpenSim.Storage.LocalStorageDb4o
173 db.Commit(); 175 db.Commit();
174 } 176 }
175 177
178 public void SaveParcels(ParcelData[] parcel_data)
179 {
180 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Parcel Backup: Saving Parcels...");
181 IObjectSet result = db.Get(typeof(ParcelData));
182 foreach (ParcelData parcel in result)
183 {
184 db.Delete(parcel);
185 }
186 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Parcel Backup: Removing old entries complete. Adding new entries.");
187 int i;
188 for (i = 0; i < parcel_data.GetLength(0); i++)
189 {
190 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Adding : " + i);
191 db.Set(parcel_data[i]);
192
193 }
194 db.Commit();
195 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Parcel Backup: Parcel Save Complete");
196 }
197
198 public void LoadParcels(ILocalStorageParcelReceiver recv)
199 {
200 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Parcel Backup: Loading Parcels...");
201 IObjectSet result = db.Get(typeof(ParcelData));
202 if (result.Count > 0)
203 {
204 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Parcel Backup: Parcels exist in database.");
205 foreach (ParcelData parcelData in result)
206 {
207 recv.ParcelFromStorage(parcelData);
208 }
209 }
210 else
211 {
212 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Parcel Backup: No parcels exist. Creating basic parcel.");
213 recv.NoParcelDataFromStorage();
214 }
215 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Parcel Backup: Parcels Restored");
216 }
176 public void ShutDown() 217 public void ShutDown()
177 { 218 {
178 db.Commit(); 219 db.Commit();
179 db.Close(); 220 db.Close();
180 } 221 }
181 } 222 }
182} 223} \ No newline at end of file