aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Communications/Cache/AssetCache.cs
diff options
context:
space:
mode:
authorSean Dague2009-02-16 12:20:31 +0000
committerSean Dague2009-02-16 12:20:31 +0000
commitf4bec00057fb6987f4ea166347156e1abb985ec1 (patch)
treea8b4e9461b077f1e2e36876d0aea263eb2ceb177 /OpenSim/Framework/Communications/Cache/AssetCache.cs
parentcosmetic: adding region name to logging statement (diff)
downloadopensim-SC_OLD-f4bec00057fb6987f4ea166347156e1abb985ec1.zip
opensim-SC_OLD-f4bec00057fb6987f4ea166347156e1abb985ec1.tar.gz
opensim-SC_OLD-f4bec00057fb6987f4ea166347156e1abb985ec1.tar.bz2
opensim-SC_OLD-f4bec00057fb6987f4ea166347156e1abb985ec1.tar.xz
From: Alan Webb <awebb@linux.vnet.ibm.com>
The change makes two principal implementation changes: [1] It removes the hard coded set of possible asset server client implementations, allowing any arbitrary implementation that has been identified to the PluginLoader as an appropriate extension. The extension point for asset server client extension is /OpenSim/AssetServerClient. All of the old configuration rules have been preserved, and any of the legacy configuration values will still work as they did before, except the implementation is now loaded as a plug-in, rather than as a hard-coded instantiation of a specific class. The re-hashing of IAssetServer as an extension of IPlugin made upgrading of the implementation classes a necessity. Caveat: I have not been able to meaningfully test the crypto-grid clients. I believe they should work correctly, but the refactoring necessary to handle plug-in based initialization (vs constructor-based initialisation) admits the possibility of a problem. [2] The asset cache implementation, previously introduce as a hard-code class instantiation is now implemented as an IPlugin. Once again the previous (configurationless) behavior has been preserved. But now it is possible for those interested in experimenting with cache technologies to do so simply by introducing a new extension for the asset cache extension point (/OpenSim/AssetCache). I've tested all of the configuration settings, after applying the patch to a newly extracted tree, and they seem to work OK.
Diffstat (limited to '')
-rw-r--r--OpenSim/Framework/Communications/Cache/AssetCache.cs80
1 files changed, 65 insertions, 15 deletions
diff --git a/OpenSim/Framework/Communications/Cache/AssetCache.cs b/OpenSim/Framework/Communications/Cache/AssetCache.cs
index 1c8f9d6..76c6045 100644
--- a/OpenSim/Framework/Communications/Cache/AssetCache.cs
+++ b/OpenSim/Framework/Communications/Cache/AssetCache.cs
@@ -48,8 +48,67 @@ namespace OpenSim.Framework.Communications.Cache
48 /// sends packetised data directly back to the client. The only point where they meet is AssetReceived() and 48 /// sends packetised data directly back to the client. The only point where they meet is AssetReceived() and
49 /// AssetNotFound(), which means they do share the same asset and texture caches.I agr 49 /// AssetNotFound(), which means they do share the same asset and texture caches.I agr
50 50
51 public class AssetCache : IAssetCache, IAssetReceiver 51 public class AssetCache : IAssetCache
52 { 52 {
53
54 #region IPlugin
55
56 /// <summary>
57 /// The methods and properties in this section are needed to
58 /// support the IPlugin interface. They cann all be overridden
59 /// as needed by a derived class.
60 /// </summary>
61
62 public virtual string Name
63 {
64 get { return "OpenSim.Framework.Communications.Cache.AssetCache"; }
65 }
66
67 public virtual string Version
68 {
69 get { return "1.0"; }
70 }
71
72 public virtual void Initialise()
73 {
74 m_log.Debug("[ASSET CACHE]: Asset cache null initialisation");
75 }
76
77 public virtual void Initialise(IAssetServer assetServer)
78 {
79 m_log.Debug("[ASSET CACHE]: Asset cache server-specified initialisation");
80 m_log.InfoFormat("[ASSET CACHE]: Asset cache initialisation [{0}/{1}]", Name, Version);
81
82 Initialize();
83
84 m_assetServer = assetServer;
85 m_assetServer.SetReceiver(this);
86
87 Thread assetCacheThread = new Thread(RunAssetManager);
88 assetCacheThread.Name = "AssetCacheThread";
89 assetCacheThread.IsBackground = true;
90 assetCacheThread.Start();
91 ThreadTracker.Add(assetCacheThread);
92
93 }
94
95 public virtual void Initialise(ConfigSettings settings, IAssetServer assetServer)
96 {
97 m_log.Debug("[ASSET CACHE]: Asset cache configured initialisation");
98 Initialise(assetServer);
99 }
100
101 public AssetCache()
102 {
103 m_log.Debug("[ASSET CACHE]: Asset cache (plugin constructor)");
104 }
105
106 public void Dispose()
107 {
108 }
109
110 #endregion
111
53 protected ICache m_memcache = new SimpleMemoryCache(); 112 protected ICache m_memcache = new SimpleMemoryCache();
54 113
55 private static readonly ILog m_log 114 private static readonly ILog m_log
@@ -83,7 +142,7 @@ namespace OpenSim.Framework.Communications.Cache
83 /// <summary> 142 /// <summary>
84 /// The 'server' from which assets can be requested and to which assets are persisted. 143 /// The 'server' from which assets can be requested and to which assets are persisted.
85 /// </summary> 144 /// </summary>
86 private readonly IAssetServer m_assetServer; 145 private IAssetServer m_assetServer;
87 146
88 public IAssetServer AssetServer 147 public IAssetServer AssetServer
89 { 148 {
@@ -132,17 +191,8 @@ namespace OpenSim.Framework.Communications.Cache
132 /// <param name="assetServer"></param> 191 /// <param name="assetServer"></param>
133 public AssetCache(IAssetServer assetServer) 192 public AssetCache(IAssetServer assetServer)
134 { 193 {
135 m_log.Info("[ASSET CACHE]: Creating Asset cache"); 194 m_log.Info("[ASSET CACHE]: Asset cache direct constructor");
136 Initialize(); 195 Initialise(assetServer);
137
138 m_assetServer = assetServer;
139 m_assetServer.SetReceiver(this);
140
141 Thread assetCacheThread = new Thread(RunAssetManager);
142 assetCacheThread.Name = "AssetCacheThread";
143 assetCacheThread.IsBackground = true;
144 assetCacheThread.Start();
145 ThreadTracker.Add(assetCacheThread);
146 } 196 }
147 197
148 /// <summary> 198 /// <summary>
@@ -342,7 +392,7 @@ namespace OpenSim.Framework.Communications.Cache
342 } 392 }
343 393
344 // See IAssetReceiver 394 // See IAssetReceiver
345 public void AssetReceived(AssetBase asset, bool IsTexture) 395 public virtual void AssetReceived(AssetBase asset, bool IsTexture)
346 { 396 {
347 397
348 AssetInfo assetInf = new AssetInfo(asset); 398 AssetInfo assetInf = new AssetInfo(asset);
@@ -393,7 +443,7 @@ namespace OpenSim.Framework.Communications.Cache
393 } 443 }
394 444
395 // See IAssetReceiver 445 // See IAssetReceiver
396 public void AssetNotFound(UUID assetID, bool IsTexture) 446 public virtual void AssetNotFound(UUID assetID, bool IsTexture)
397 { 447 {
398// m_log.WarnFormat("[ASSET CACHE]: AssetNotFound for {0}", assetID); 448// m_log.WarnFormat("[ASSET CACHE]: AssetNotFound for {0}", assetID);
399 449