Added assets service method AssetsExist(), which returns whether the given list of assets exist.

This method is used to optimize sending assets with embedded assets: e.g., when a Hypergrid visitor takes an item into the inventory.
This commit is contained in:
Oren Hurvitz
2014-03-31 11:53:12 +03:00
parent ac16a667e1
commit d1c3f8eef5
25 changed files with 579 additions and 179 deletions

View File

@@ -25,6 +25,7 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using System;
using System.Collections.Generic;
using OpenMetaverse;
using OpenSim.Framework;
@@ -37,7 +38,7 @@ namespace OpenSim.Tests.Common.Mock
public AssetBase FetchAsset(UUID uuid)
{
if (ExistsAsset(uuid))
if (AssetsExist(new[] { uuid })[0])
return Assets[uuid];
else
return null;
@@ -53,9 +54,9 @@ namespace OpenSim.Tests.Common.Mock
CreateAsset(asset);
}
public bool ExistsAsset(UUID uuid)
{
return Assets.ContainsKey(uuid);
public bool[] AssetsExist(UUID[] uuids)
{
return Array.ConvertAll(uuids, id => Assets.ContainsKey(id));
}
}
}