From 1a910b6e1dbace70b27581c51148a8732b46de79 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Sun, 10 May 2009 14:03:06 +0000 Subject: 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 --- OpenSim/Services/AssetService/AssetService.cs | 14 ++++++++++++++ OpenSim/Services/Interfaces/IAssetService.cs | 5 +++++ 2 files changed, 19 insertions(+) (limited to 'OpenSim/Services') diff --git a/OpenSim/Services/AssetService/AssetService.cs b/OpenSim/Services/AssetService/AssetService.cs index c279699..1e038d4 100644 --- a/OpenSim/Services/AssetService/AssetService.cs +++ b/OpenSim/Services/AssetService/AssetService.cs @@ -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); diff --git a/OpenSim/Services/Interfaces/IAssetService.cs b/OpenSim/Services/Interfaces/IAssetService.cs index e1717d0..ec8a71b 100644 --- a/OpenSim/Services/Interfaces/IAssetService.cs +++ b/OpenSim/Services/Interfaces/IAssetService.cs @@ -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 // -- cgit v1.1