diff options
Diffstat (limited to 'OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreModule.cs')
-rw-r--r-- | OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreModule.cs | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreModule.cs b/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreModule.cs index 3b52e44..f1ce856 100644 --- a/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreModule.cs +++ b/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreModule.cs | |||
@@ -54,6 +54,9 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore | |||
54 | 54 | ||
55 | private IConfig m_config = null; | 55 | private IConfig m_config = null; |
56 | private bool m_enabled = false; | 56 | private bool m_enabled = false; |
57 | private bool m_enableObjectStore = false; | ||
58 | private int m_maxStringSpace = Int32.MaxValue; | ||
59 | |||
57 | private Scene m_scene = null; | 60 | private Scene m_scene = null; |
58 | 61 | ||
59 | private Dictionary<UUID,JsonStore> m_JsonValueStore; | 62 | private Dictionary<UUID,JsonStore> m_JsonValueStore; |
@@ -90,6 +93,10 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore | |||
90 | } | 93 | } |
91 | 94 | ||
92 | m_enabled = m_config.GetBoolean("Enabled", m_enabled); | 95 | m_enabled = m_config.GetBoolean("Enabled", m_enabled); |
96 | m_enableObjectStore = m_config.GetBoolean("EnableObjectStore", m_enableObjectStore); | ||
97 | m_maxStringSpace = m_config.GetInt("MaxStringSpace", m_maxStringSpace); | ||
98 | if (m_maxStringSpace == 0) | ||
99 | m_maxStringSpace = Int32.MaxValue; | ||
93 | } | 100 | } |
94 | catch (Exception e) | 101 | catch (Exception e) |
95 | { | 102 | { |
@@ -178,6 +185,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore | |||
178 | public bool AttachObjectStore(UUID objectID) | 185 | public bool AttachObjectStore(UUID objectID) |
179 | { | 186 | { |
180 | if (! m_enabled) return false; | 187 | if (! m_enabled) return false; |
188 | if (! m_enableObjectStore) return false; | ||
181 | 189 | ||
182 | SceneObjectPart sop = m_scene.GetSceneObjectPart(objectID); | 190 | SceneObjectPart sop = m_scene.GetSceneObjectPart(objectID); |
183 | if (sop == null) | 191 | if (sop == null) |
@@ -239,7 +247,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore | |||
239 | if (! m_enabled) return false; | 247 | if (! m_enabled) return false; |
240 | 248 | ||
241 | lock (m_JsonValueStore) | 249 | lock (m_JsonValueStore) |
242 | m_JsonValueStore.Remove(storeID); | 250 | return m_JsonValueStore.Remove(storeID); |
243 | 251 | ||
244 | return true; | 252 | return true; |
245 | } | 253 | } |
@@ -311,8 +319,16 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore | |||
311 | try | 319 | try |
312 | { | 320 | { |
313 | lock (map) | 321 | lock (map) |
314 | if (map.SetValue(path,value,useJson)) | 322 | { |
315 | return true; | 323 | if (map.StringSpace > m_maxStringSpace) |
324 | { | ||
325 | m_log.WarnFormat("[JsonStore] {0} exceeded string size; {1} bytes used of {2} limit", | ||
326 | storeID,map.StringSpace,m_maxStringSpace); | ||
327 | return false; | ||
328 | } | ||
329 | |||
330 | return map.SetValue(path,value,useJson); | ||
331 | } | ||
316 | } | 332 | } |
317 | catch (Exception e) | 333 | catch (Exception e) |
318 | { | 334 | { |
@@ -344,8 +360,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore | |||
344 | try | 360 | try |
345 | { | 361 | { |
346 | lock (map) | 362 | lock (map) |
347 | if (map.RemoveValue(path)) | 363 | return map.RemoveValue(path); |
348 | return true; | ||
349 | } | 364 | } |
350 | catch (Exception e) | 365 | catch (Exception e) |
351 | { | 366 | { |