diff options
author | Justin Clark-Casey (justincc) | 2009-08-28 17:07:17 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2009-08-28 17:07:17 +0100 |
commit | 7ff4c2e50b3df8ea82dc8a27f3b68657fe29226b (patch) | |
tree | dc11b507985f81272da920a58e0f4a24ec9e75d1 | |
parent | Correct build break (diff) | |
download | opensim-SC_OLD-7ff4c2e50b3df8ea82dc8a27f3b68657fe29226b.zip opensim-SC_OLD-7ff4c2e50b3df8ea82dc8a27f3b68657fe29226b.tar.gz opensim-SC_OLD-7ff4c2e50b3df8ea82dc8a27f3b68657fe29226b.tar.bz2 opensim-SC_OLD-7ff4c2e50b3df8ea82dc8a27f3b68657fe29226b.tar.xz |
Pull out distinct cache system folders and drop cache methods in InventoryCache
8 files changed, 59 insertions, 148 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs index 907c8f4..1696d82 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs | |||
@@ -45,6 +45,7 @@ using OpenSim.Region.CoreModules.Avatar.Inventory.Archiver; | |||
45 | using OpenSim.Region.CoreModules.World.Serialiser; | 45 | using OpenSim.Region.CoreModules.World.Serialiser; |
46 | using OpenSim.Region.Framework.Scenes; | 46 | using OpenSim.Region.Framework.Scenes; |
47 | using OpenSim.Region.Framework.Scenes.Serialization; | 47 | using OpenSim.Region.Framework.Scenes.Serialization; |
48 | using OpenSim.Services.Interfaces; | ||
48 | using OpenSim.Tests.Common; | 49 | using OpenSim.Tests.Common; |
49 | using OpenSim.Tests.Common.Mock; | 50 | using OpenSim.Tests.Common.Mock; |
50 | using OpenSim.Tests.Common.Setup; | 51 | using OpenSim.Tests.Common.Setup; |
@@ -102,6 +103,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
102 | Monitor.Wait(this, 60000); | 103 | Monitor.Wait(this, 60000); |
103 | } | 104 | } |
104 | 105 | ||
106 | Console.WriteLine("here"); | ||
107 | |||
105 | // Create asset | 108 | // Create asset |
106 | SceneObjectGroup object1; | 109 | SceneObjectGroup object1; |
107 | SceneObjectPart part1; | 110 | SceneObjectPart part1; |
@@ -135,8 +138,15 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
135 | item1.AssetID = asset1.FullID; | 138 | item1.AssetID = asset1.FullID; |
136 | item1.ID = item1Id; | 139 | item1.ID = item1Id; |
137 | //userInfo.RootFolder.FindFolderByPath("Objects").ID; | 140 | //userInfo.RootFolder.FindFolderByPath("Objects").ID; |
138 | InventoryFolderBase objsFolder = scene.InventoryService.GetFolderForType(userId, AssetType.Object); | 141 | //InventoryFolderBase objsFolder = scene.InventoryService.GetFolderForType(userId, AssetType.Object); |
139 | //InventoryFolderBase rootFolder = scene.InventoryService.GetRootFolder(userId); | 142 | Console.WriteLine("here2"); |
143 | IInventoryService inventoryService = scene.InventoryService; | ||
144 | InventoryFolderBase rootFolder = inventoryService.GetRootFolder(userId); | ||
145 | InventoryCollection rootContents = inventoryService.GetFolderContent(userId, rootFolder.ID); | ||
146 | InventoryFolderBase objsFolder = null; | ||
147 | foreach (InventoryFolderBase folder in rootContents.Folders) | ||
148 | if (folder.Name == "Objects") | ||
149 | objsFolder = folder; | ||
140 | item1.Folder = objsFolder.ID; | 150 | item1.Folder = objsFolder.ID; |
141 | scene.AddInventoryItem(userId, item1); | 151 | scene.AddInventoryItem(userId, item1); |
142 | 152 | ||
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/InventoryCache.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/InventoryCache.cs index c8f04a5..73ffc5e 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/InventoryCache.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/InventoryCache.cs | |||
@@ -88,13 +88,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory | |||
88 | } | 88 | } |
89 | 89 | ||
90 | // If not, go get them and place them in the cache | 90 | // If not, go get them and place them in the cache |
91 | Dictionary<AssetType, InventoryFolderBase> folders = m_Connector.GetSystemFolders(presence.UUID); | 91 | Dictionary<AssetType, InventoryFolderBase> folders = CacheSystemFolders(presence.UUID); |
92 | m_log.DebugFormat("[INVENTORY CACHE]: OnMakeRootAgent in {0}, fetched system folders for {1} {2}: count {3}", | 92 | m_log.DebugFormat("[INVENTORY CACHE]: OnMakeRootAgent in {0}, fetched system folders for {1} {2}: count {3}", |
93 | presence.Scene.RegionInfo.RegionName, presence.Firstname, presence.Lastname, folders.Count); | 93 | presence.Scene.RegionInfo.RegionName, presence.Firstname, presence.Lastname, folders.Count); |
94 | |||
95 | if (folders.Count > 0) | ||
96 | lock (m_InventoryCache) | ||
97 | m_InventoryCache.Add(presence.UUID, folders); | ||
98 | } | 94 | } |
99 | 95 | ||
100 | void OnClientClosed(UUID clientID, Scene scene) | 96 | void OnClientClosed(UUID clientID, Scene scene) |
@@ -113,26 +109,51 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory | |||
113 | } | 109 | } |
114 | } | 110 | } |
115 | 111 | ||
116 | // Drop system folders | 112 | m_log.DebugFormat( |
113 | "[INVENTORY CACHE]: OnClientClosed in {0}, user {1} out of sim. Dropping system folders", | ||
114 | scene.RegionInfo.RegionName, clientID); | ||
115 | DropCachedSystemFolders(clientID); | ||
116 | } | ||
117 | } | ||
118 | |||
119 | /// <summary> | ||
120 | /// Cache a user's 'system' folders. | ||
121 | /// </summary> | ||
122 | /// <param name="userID"></param> | ||
123 | /// <returns>Folders cached</returns> | ||
124 | protected Dictionary<AssetType, InventoryFolderBase> CacheSystemFolders(UUID userID) | ||
125 | { | ||
126 | // If not, go get them and place them in the cache | ||
127 | Dictionary<AssetType, InventoryFolderBase> folders = m_Connector.GetSystemFolders(userID); | ||
128 | |||
129 | if (folders.Count > 0) | ||
117 | lock (m_InventoryCache) | 130 | lock (m_InventoryCache) |
118 | if (m_InventoryCache.ContainsKey(clientID)) | 131 | m_InventoryCache.Add(userID, folders); |
119 | { | ||
120 | m_log.DebugFormat("[INVENTORY CACHE]: OnClientClosed in {0}, user {1} out of sim. Dropping system folders", | ||
121 | scene.RegionInfo.RegionName, clientID); | ||
122 | 132 | ||
123 | m_InventoryCache.Remove(clientID); | 133 | return folders; |
124 | } | ||
125 | } | ||
126 | } | 134 | } |
127 | 135 | ||
136 | /// <summary> | ||
137 | /// Drop a user's cached 'system' folders | ||
138 | /// </summary> | ||
139 | /// <param name="userID"></param> | ||
140 | protected void DropCachedSystemFolders(UUID userID) | ||
141 | { | ||
142 | // Drop system folders | ||
143 | lock (m_InventoryCache) | ||
144 | if (m_InventoryCache.ContainsKey(userID)) | ||
145 | m_InventoryCache.Remove(userID); | ||
146 | } | ||
128 | 147 | ||
129 | public InventoryFolderBase GetFolderForType(UUID userID, AssetType type) | 148 | public InventoryFolderBase GetFolderForType(UUID userID, AssetType type) |
130 | { | 149 | { |
131 | Dictionary<AssetType, InventoryFolderBase> folders = null; | 150 | Dictionary<AssetType, InventoryFolderBase> folders = null; |
151 | |||
132 | lock (m_InventoryCache) | 152 | lock (m_InventoryCache) |
133 | { | 153 | { |
134 | m_InventoryCache.TryGetValue(userID, out folders); | 154 | m_InventoryCache.TryGetValue(userID, out folders); |
135 | } | 155 | } |
156 | |||
136 | if ((folders != null) && folders.ContainsKey(type)) | 157 | if ((folders != null) && folders.ContainsKey(type)) |
137 | { | 158 | { |
138 | return folders[type]; | 159 | return folders[type]; |
diff --git a/OpenSim/Services/InventoryService/InventoryService.cs b/OpenSim/Services/InventoryService/InventoryService.cs index 19b1fd8..f04754b 100644 --- a/OpenSim/Services/InventoryService/InventoryService.cs +++ b/OpenSim/Services/InventoryService/InventoryService.cs | |||
@@ -88,6 +88,8 @@ namespace OpenSim.Services.InventoryService | |||
88 | // See IInventoryServices | 88 | // See IInventoryServices |
89 | public virtual InventoryFolderBase GetRootFolder(UUID userID) | 89 | public virtual InventoryFolderBase GetRootFolder(UUID userID) |
90 | { | 90 | { |
91 | //m_log.DebugFormat("[INVENTORY SERVICE]: Getting root folder for {0}", userID); | ||
92 | |||
91 | // Retrieve the first root folder we get from the DB. | 93 | // Retrieve the first root folder we get from the DB. |
92 | InventoryFolderBase rootFolder = m_Database.getUserRootFolder(userID); | 94 | InventoryFolderBase rootFolder = m_Database.getUserRootFolder(userID); |
93 | if (rootFolder != null) | 95 | if (rootFolder != null) |
diff --git a/OpenSim/Tests/Common/Mock/TestInventoryDataPlugin.cs b/OpenSim/Tests/Common/Mock/TestInventoryDataPlugin.cs index 1b14abb..ce116f2 100644 --- a/OpenSim/Tests/Common/Mock/TestInventoryDataPlugin.cs +++ b/OpenSim/Tests/Common/Mock/TestInventoryDataPlugin.cs | |||
@@ -27,6 +27,8 @@ | |||
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.Reflection; | ||
31 | using log4net; | ||
30 | using OpenMetaverse; | 32 | using OpenMetaverse; |
31 | using OpenSim.Framework; | 33 | using OpenSim.Framework; |
32 | using OpenSim.Data; | 34 | using OpenSim.Data; |
@@ -39,7 +41,9 @@ namespace OpenSim.Tests.Common.Mock | |||
39 | /// tests are single threaded. | 41 | /// tests are single threaded. |
40 | /// </summary> | 42 | /// </summary> |
41 | public class TestInventoryDataPlugin : IInventoryDataPlugin | 43 | public class TestInventoryDataPlugin : IInventoryDataPlugin |
42 | { | 44 | { |
45 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
46 | |||
43 | /// <value> | 47 | /// <value> |
44 | /// Inventory folders | 48 | /// Inventory folders |
45 | /// </value> | 49 | /// </value> |
@@ -87,6 +91,8 @@ namespace OpenSim.Tests.Common.Mock | |||
87 | 91 | ||
88 | public InventoryFolderBase getUserRootFolder(UUID user) | 92 | public InventoryFolderBase getUserRootFolder(UUID user) |
89 | { | 93 | { |
94 | m_log.DebugFormat("[MOCK INV DB]: Looking for root folder for {0}", user); | ||
95 | |||
90 | InventoryFolderBase folder = null; | 96 | InventoryFolderBase folder = null; |
91 | m_rootFolders.TryGetValue(user, out folder); | 97 | m_rootFolders.TryGetValue(user, out folder); |
92 | 98 | ||
@@ -124,7 +130,11 @@ namespace OpenSim.Tests.Common.Mock | |||
124 | m_folders[folder.ID] = folder; | 130 | m_folders[folder.ID] = folder; |
125 | 131 | ||
126 | if (folder.ParentID == UUID.Zero) | 132 | if (folder.ParentID == UUID.Zero) |
133 | { | ||
134 | m_log.DebugFormat( | ||
135 | "[MOCK INV DB]: Adding root folder {0} {1} for {2}", folder.Name, folder.ID, folder.Owner); | ||
127 | m_rootFolders[folder.Owner] = folder; | 136 | m_rootFolders[folder.Owner] = folder; |
137 | } | ||
128 | } | 138 | } |
129 | 139 | ||
130 | public void updateInventoryFolder(InventoryFolderBase folder) | 140 | public void updateInventoryFolder(InventoryFolderBase folder) |
diff --git a/bin/OpenSim.Data.MySQL.Tests.dll.config b/bin/OpenSim.Data.MySQL.Tests.dll.config deleted file mode 100644 index a3f681d..0000000 --- a/bin/OpenSim.Data.MySQL.Tests.dll.config +++ /dev/null | |||
@@ -1,33 +0,0 @@ | |||
1 | <?xml version="1.0" encoding="utf-8" ?> | ||
2 | <configuration> | ||
3 | <configSections> | ||
4 | <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net" /> | ||
5 | </configSections> | ||
6 | <runtime> | ||
7 | <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> | ||
8 | <dependentAssembly> | ||
9 | <assemblyIdentity name="nunit.framework" publicKeyToken="96d09a1eb7f44a77" culture="Neutral" /> | ||
10 | <bindingRedirect oldVersion="2.0.6.0" newVersion="2.4.6.0" /> | ||
11 | <bindingRedirect oldVersion="2.1.4.0" newVersion="2.4.6.0" /> | ||
12 | <bindingRedirect oldVersion="2.2.8.0" newVersion="2.4.6.0" /> | ||
13 | </dependentAssembly> | ||
14 | </assemblyBinding> | ||
15 | </runtime> | ||
16 | <log4net> | ||
17 | <!-- A1 is set to be a ConsoleAppender --> | ||
18 | <appender name="A1" type="log4net.Appender.ConsoleAppender"> | ||
19 | |||
20 | <!-- A1 uses PatternLayout --> | ||
21 | <layout type="log4net.Layout.PatternLayout"> | ||
22 | <!-- Print the date in ISO 8601 format --> | ||
23 | <conversionPattern value="%date [%thread] %-5level %logger %ndc - %message%newline" /> | ||
24 | </layout> | ||
25 | </appender> | ||
26 | |||
27 | <!-- Set root logger level to DEBUG and its only appender to A1 --> | ||
28 | <root> | ||
29 | <level value="DEBUG" /> | ||
30 | <appender-ref ref="A1" /> | ||
31 | </root> | ||
32 | </log4net> | ||
33 | </configuration> | ||
diff --git a/bin/OpenSim.Data.NHibernate.Tests.dll.config b/bin/OpenSim.Data.NHibernate.Tests.dll.config deleted file mode 100644 index 9b3231f..0000000 --- a/bin/OpenSim.Data.NHibernate.Tests.dll.config +++ /dev/null | |||
@@ -1,33 +0,0 @@ | |||
1 | <?xml version="1.0" encoding="utf-8" ?> | ||
2 | <configuration> | ||
3 | <configSections> | ||
4 | <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net" /> | ||
5 | </configSections> | ||
6 | <runtime> | ||
7 | <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> | ||
8 | <dependentAssembly> | ||
9 | <assemblyIdentity name="nunit.framework" publicKeyToken="96d09a1eb7f44a77" culture="Neutral" /> | ||
10 | <bindingRedirect oldVersion="2.0.6.0" newVersion="2.4.6.0" /> | ||
11 | <bindingRedirect oldVersion="2.1.4.0" newVersion="2.4.6.0" /> | ||
12 | <bindingRedirect oldVersion="2.2.8.0" newVersion="2.4.6.0" /> | ||
13 | </dependentAssembly> | ||
14 | </assemblyBinding> | ||
15 | </runtime> | ||
16 | <log4net> | ||
17 | <!-- A1 is set to be a ConsoleAppender --> | ||
18 | <appender name="A1" type="log4net.Appender.ConsoleAppender"> | ||
19 | |||
20 | <!-- A1 uses PatternLayout --> | ||
21 | <layout type="log4net.Layout.PatternLayout"> | ||
22 | <!-- Print the date in ISO 8601 format --> | ||
23 | <conversionPattern value="%date [%thread] %-5level %logger %ndc - %message%newline" /> | ||
24 | </layout> | ||
25 | </appender> | ||
26 | |||
27 | <!-- Set root logger level to DEBUG and its only appender to A1 --> | ||
28 | <root> | ||
29 | <level value="Info" /> | ||
30 | <appender-ref ref="A1" /> | ||
31 | </root> | ||
32 | </log4net> | ||
33 | </configuration> | ||
diff --git a/bin/OpenSim.Data.SQLite.Tests.dll.config b/bin/OpenSim.Data.SQLite.Tests.dll.config deleted file mode 100644 index a3f681d..0000000 --- a/bin/OpenSim.Data.SQLite.Tests.dll.config +++ /dev/null | |||
@@ -1,33 +0,0 @@ | |||
1 | <?xml version="1.0" encoding="utf-8" ?> | ||
2 | <configuration> | ||
3 | <configSections> | ||
4 | <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net" /> | ||
5 | </configSections> | ||
6 | <runtime> | ||
7 | <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> | ||
8 | <dependentAssembly> | ||
9 | <assemblyIdentity name="nunit.framework" publicKeyToken="96d09a1eb7f44a77" culture="Neutral" /> | ||
10 | <bindingRedirect oldVersion="2.0.6.0" newVersion="2.4.6.0" /> | ||
11 | <bindingRedirect oldVersion="2.1.4.0" newVersion="2.4.6.0" /> | ||
12 | <bindingRedirect oldVersion="2.2.8.0" newVersion="2.4.6.0" /> | ||
13 | </dependentAssembly> | ||
14 | </assemblyBinding> | ||
15 | </runtime> | ||
16 | <log4net> | ||
17 | <!-- A1 is set to be a ConsoleAppender --> | ||
18 | <appender name="A1" type="log4net.Appender.ConsoleAppender"> | ||
19 | |||
20 | <!-- A1 uses PatternLayout --> | ||
21 | <layout type="log4net.Layout.PatternLayout"> | ||
22 | <!-- Print the date in ISO 8601 format --> | ||
23 | <conversionPattern value="%date [%thread] %-5level %logger %ndc - %message%newline" /> | ||
24 | </layout> | ||
25 | </appender> | ||
26 | |||
27 | <!-- Set root logger level to DEBUG and its only appender to A1 --> | ||
28 | <root> | ||
29 | <level value="DEBUG" /> | ||
30 | <appender-ref ref="A1" /> | ||
31 | </root> | ||
32 | </log4net> | ||
33 | </configuration> | ||
diff --git a/bin/OpenSim.Data.Tests.dll.config b/bin/OpenSim.Data.Tests.dll.config deleted file mode 100644 index a3f681d..0000000 --- a/bin/OpenSim.Data.Tests.dll.config +++ /dev/null | |||
@@ -1,33 +0,0 @@ | |||
1 | <?xml version="1.0" encoding="utf-8" ?> | ||
2 | <configuration> | ||
3 | <configSections> | ||
4 | <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net" /> | ||
5 | </configSections> | ||
6 | <runtime> | ||
7 | <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> | ||
8 | <dependentAssembly> | ||
9 | <assemblyIdentity name="nunit.framework" publicKeyToken="96d09a1eb7f44a77" culture="Neutral" /> | ||
10 | <bindingRedirect oldVersion="2.0.6.0" newVersion="2.4.6.0" /> | ||
11 | <bindingRedirect oldVersion="2.1.4.0" newVersion="2.4.6.0" /> | ||
12 | <bindingRedirect oldVersion="2.2.8.0" newVersion="2.4.6.0" /> | ||
13 | </dependentAssembly> | ||
14 | </assemblyBinding> | ||
15 | </runtime> | ||
16 | <log4net> | ||
17 | <!-- A1 is set to be a ConsoleAppender --> | ||
18 | <appender name="A1" type="log4net.Appender.ConsoleAppender"> | ||
19 | |||
20 | <!-- A1 uses PatternLayout --> | ||
21 | <layout type="log4net.Layout.PatternLayout"> | ||
22 | <!-- Print the date in ISO 8601 format --> | ||
23 | <conversionPattern value="%date [%thread] %-5level %logger %ndc - %message%newline" /> | ||
24 | </layout> | ||
25 | </appender> | ||
26 | |||
27 | <!-- Set root logger level to DEBUG and its only appender to A1 --> | ||
28 | <root> | ||
29 | <level value="DEBUG" /> | ||
30 | <appender-ref ref="A1" /> | ||
31 | </root> | ||
32 | </log4net> | ||
33 | </configuration> | ||