clockwerk-opensim – Blame information for rev 1

Subversion Repositories:
Rev:
Rev Author Line No. Line
1 vero 1 /*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27  
28 using System;
29 using OpenSim.Framework;
30  
31 namespace OpenSim.Services.Interfaces
32 {
33 public delegate void AssetRetrieved(string id, Object sender, AssetBase asset);
34  
35 public interface IAssetService
36 {
37 /// <summary>
38 /// Get an asset synchronously.
39 /// </summary>
40 /// <param name="id"></param>
41 /// <returns></returns>
42 AssetBase Get(string id);
43  
44 /// <summary>
45 /// Get an asset's metadata
46 /// </summary>
47 /// <param name="id"></param>
48 /// <returns></returns>
49 AssetMetadata GetMetadata(string id);
50  
51 /// <summary>
52 /// Get an asset's data, ignoring the metadata.
53 /// </summary>
54 /// <param name="id"></param>
55 /// <returns>null if there is no such asset</returns>
56 byte[] GetData(string id);
57  
58 /// <summary>
59 /// Synchronously fetches an asset from the local cache only.
60 /// </summary>
61 /// <param name="id">Asset ID</param>
62 /// <returns>The fetched asset, or null if it did not exist in the local cache</returns>
63 AssetBase GetCached(string id);
64  
65 /// <summary>
66 /// Get an asset synchronously or asynchronously (depending on whether
67 /// it is locally cached) and fire a callback with the fetched asset
68 /// </summary>
69 /// <param name="id">The asset id</param>
70 /// <param name="sender">Represents the requester. Passed back via the handler</param>
71 /// <param name="handler">
72 /// The handler to call back once the asset has been retrieved. This will be called back with a null AssetBase
73 /// if the asset could not be found for some reason (e.g. if it does not exist, if a remote asset service
74 /// was not contactable, if it is not in the database, etc.).
75 /// </param>
76 /// <returns>True if the id was parseable, false otherwise</returns>
77 bool Get(string id, Object sender, AssetRetrieved handler);
78  
79 /// <summary>
80 /// Check if assets exist in the database.
81 /// </summary>
82 /// <param name="ids">The assets' IDs</param>
83 /// <returns>For each asset: true if it exists, false otherwise</returns>
84 bool[] AssetsExist(string[] ids);
85  
86 /// <summary>
87 /// Creates a new asset
88 /// </summary>
89 /// <remarks>
90 /// Returns a random ID if none is passed via the asset argument.
91 /// </remarks>
92 /// <param name="asset"></param>
93 /// <returns>The Asset ID, or string.Empty if an error occurred</returns>
94 string Store(AssetBase asset);
95  
96 /// <summary>
97 /// Update an asset's content
98 /// </summary>
99 /// <remarks>
100 /// Attachments and bare scripts need this!!
101 /// </remarks>
102 /// <param name="id"> </param>
103 /// <param name="data"></param>
104 /// <returns></returns>
105 bool UpdateContent(string id, byte[] data);
106  
107 /// <summary>
108 /// Delete an asset
109 /// </summary>
110 /// <param name="id"></param>
111 /// <returns></returns>
112 bool Delete(string id);
113 }
114 }