aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Services
diff options
context:
space:
mode:
authorMelanie Thielker2009-05-10 14:03:06 +0000
committerMelanie Thielker2009-05-10 14:03:06 +0000
commit1a910b6e1dbace70b27581c51148a8732b46de79 (patch)
treec13e58aa932b0db95ca895cd0ff1275c0014ca9f /OpenSim/Services
parentAdd some asset cache plumbing. Change the generic cache from UUID to string (diff)
downloadopensim-SC-1a910b6e1dbace70b27581c51148a8732b46de79.zip
opensim-SC-1a910b6e1dbace70b27581c51148a8732b46de79.tar.gz
opensim-SC-1a910b6e1dbace70b27581c51148a8732b46de79.tar.bz2
opensim-SC-1a910b6e1dbace70b27581c51148a8732b46de79.tar.xz
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
Diffstat (limited to 'OpenSim/Services')
-rw-r--r--OpenSim/Services/AssetService/AssetService.cs14
-rw-r--r--OpenSim/Services/Interfaces/IAssetService.cs5
2 files changed, 19 insertions, 0 deletions
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
94 return asset.Data; 94 return asset.Data;
95 } 95 }
96 96
97 public bool Get(string id, Object sender, AssetRetrieved handler)
98 {
99 UUID assetID;
100
101 if (!UUID.TryParse(id, out assetID))
102 return false;
103
104 AssetBase asset = m_Database.FetchAsset(assetID);
105
106 handler(id, sender, asset);
107
108 return true;
109 }
110
97 public string Store(AssetBase asset) 111 public string Store(AssetBase asset)
98 { 112 {
99 m_Database.CreateAsset(asset); 113 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 @@
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 27
28using System;
28using OpenSim.Framework; 29using OpenSim.Framework;
29 30
30namespace OpenSim.Services.Interfaces 31namespace OpenSim.Services.Interfaces
31{ 32{
33 public delegate void AssetRetrieved(string id, Object sender, AssetBase asset);
34
32 public interface IAssetService 35 public interface IAssetService
33 { 36 {
34 // Three different ways to retrieve an asset 37 // Three different ways to retrieve an asset
@@ -37,6 +40,8 @@ namespace OpenSim.Services.Interfaces
37 AssetMetadata GetMetadata(string id); 40 AssetMetadata GetMetadata(string id);
38 byte[] GetData(string id); 41 byte[] GetData(string id);
39 42
43 bool Get(string id, Object sender, AssetRetrieved handler);
44
40 // Creates a new asset 45 // Creates a new asset
41 // Returns a random ID if none is passed into it 46 // Returns a random ID if none is passed into it
42 // 47 //