diff options
author | Diva Canto | 2009-08-19 10:56:08 -0700 |
---|---|---|
committer | Diva Canto | 2009-08-19 10:56:08 -0700 |
commit | d519f1885f587409592cf92bc0f4ba8533a1866f (patch) | |
tree | dc8d0073d09050c8787121290b1e3a8f65119812 /OpenSim/Services/Connectors/Inventory | |
parent | Async purge so that the client thread doesn't wait. (diff) | |
download | opensim-SC_OLD-d519f1885f587409592cf92bc0f4ba8533a1866f.zip opensim-SC_OLD-d519f1885f587409592cf92bc0f4ba8533a1866f.tar.gz opensim-SC_OLD-d519f1885f587409592cf92bc0f4ba8533a1866f.tar.bz2 opensim-SC_OLD-d519f1885f587409592cf92bc0f4ba8533a1866f.tar.xz |
Added MoveItems, which is most useful upon viewer-delete inventory operation. Moving a batch of items is a 1-time operation. Made it async anyway, so that the viewer doesn't wait in case the DB layer is dumb (which is the case currently).
Diffstat (limited to 'OpenSim/Services/Connectors/Inventory')
4 files changed, 62 insertions, 0 deletions
diff --git a/OpenSim/Services/Connectors/Inventory/HGInventoryServiceConnector.cs b/OpenSim/Services/Connectors/Inventory/HGInventoryServiceConnector.cs index 00b74b5..45e921a 100644 --- a/OpenSim/Services/Connectors/Inventory/HGInventoryServiceConnector.cs +++ b/OpenSim/Services/Connectors/Inventory/HGInventoryServiceConnector.cs | |||
@@ -253,6 +253,19 @@ namespace OpenSim.Services.Connectors.Inventory | |||
253 | return false; | 253 | return false; |
254 | } | 254 | } |
255 | 255 | ||
256 | public bool MoveItems(string id, List<InventoryItemBase> items, UUID sessionID) | ||
257 | { | ||
258 | string url = string.Empty; | ||
259 | string userID = string.Empty; | ||
260 | |||
261 | if (StringToUrlAndUserID(id, out url, out userID)) | ||
262 | { | ||
263 | ISessionAuthInventoryService connector = GetConnector(url); | ||
264 | return connector.MoveItems(userID, items, sessionID); | ||
265 | } | ||
266 | return false; | ||
267 | } | ||
268 | |||
256 | public bool DeleteItems(string id, List<UUID> itemIDs, UUID sessionID) | 269 | public bool DeleteItems(string id, List<UUID> itemIDs, UUID sessionID) |
257 | { | 270 | { |
258 | string url = string.Empty; | 271 | string url = string.Empty; |
diff --git a/OpenSim/Services/Connectors/Inventory/ISessionAuthInventoryService.cs b/OpenSim/Services/Connectors/Inventory/ISessionAuthInventoryService.cs index e4e713c..c89c9b7 100644 --- a/OpenSim/Services/Connectors/Inventory/ISessionAuthInventoryService.cs +++ b/OpenSim/Services/Connectors/Inventory/ISessionAuthInventoryService.cs | |||
@@ -116,6 +116,8 @@ namespace OpenSim.Services.Connectors | |||
116 | /// <returns>true if the item was successfully updated</returns> | 116 | /// <returns>true if the item was successfully updated</returns> |
117 | bool UpdateItem(string userID, InventoryItemBase item, UUID session_id); | 117 | bool UpdateItem(string userID, InventoryItemBase item, UUID session_id); |
118 | 118 | ||
119 | bool MoveItems(string userID, List<InventoryItemBase> items, UUID session_id); | ||
120 | |||
119 | /// <summary> | 121 | /// <summary> |
120 | /// Delete an item from the user's inventory | 122 | /// Delete an item from the user's inventory |
121 | /// </summary> | 123 | /// </summary> |
diff --git a/OpenSim/Services/Connectors/Inventory/InventoryServiceConnector.cs b/OpenSim/Services/Connectors/Inventory/InventoryServiceConnector.cs index 9b2e331..bcf9d87 100644 --- a/OpenSim/Services/Connectors/Inventory/InventoryServiceConnector.cs +++ b/OpenSim/Services/Connectors/Inventory/InventoryServiceConnector.cs | |||
@@ -383,6 +383,48 @@ namespace OpenSim.Services.Connectors | |||
383 | return false; | 383 | return false; |
384 | } | 384 | } |
385 | 385 | ||
386 | /** | ||
387 | * MoveItems Async group | ||
388 | */ | ||
389 | |||
390 | delegate void MoveItemsDelegate(string userID, List<InventoryItemBase> items, UUID sessionID); | ||
391 | |||
392 | private void MoveItemsAsync(string userID, List<InventoryItemBase> items, UUID sessionID) | ||
393 | { | ||
394 | try | ||
395 | { | ||
396 | SynchronousRestSessionObjectPoster<List<InventoryItemBase>, bool>.BeginPostObject( | ||
397 | "POST", m_ServerURI + "/MoveItems/", items, sessionID.ToString(), userID.ToString()); | ||
398 | |||
399 | // Success | ||
400 | return; | ||
401 | } | ||
402 | catch (Exception e) | ||
403 | { | ||
404 | m_log.ErrorFormat("[INVENTORY CONNECTOR]: Move inventory items operation failed, {0} {1} (old server?). Trying slow way.", | ||
405 | e.Source, e.Message); | ||
406 | } | ||
407 | |||
408 | foreach (InventoryItemBase item in items) | ||
409 | { | ||
410 | InventoryItemBase itm = this.QueryItem(userID, item, sessionID); | ||
411 | itm.Name = item.Name; | ||
412 | itm.Folder = item.Folder; | ||
413 | this.UpdateItem(userID, itm, sessionID); | ||
414 | } | ||
415 | } | ||
416 | |||
417 | private void MoveItemsCompleted(IAsyncResult iar) | ||
418 | { | ||
419 | } | ||
420 | |||
421 | public bool MoveItems(string userID, List<InventoryItemBase> items, UUID sessionID) | ||
422 | { | ||
423 | MoveItemsDelegate d = MoveItemsAsync; | ||
424 | d.BeginInvoke(userID, items, sessionID, MoveItemsCompleted, d); | ||
425 | return true; | ||
426 | } | ||
427 | |||
386 | public bool DeleteItems(string userID, List<UUID> items, UUID sessionID) | 428 | public bool DeleteItems(string userID, List<UUID> items, UUID sessionID) |
387 | { | 429 | { |
388 | try | 430 | try |
diff --git a/OpenSim/Services/Connectors/Inventory/QuickAndDirtyInventoryServiceConnector.cs b/OpenSim/Services/Connectors/Inventory/QuickAndDirtyInventoryServiceConnector.cs index 3bbf129..cd283ff 100644 --- a/OpenSim/Services/Connectors/Inventory/QuickAndDirtyInventoryServiceConnector.cs +++ b/OpenSim/Services/Connectors/Inventory/QuickAndDirtyInventoryServiceConnector.cs | |||
@@ -151,6 +151,11 @@ namespace OpenSim.Services.Connectors | |||
151 | return false; | 151 | return false; |
152 | } | 152 | } |
153 | 153 | ||
154 | public bool MoveItems(UUID ownerID, List<InventoryItemBase> items) | ||
155 | { | ||
156 | return false; | ||
157 | } | ||
158 | |||
154 | public bool DeleteItems(UUID owner, List<UUID> itemIDs) | 159 | public bool DeleteItems(UUID owner, List<UUID> itemIDs) |
155 | { | 160 | { |
156 | return false; | 161 | return false; |