diff options
author | Diva Canto | 2015-05-08 20:53:28 -0700 |
---|---|---|
committer | Diva Canto | 2015-05-08 20:53:28 -0700 |
commit | 0bf1209f908bb9a384ddb3a4255a75bf2317c478 (patch) | |
tree | 3ebc80806ecfe884352f6628132421d2edcdab04 /OpenSim/Services/Connectors | |
parent | Restore handling of bad folders. I'm not entirely sure this is part of the pr... (diff) | |
download | opensim-SC_OLD-0bf1209f908bb9a384ddb3a4255a75bf2317c478.zip opensim-SC_OLD-0bf1209f908bb9a384ddb3a4255a75bf2317c478.tar.gz opensim-SC_OLD-0bf1209f908bb9a384ddb3a4255a75bf2317c478.tar.bz2 opensim-SC_OLD-0bf1209f908bb9a384ddb3a4255a75bf2317c478.tar.xz |
Another major overhaul of inventory downloading, this time pertaining to inventory links. Added yet another function to IInventoryService to get multiple items at once, so that fetching collections of linked items is done once per folder instead of once per item.
Diffstat (limited to 'OpenSim/Services/Connectors')
-rw-r--r-- | OpenSim/Services/Connectors/Inventory/XInventoryServicesConnector.cs | 37 | ||||
-rw-r--r-- | OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs | 15 |
2 files changed, 52 insertions, 0 deletions
diff --git a/OpenSim/Services/Connectors/Inventory/XInventoryServicesConnector.cs b/OpenSim/Services/Connectors/Inventory/XInventoryServicesConnector.cs index 56dece3..0cea4a1 100644 --- a/OpenSim/Services/Connectors/Inventory/XInventoryServicesConnector.cs +++ b/OpenSim/Services/Connectors/Inventory/XInventoryServicesConnector.cs | |||
@@ -316,6 +316,7 @@ namespace OpenSim.Services.Connectors | |||
316 | 316 | ||
317 | return inventoryArr; | 317 | return inventoryArr; |
318 | } | 318 | } |
319 | |||
319 | public List<InventoryItemBase> GetFolderItems(UUID principalID, UUID folderID) | 320 | public List<InventoryItemBase> GetFolderItems(UUID principalID, UUID folderID) |
320 | { | 321 | { |
321 | Dictionary<string,object> ret = MakeRequest("GETFOLDERITEMS", | 322 | Dictionary<string,object> ret = MakeRequest("GETFOLDERITEMS", |
@@ -526,6 +527,42 @@ namespace OpenSim.Services.Connectors | |||
526 | return null; | 527 | return null; |
527 | } | 528 | } |
528 | 529 | ||
530 | public virtual InventoryItemBase[] GetMultipleItems(UUID principalID, UUID[] itemIDs) | ||
531 | { | ||
532 | InventoryItemBase[] itemArr = new InventoryItemBase[itemIDs.Length]; | ||
533 | try | ||
534 | { | ||
535 | Dictionary<string, object> resultSet = MakeRequest("GETMULTIPLEITEMS", | ||
536 | new Dictionary<string, object> { | ||
537 | { "PRINCIPAL", principalID.ToString() }, | ||
538 | { "ITEMS", String.Join(",", itemIDs) }, | ||
539 | { "COUNT", itemIDs.Length.ToString() } | ||
540 | }); | ||
541 | |||
542 | if (!CheckReturn(resultSet)) | ||
543 | return null; | ||
544 | |||
545 | int i = 0; | ||
546 | foreach (KeyValuePair<string, object> kvp in resultSet) | ||
547 | { | ||
548 | InventoryCollection inventory = new InventoryCollection(); | ||
549 | if (kvp.Key.StartsWith("item_")) | ||
550 | { | ||
551 | if (kvp.Value is Dictionary<string, object>) | ||
552 | itemArr[i++] = BuildItem((Dictionary<string, object>)kvp.Value); | ||
553 | else | ||
554 | itemArr[i++] = null; | ||
555 | } | ||
556 | } | ||
557 | } | ||
558 | catch (Exception e) | ||
559 | { | ||
560 | m_log.WarnFormat("[XINVENTORY SERVICES CONNECTOR]: Exception in GetMultipleItems: {0}", e.Message); | ||
561 | } | ||
562 | |||
563 | return itemArr; | ||
564 | } | ||
565 | |||
529 | public InventoryFolderBase GetFolder(InventoryFolderBase folder) | 566 | public InventoryFolderBase GetFolder(InventoryFolderBase folder) |
530 | { | 567 | { |
531 | try | 568 | try |
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs index 0331c66..fdeea18 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs | |||
@@ -301,6 +301,21 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
301 | return null; | 301 | return null; |
302 | } | 302 | } |
303 | 303 | ||
304 | public InventoryItemBase[] GetMultipleItems(UUID principalID, UUID[] itemIDs) | ||
305 | { | ||
306 | InventoryItemBase[] result = new InventoryItemBase[itemIDs.Length]; | ||
307 | int i = 0; | ||
308 | InventoryItemBase item = new InventoryItemBase(); | ||
309 | item.Owner = principalID; | ||
310 | foreach (UUID id in itemIDs) | ||
311 | { | ||
312 | item.ID = id; | ||
313 | result[i++] = GetItem(item); | ||
314 | } | ||
315 | |||
316 | return result; | ||
317 | } | ||
318 | |||
304 | /// <summary> | 319 | /// <summary> |
305 | /// Get a folder, given by its UUID | 320 | /// Get a folder, given by its UUID |
306 | /// </summary> | 321 | /// </summary> |