diff options
author | Oren Hurvitz | 2014-03-31 11:53:12 +0300 |
---|---|---|
committer | Oren Hurvitz | 2014-04-02 06:30:57 +0100 |
commit | d1c3f8eef58b29eb8760eeb1ac03852a2387f927 (patch) | |
tree | b8686f4ea01b6dac3740b9685734686e2178dd2d /OpenSim/Services/AssetService/AssetService.cs | |
parent | fix orphaned code in sun module per mantis 7068 (diff) | |
download | opensim-SC-d1c3f8eef58b29eb8760eeb1ac03852a2387f927.zip opensim-SC-d1c3f8eef58b29eb8760eeb1ac03852a2387f927.tar.gz opensim-SC-d1c3f8eef58b29eb8760eeb1ac03852a2387f927.tar.bz2 opensim-SC-d1c3f8eef58b29eb8760eeb1ac03852a2387f927.tar.xz |
Added assets service method AssetsExist(), which returns whether the given list of assets exist.
This method is used to optimize sending assets with embedded assets: e.g., when a Hypergrid visitor takes an item into the inventory.
Diffstat (limited to 'OpenSim/Services/AssetService/AssetService.cs')
-rw-r--r-- | OpenSim/Services/AssetService/AssetService.cs | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/OpenSim/Services/AssetService/AssetService.cs b/OpenSim/Services/AssetService/AssetService.cs index 08fd3f8..0aefa16 100644 --- a/OpenSim/Services/AssetService/AssetService.cs +++ b/OpenSim/Services/AssetService/AssetService.cs | |||
@@ -153,9 +153,24 @@ namespace OpenSim.Services.AssetService | |||
153 | return true; | 153 | return true; |
154 | } | 154 | } |
155 | 155 | ||
156 | public virtual bool[] AssetsExist(string[] ids) | ||
157 | { | ||
158 | try | ||
159 | { | ||
160 | UUID[] uuid = Array.ConvertAll(ids, id => UUID.Parse(id)); | ||
161 | return m_Database.AssetsExist(uuid); | ||
162 | } | ||
163 | catch (Exception e) | ||
164 | { | ||
165 | m_log.Error("[ASSET SERVICE]: Exception getting assets ", e); | ||
166 | return new bool[ids.Length]; | ||
167 | } | ||
168 | } | ||
169 | |||
156 | public virtual string Store(AssetBase asset) | 170 | public virtual string Store(AssetBase asset) |
157 | { | 171 | { |
158 | if (!m_Database.ExistsAsset(asset.FullID)) | 172 | bool exists = m_Database.AssetsExist(new[] { asset.FullID })[0]; |
173 | if (!exists) | ||
159 | { | 174 | { |
160 | // m_log.DebugFormat( | 175 | // m_log.DebugFormat( |
161 | // "[ASSET SERVICE]: Storing asset {0} {1}, bytes {2}", asset.Name, asset.FullID, asset.Data.Length); | 176 | // "[ASSET SERVICE]: Storing asset {0} {1}, bytes {2}", asset.Name, asset.FullID, asset.Data.Length); |
@@ -186,4 +201,4 @@ namespace OpenSim.Services.AssetService | |||
186 | return m_Database.Delete(id); | 201 | return m_Database.Delete(id); |
187 | } | 202 | } |
188 | } | 203 | } |
189 | } \ No newline at end of file | 204 | } |