Connect up the new asset cache and introduce an asynchronous call path

for asset retrieval (full asset only) to ease migration to the new system
This commit is contained in:
Melanie Thielker
2009-05-10 14:03:06 +00:00
parent d8e1842d25
commit 1a910b6e1d
6 changed files with 223 additions and 32 deletions

View File

@@ -94,6 +94,20 @@ namespace OpenSim.Services.AssetService
return asset.Data;
}
public bool Get(string id, Object sender, AssetRetrieved handler)
{
UUID assetID;
if (!UUID.TryParse(id, out assetID))
return false;
AssetBase asset = m_Database.FetchAsset(assetID);
handler(id, sender, asset);
return true;
}
public string Store(AssetBase asset)
{
m_Database.CreateAsset(asset);

View File

@@ -25,10 +25,13 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using System;
using OpenSim.Framework;
namespace OpenSim.Services.Interfaces
{
public delegate void AssetRetrieved(string id, Object sender, AssetBase asset);
public interface IAssetService
{
// Three different ways to retrieve an asset
@@ -37,6 +40,8 @@ namespace OpenSim.Services.Interfaces
AssetMetadata GetMetadata(string id);
byte[] GetData(string id);
bool Get(string id, Object sender, AssetRetrieved handler);
// Creates a new asset
// Returns a random ID if none is passed into it
//