diff options
author | Justin Clarke Casey | 2009-03-09 18:35:26 +0000 |
---|---|---|
committer | Justin Clarke Casey | 2009-03-09 18:35:26 +0000 |
commit | 1bf05a543c1328c31b7b107a3335f34e8d174ed8 (patch) | |
tree | af6917159ce713048f3a35e29ddc0b86a95ffe87 /OpenSim/Framework/IAssetCache.cs | |
parent | * Apply http://opensimulator.org/mantis/view.php?id=3280 (diff) | |
download | opensim-SC_OLD-1bf05a543c1328c31b7b107a3335f34e8d174ed8.zip opensim-SC_OLD-1bf05a543c1328c31b7b107a3335f34e8d174ed8.tar.gz opensim-SC_OLD-1bf05a543c1328c31b7b107a3335f34e8d174ed8.tar.bz2 opensim-SC_OLD-1bf05a543c1328c31b7b107a3335f34e8d174ed8.tar.xz |
* Move method documentation from AssetCache up to IAssetCache
* No functional changes
Diffstat (limited to 'OpenSim/Framework/IAssetCache.cs')
-rw-r--r-- | OpenSim/Framework/IAssetCache.cs | 71 |
1 files changed, 66 insertions, 5 deletions
diff --git a/OpenSim/Framework/IAssetCache.cs b/OpenSim/Framework/IAssetCache.cs index 22f5755..8a184bb 100644 --- a/OpenSim/Framework/IAssetCache.cs +++ b/OpenSim/Framework/IAssetCache.cs | |||
@@ -30,25 +30,86 @@ using OpenMetaverse.Packets; | |||
30 | 30 | ||
31 | namespace OpenSim.Framework | 31 | namespace OpenSim.Framework |
32 | { | 32 | { |
33 | |||
34 | public delegate void AssetRequestCallback(UUID assetId, AssetBase asset); | 33 | public delegate void AssetRequestCallback(UUID assetId, AssetBase asset); |
35 | 34 | ||
35 | /// <summary> | ||
36 | /// Interface to the local asset cache. This is the mechanism through which assets can be added and requested. | ||
37 | /// </summary> | ||
36 | public interface IAssetCache : IAssetReceiver, IPlugin | 38 | public interface IAssetCache : IAssetReceiver, IPlugin |
37 | { | 39 | { |
38 | 40 | /// <value> | |
41 | /// The 'server' from which assets can be requested and to which assets are persisted. | ||
42 | /// </value> | ||
39 | IAssetServer AssetServer { get; } | 43 | IAssetServer AssetServer { get; } |
44 | |||
45 | void Initialise(ConfigSettings cs, IAssetServer server); | ||
40 | 46 | ||
47 | /// <summary> | ||
48 | /// Report statistical data to the log. | ||
49 | /// </summary> | ||
41 | void ShowState(); | 50 | void ShowState(); |
51 | |||
52 | /// <summary> | ||
53 | /// Clear the asset cache. | ||
54 | /// </summary> | ||
42 | void Clear(); | 55 | void Clear(); |
56 | |||
57 | /// <summary> | ||
58 | /// Get an asset only if it's already in the cache. | ||
59 | /// </summary> | ||
60 | /// <param name="assetId"></param> | ||
61 | /// <param name="asset"></param> | ||
62 | /// <returns>true if the asset was in the cache, false if it was not</returns> | ||
43 | bool TryGetCachedAsset(UUID assetID, out AssetBase asset); | 63 | bool TryGetCachedAsset(UUID assetID, out AssetBase asset); |
64 | |||
65 | /// <summary> | ||
66 | /// Asynchronously retrieve an asset. | ||
67 | /// </summary> | ||
68 | /// <param name="assetId"></param> | ||
69 | /// <param name="callback"> | ||
70 | /// <param name="isTexture"></param> | ||
71 | /// A callback invoked when the asset has either been found or not found. | ||
72 | /// If the asset was found this is called with the asset UUID and the asset data | ||
73 | /// If the asset was not found this is still called with the asset UUID but with a null asset data reference</param> | ||
44 | void GetAsset(UUID assetID, AssetRequestCallback callback, bool isTexture); | 74 | void GetAsset(UUID assetID, AssetRequestCallback callback, bool isTexture); |
75 | |||
76 | /// <summary> | ||
77 | /// Synchronously retreive an asset. If the asset isn't in the cache, a request will be made to the persistent store to | ||
78 | /// load it into the cache. | ||
79 | /// </summary> | ||
80 | /// | ||
81 | /// XXX We'll keep polling the cache until we get the asset or we exceed | ||
82 | /// the allowed number of polls. This isn't a very good way of doing things since a single thread | ||
83 | /// is processing inbound packets, so if the asset server is slow, we could block this for up to | ||
84 | /// the timeout period. Whereever possible we want to use the asynchronous callback GetAsset() | ||
85 | /// | ||
86 | /// <param name="assetID"></param> | ||
87 | /// <param name="isTexture"></param> | ||
88 | /// <returns>null if the asset could not be retrieved</returns> | ||
45 | AssetBase GetAsset(UUID assetID, bool isTexture); | 89 | AssetBase GetAsset(UUID assetID, bool isTexture); |
90 | |||
91 | /// <summary> | ||
92 | /// Add an asset to both the persistent store and the cache. | ||
93 | /// </summary> | ||
94 | /// <param name="asset"></param> | ||
46 | void AddAsset(AssetBase asset); | 95 | void AddAsset(AssetBase asset); |
96 | |||
97 | /// <summary> | ||
98 | /// Expire an asset from the cache | ||
99 | /// </summary> | ||
100 | /// Allows you to clear a specific asset by uuid out | ||
101 | /// of the asset cache. This is needed because the osdynamic | ||
102 | /// texture code grows the asset cache without bounds. The | ||
103 | /// real solution here is a much better cache archicture, but | ||
104 | /// this is a stop gap measure until we have such a thing. | ||
47 | void ExpireAsset(UUID assetID); | 105 | void ExpireAsset(UUID assetID); |
106 | |||
107 | /// <summary> | ||
108 | /// Handle an asset request from the client. The result will be sent back asynchronously. | ||
109 | /// </summary> | ||
110 | /// <param name="userInfo"></param> | ||
111 | /// <param name="transferRequest"></param> | ||
48 | void AddAssetRequest(IClientAPI userInfo, TransferRequestPacket transferRequest); | 112 | void AddAssetRequest(IClientAPI userInfo, TransferRequestPacket transferRequest); |
49 | |||
50 | void Initialise(ConfigSettings cs, IAssetServer server); | ||
51 | |||
52 | } | 113 | } |
53 | 114 | ||
54 | public class AssetCachePluginInitialiser : PluginInitialiserBase | 115 | public class AssetCachePluginInitialiser : PluginInitialiserBase |