aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/OpenSim.Storage
diff options
context:
space:
mode:
authormingchen2007-06-06 18:15:12 +0000
committermingchen2007-06-06 18:15:12 +0000
commit73a36680bd5dacd4f2630c50115ef4c1f10dc387 (patch)
treea628ee922e8cac2e4836b025d986cb5806dd820d /OpenSim/OpenSim.Storage
parentChanges: (diff)
downloadopensim-SC_OLD-73a36680bd5dacd4f2630c50115ef4c1f10dc387.zip
opensim-SC_OLD-73a36680bd5dacd4f2630c50115ef4c1f10dc387.tar.gz
opensim-SC_OLD-73a36680bd5dacd4f2630c50115ef4c1f10dc387.tar.bz2
opensim-SC_OLD-73a36680bd5dacd4f2630c50115ef4c1f10dc387.tar.xz
*Added new commands ('backup','show parcels','reset parcels')
*Added parcel join support *Made parcel saving and loading much more efficient *Fixed bug that would not allow joining of parcel locally in the viewer (gives an error before sending to server) *Known Issue: Restoring parcels from storage is not working correctly. For now, do a 'reset parcels' to regenerate a standard parcel
Diffstat (limited to 'OpenSim/OpenSim.Storage')
-rw-r--r--OpenSim/OpenSim.Storage/LocalStorageBerkeleyDB/BDBLocalStorage.cs11
-rw-r--r--OpenSim/OpenSim.Storage/LocalStorageDb4o/Db4LocalStorage.cs88
-rw-r--r--OpenSim/OpenSim.Storage/LocalStorageDb4o/OpenSim.Storage.LocalStorageDb4o.csproj42
-rw-r--r--OpenSim/OpenSim.Storage/LocalStorageDb4o/UUIDPrimQuery.cs (renamed from OpenSim/OpenSim.Storage/LocalStorageDb4o/UUIDQuery.cs)4
-rw-r--r--OpenSim/OpenSim.Storage/LocalStorageSQLite/SQLiteLocalStorage.cs12
5 files changed, 111 insertions, 46 deletions
diff --git a/OpenSim/OpenSim.Storage/LocalStorageBerkeleyDB/BDBLocalStorage.cs b/OpenSim/OpenSim.Storage/LocalStorageBerkeleyDB/BDBLocalStorage.cs
index 6228403..1818e3a 100644
--- a/OpenSim/OpenSim.Storage/LocalStorageBerkeleyDB/BDBLocalStorage.cs
+++ b/OpenSim/OpenSim.Storage/LocalStorageBerkeleyDB/BDBLocalStorage.cs
@@ -92,6 +92,17 @@ namespace OpenSim.Storage.LocalStorageBDB
92 { 92 {
93 } 93 }
94 94
95 public void SaveParcel(ParcelData parcel)
96 {
97 }
98
99 public void RemoveParcel(ParcelData parcel)
100 {
101 }
102
103 public void RemoveAllParcels()
104 {
105 }
95 106
96 public void LoadParcels(ILocalStorageParcelReceiver recv) 107 public void LoadParcels(ILocalStorageParcelReceiver recv)
97 { 108 {
diff --git a/OpenSim/OpenSim.Storage/LocalStorageDb4o/Db4LocalStorage.cs b/OpenSim/OpenSim.Storage/LocalStorageDb4o/Db4LocalStorage.cs
index 2fb3c90..d7b9f38 100644
--- a/OpenSim/OpenSim.Storage/LocalStorageDb4o/Db4LocalStorage.cs
+++ b/OpenSim/OpenSim.Storage/LocalStorageDb4o/Db4LocalStorage.cs
@@ -71,7 +71,7 @@ namespace OpenSim.Storage.LocalStorageDb4o
71 71
72 public void StorePrim(PrimData prim) 72 public void StorePrim(PrimData prim)
73 { 73 {
74 IObjectSet result = db.Query(new UUIDQuery(prim.FullID)); 74 IObjectSet result = db.Query(new UUIDPrimQuery(prim.FullID));
75 if(result.Count>0) 75 if(result.Count>0)
76 { 76 {
77 //prim already in storage 77 //prim already in storage
@@ -112,7 +112,7 @@ namespace OpenSim.Storage.LocalStorageDb4o
112 112
113 public void RemovePrim(LLUUID primID) 113 public void RemovePrim(LLUUID primID)
114 { 114 {
115 IObjectSet result = db.Query(new UUIDQuery(primID)); 115 IObjectSet result = db.Query(new UUIDPrimQuery(primID));
116 if(result.Count>0) 116 if(result.Count>0)
117 { 117 {
118 PrimData found = (PrimData) result.Next(); 118 PrimData found = (PrimData) result.Next();
@@ -133,7 +133,6 @@ namespace OpenSim.Storage.LocalStorageDb4o
133 public float[] LoadWorld() 133 public float[] LoadWorld()
134 { 134 {
135 OpenSim.Framework.Console.MainConsole.Instance.Verbose("LoadWorld() - Loading world...."); 135 OpenSim.Framework.Console.MainConsole.Instance.Verbose("LoadWorld() - Loading world....");
136 //World blank = new World();
137 float[] heightmap = null; 136 float[] heightmap = null;
138 OpenSim.Framework.Console.MainConsole.Instance.Verbose("LoadWorld() - Looking for a heightmap in local DB"); 137 OpenSim.Framework.Console.MainConsole.Instance.Verbose("LoadWorld() - Looking for a heightmap in local DB");
139 IObjectSet world_result = db.Get(typeof(MapStorage)); 138 IObjectSet world_result = db.Get(typeof(MapStorage));
@@ -144,21 +143,6 @@ namespace OpenSim.Storage.LocalStorageDb4o
144 //blank.LandMap = map.Map; 143 //blank.LandMap = map.Map;
145 heightmap = map.Map; 144 heightmap = map.Map;
146 } 145 }
147 else
148 {
149 /*
150 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("LoadWorld() - No heightmap found, generating new one");
151 HeightmapGenHills hills = new HeightmapGenHills();
152 // blank.LandMap = hills.GenerateHeightmap(200, 4.0f, 80.0f, false);
153 // heightmap = hills.GenerateHeightmap(200, 4.0f, 80.0f, false);
154 heightmap = new float[256, 256];
155 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("LoadWorld() - Saving heightmap to local database");
156 MapStorage map = new MapStorage();
157 map.Map = heightmap; //blank.LandMap;
158 db.Set(map);
159 db.Commit();
160 */
161 }
162 return heightmap; 146 return heightmap;
163 } 147 }
164 148
@@ -177,27 +161,77 @@ namespace OpenSim.Storage.LocalStorageDb4o
177 db.Commit(); 161 db.Commit();
178 } 162 }
179 163
180 public void SaveParcels(ParcelData[] parcel_data) 164 public void SaveParcel(ParcelData parcel)
181 { 165 {
182 MainConsole.Instance.Notice("Parcel Backup: Saving Parcels..."); 166 IObjectSet result = db.Query(new UUIDParcelQuery(parcel.globalID));
183 IObjectSet result = db.Get(typeof(ParcelData)); 167 if (result.Count > 0)
184 foreach (ParcelData parcel in result) 168 {
169 //Old Parcel
170 ParcelData updateParcel = (ParcelData)result.Next();
171 updateParcel.AABBMax = parcel.AABBMax;
172 updateParcel.AABBMin = parcel.AABBMin;
173 updateParcel.area = parcel.area;
174 updateParcel.auctionID = parcel.auctionID;
175 updateParcel.authBuyerID = parcel.authBuyerID;
176 updateParcel.category = parcel.category;
177 updateParcel.claimDate = parcel.claimDate;
178 updateParcel.claimPrice = parcel.claimPrice;
179 updateParcel.groupID = parcel.groupID;
180 updateParcel.groupPrims = parcel.groupPrims;
181 updateParcel.isGroupOwned = parcel.isGroupOwned;
182 updateParcel.localID = parcel.localID;
183 updateParcel.ownerID = parcel.ownerID;
184 updateParcel.parcelBitmapByteArray = (byte[])parcel.parcelBitmapByteArray.Clone();
185 updateParcel.parcelDesc = parcel.parcelDesc;
186 updateParcel.parcelFlags = parcel.parcelFlags;
187 updateParcel.parcelName = parcel.parcelName;
188 updateParcel.parcelStatus = parcel.parcelStatus;
189 updateParcel.salePrice = parcel.salePrice;
190
191 db.Set(updateParcel);
192 }
193 else
185 { 194 {
186 db.Delete(parcel); 195 db.Set(parcel);
187 } 196 }
188 MainConsole.Instance.Notice("Parcel Backup: Removing old entries complete. Adding new entries."); 197 db.Commit();
198 }
199
200 public void SaveParcels(ParcelData[] parcel_data)
201 {
202 MainConsole.Instance.Notice("Parcel Backup: Saving Parcels...");
189 int i; 203 int i;
190 for (i = 0; i < parcel_data.GetLength(0); i++) 204 for (i = 0; i < parcel_data.GetLength(0); i++)
191 { 205 {
192 206
193 MainConsole.Instance.Notice("Adding : " + i + " - SAMPLE: " + parcel_data[i].parcelBitmapByteArray[0]); 207 SaveParcel(parcel_data[i]);
194 db.Set(parcel_data[i]);
195 208
196 } 209 }
197 db.Commit();
198 MainConsole.Instance.Notice("Parcel Backup: Parcel Save Complete"); 210 MainConsole.Instance.Notice("Parcel Backup: Parcel Save Complete");
199 } 211 }
200 212
213 public void RemoveParcel(ParcelData parcel)
214 {
215 IObjectSet result = db.Query(new UUIDParcelQuery(parcel.globalID));
216 if (result.Count > 0)
217 {
218 db.Delete(result[0]);
219 }
220 db.Commit();
221 }
222 public void RemoveAllParcels()
223 {
224 MainConsole.Instance.Notice("Parcel Backup: Removing all parcels...");
225 IObjectSet result = db.Get(typeof(ParcelData));
226 if (result.Count > 0)
227 {
228 foreach (ParcelData parcelData in result)
229 {
230 RemoveParcel(parcelData);
231 }
232 }
233 }
234
201 public void LoadParcels(ILocalStorageParcelReceiver recv) 235 public void LoadParcels(ILocalStorageParcelReceiver recv)
202 { 236 {
203 MainConsole.Instance.Notice("Parcel Backup: Loading Parcels..."); 237 MainConsole.Instance.Notice("Parcel Backup: Loading Parcels...");
diff --git a/OpenSim/OpenSim.Storage/LocalStorageDb4o/OpenSim.Storage.LocalStorageDb4o.csproj b/OpenSim/OpenSim.Storage/LocalStorageDb4o/OpenSim.Storage.LocalStorageDb4o.csproj
index 9b4ff5d..231ba1d 100644
--- a/OpenSim/OpenSim.Storage/LocalStorageDb4o/OpenSim.Storage.LocalStorageDb4o.csproj
+++ b/OpenSim/OpenSim.Storage/LocalStorageDb4o/OpenSim.Storage.LocalStorageDb4o.csproj
@@ -1,4 +1,4 @@
1<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> 1<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2 <PropertyGroup> 2 <PropertyGroup>
3 <ProjectType>Local</ProjectType> 3 <ProjectType>Local</ProjectType>
4 <ProductVersion>8.0.50727</ProductVersion> 4 <ProductVersion>8.0.50727</ProductVersion>
@@ -6,7 +6,8 @@
6 <ProjectGuid>{E1B79ECF-0000-0000-0000-000000000000}</ProjectGuid> 6 <ProjectGuid>{E1B79ECF-0000-0000-0000-000000000000}</ProjectGuid>
7 <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> 7 <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
8 <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> 8 <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
9 <ApplicationIcon></ApplicationIcon> 9 <ApplicationIcon>
10 </ApplicationIcon>
10 <AssemblyKeyContainerName> 11 <AssemblyKeyContainerName>
11 </AssemblyKeyContainerName> 12 </AssemblyKeyContainerName>
12 <AssemblyName>OpenSim.Storage.LocalStorageDb4o</AssemblyName> 13 <AssemblyName>OpenSim.Storage.LocalStorageDb4o</AssemblyName>
@@ -15,9 +16,11 @@
15 <DefaultTargetSchema>IE50</DefaultTargetSchema> 16 <DefaultTargetSchema>IE50</DefaultTargetSchema>
16 <DelaySign>false</DelaySign> 17 <DelaySign>false</DelaySign>
17 <OutputType>Library</OutputType> 18 <OutputType>Library</OutputType>
18 <AppDesignerFolder></AppDesignerFolder> 19 <AppDesignerFolder>
20 </AppDesignerFolder>
19 <RootNamespace>OpenSim.Storage.LocalStorageDb4o</RootNamespace> 21 <RootNamespace>OpenSim.Storage.LocalStorageDb4o</RootNamespace>
20 <StartupObject></StartupObject> 22 <StartupObject>
23 </StartupObject>
21 <FileUpgradeFlags> 24 <FileUpgradeFlags>
22 </FileUpgradeFlags> 25 </FileUpgradeFlags>
23 </PropertyGroup> 26 </PropertyGroup>
@@ -28,7 +31,8 @@
28 <ConfigurationOverrideFile> 31 <ConfigurationOverrideFile>
29 </ConfigurationOverrideFile> 32 </ConfigurationOverrideFile>
30 <DefineConstants>TRACE;DEBUG</DefineConstants> 33 <DefineConstants>TRACE;DEBUG</DefineConstants>
31 <DocumentationFile></DocumentationFile> 34 <DocumentationFile>
35 </DocumentationFile>
32 <DebugSymbols>True</DebugSymbols> 36 <DebugSymbols>True</DebugSymbols>
33 <FileAlignment>4096</FileAlignment> 37 <FileAlignment>4096</FileAlignment>
34 <Optimize>False</Optimize> 38 <Optimize>False</Optimize>
@@ -37,7 +41,8 @@
37 <RemoveIntegerChecks>False</RemoveIntegerChecks> 41 <RemoveIntegerChecks>False</RemoveIntegerChecks>
38 <TreatWarningsAsErrors>False</TreatWarningsAsErrors> 42 <TreatWarningsAsErrors>False</TreatWarningsAsErrors>
39 <WarningLevel>4</WarningLevel> 43 <WarningLevel>4</WarningLevel>
40 <NoWarn></NoWarn> 44 <NoWarn>
45 </NoWarn>
41 </PropertyGroup> 46 </PropertyGroup>
42 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> 47 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
43 <AllowUnsafeBlocks>False</AllowUnsafeBlocks> 48 <AllowUnsafeBlocks>False</AllowUnsafeBlocks>
@@ -46,7 +51,8 @@
46 <ConfigurationOverrideFile> 51 <ConfigurationOverrideFile>
47 </ConfigurationOverrideFile> 52 </ConfigurationOverrideFile>
48 <DefineConstants>TRACE</DefineConstants> 53 <DefineConstants>TRACE</DefineConstants>
49 <DocumentationFile></DocumentationFile> 54 <DocumentationFile>
55 </DocumentationFile>
50 <DebugSymbols>False</DebugSymbols> 56 <DebugSymbols>False</DebugSymbols>
51 <FileAlignment>4096</FileAlignment> 57 <FileAlignment>4096</FileAlignment>
52 <Optimize>True</Optimize> 58 <Optimize>True</Optimize>
@@ -55,22 +61,23 @@
55 <RemoveIntegerChecks>False</RemoveIntegerChecks> 61 <RemoveIntegerChecks>False</RemoveIntegerChecks>
56 <TreatWarningsAsErrors>False</TreatWarningsAsErrors> 62 <TreatWarningsAsErrors>False</TreatWarningsAsErrors>
57 <WarningLevel>4</WarningLevel> 63 <WarningLevel>4</WarningLevel>
58 <NoWarn></NoWarn> 64 <NoWarn>
65 </NoWarn>
59 </PropertyGroup> 66 </PropertyGroup>
60 <ItemGroup> 67 <ItemGroup>
61 <Reference Include="System" > 68 <Reference Include="System">
62 <HintPath>System.dll</HintPath> 69 <HintPath>System.dll</HintPath>
63 <Private>False</Private> 70 <Private>False</Private>
64 </Reference> 71 </Reference>
65 <Reference Include="System.Xml" > 72 <Reference Include="System.Xml">
66 <HintPath>System.Xml.dll</HintPath> 73 <HintPath>System.Xml.dll</HintPath>
67 <Private>False</Private> 74 <Private>False</Private>
68 </Reference> 75 </Reference>
69 <Reference Include="Db4objects.Db4o.dll" > 76 <Reference Include="Db4objects.Db4o.dll">
70 <HintPath>..\..\..\bin\Db4objects.Db4o.dll</HintPath> 77 <HintPath>..\..\..\bin\Db4objects.Db4o.dll</HintPath>
71 <Private>False</Private> 78 <Private>False</Private>
72 </Reference> 79 </Reference>
73 <Reference Include="libsecondlife.dll" > 80 <Reference Include="libsecondlife.dll">
74 <HintPath>..\..\..\bin\libsecondlife.dll</HintPath> 81 <HintPath>..\..\..\bin\libsecondlife.dll</HintPath>
75 <Private>False</Private> 82 <Private>False</Private>
76 </Reference> 83 </Reference>
@@ -80,26 +87,27 @@
80 <Name>OpenSim.Framework</Name> 87 <Name>OpenSim.Framework</Name>
81 <Project>{8ACA2445-0000-0000-0000-000000000000}</Project> 88 <Project>{8ACA2445-0000-0000-0000-000000000000}</Project>
82 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> 89 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
83 <Private>False</Private> 90 <Private>False</Private>
84 </ProjectReference> 91 </ProjectReference>
85 <ProjectReference Include="..\..\..\Common\OpenSim.Framework.Console\OpenSim.Framework.Console.csproj"> 92 <ProjectReference Include="..\..\..\Common\OpenSim.Framework.Console\OpenSim.Framework.Console.csproj">
86 <Name>OpenSim.Framework.Console</Name> 93 <Name>OpenSim.Framework.Console</Name>
87 <Project>{A7CD0630-0000-0000-0000-000000000000}</Project> 94 <Project>{A7CD0630-0000-0000-0000-000000000000}</Project>
88 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> 95 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
89 <Private>False</Private> 96 <Private>False</Private>
90 </ProjectReference> 97 </ProjectReference>
91 </ItemGroup> 98 </ItemGroup>
92 <ItemGroup> 99 <ItemGroup>
93 <Compile Include="AssemblyInfo.cs"> 100 <Compile Include="AssemblyInfo.cs">
94 <SubType>Code</SubType> 101 <SubType>Code</SubType>
95 </Compile> 102 </Compile>
96 <Compile Include="Db4LocalStorage.cs"> 103 <Compile Include="UUIDParcelQuery.cs" />
104 <Compile Include="UUIDPrimQuery.cs">
97 <SubType>Code</SubType> 105 <SubType>Code</SubType>
98 </Compile> 106 </Compile>
99 <Compile Include="MapStorage.cs"> 107 <Compile Include="MapStorage.cs">
100 <SubType>Code</SubType> 108 <SubType>Code</SubType>
101 </Compile> 109 </Compile>
102 <Compile Include="UUIDQuery.cs"> 110 <Compile Include="Db4LocalStorage.cs">
103 <SubType>Code</SubType> 111 <SubType>Code</SubType>
104 </Compile> 112 </Compile>
105 </ItemGroup> 113 </ItemGroup>
@@ -110,4 +118,4 @@
110 <PostBuildEvent> 118 <PostBuildEvent>
111 </PostBuildEvent> 119 </PostBuildEvent>
112 </PropertyGroup> 120 </PropertyGroup>
113</Project> 121</Project> \ No newline at end of file
diff --git a/OpenSim/OpenSim.Storage/LocalStorageDb4o/UUIDQuery.cs b/OpenSim/OpenSim.Storage/LocalStorageDb4o/UUIDPrimQuery.cs
index 4c0be60..b2e8a91 100644
--- a/OpenSim/OpenSim.Storage/LocalStorageDb4o/UUIDQuery.cs
+++ b/OpenSim/OpenSim.Storage/LocalStorageDb4o/UUIDPrimQuery.cs
@@ -36,11 +36,11 @@ using OpenSim.Framework.Types;
36 36
37namespace OpenSim.Storage.LocalStorageDb4o 37namespace OpenSim.Storage.LocalStorageDb4o
38{ 38{
39 public class UUIDQuery : Predicate 39 public class UUIDPrimQuery : Predicate
40 { 40 {
41 private LLUUID _findID; 41 private LLUUID _findID;
42 42
43 public UUIDQuery(LLUUID find) 43 public UUIDPrimQuery(LLUUID find)
44 { 44 {
45 _findID = find; 45 _findID = find;
46 } 46 }
diff --git a/OpenSim/OpenSim.Storage/LocalStorageSQLite/SQLiteLocalStorage.cs b/OpenSim/OpenSim.Storage/LocalStorageSQLite/SQLiteLocalStorage.cs
index 2170898..8106727 100644
--- a/OpenSim/OpenSim.Storage/LocalStorageSQLite/SQLiteLocalStorage.cs
+++ b/OpenSim/OpenSim.Storage/LocalStorageSQLite/SQLiteLocalStorage.cs
@@ -173,6 +173,18 @@ namespace OpenSim.Storage.LocalStorageSQLite
173 173
174 } 174 }
175 175
176 public void SaveParcel(ParcelData parcel)
177 {
178 }
179
180 public void RemoveParcel(ParcelData parcel)
181 {
182 }
183
184 public void RemoveAllParcels()
185 {
186 }
187
176 public void LoadParcels(ILocalStorageParcelReceiver recv) 188 public void LoadParcels(ILocalStorageParcelReceiver recv)
177 { 189 {
178 recv.NoParcelDataFromStorage(); 190 recv.NoParcelDataFromStorage();