aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Grid/NewAssetServer/Interfaces.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Grid/NewAssetServer/Interfaces.cs')
-rw-r--r--OpenSim/Grid/NewAssetServer/Interfaces.cs157
1 files changed, 157 insertions, 0 deletions
diff --git a/OpenSim/Grid/NewAssetServer/Interfaces.cs b/OpenSim/Grid/NewAssetServer/Interfaces.cs
new file mode 100644
index 0000000..8368922
--- /dev/null
+++ b/OpenSim/Grid/NewAssetServer/Interfaces.cs
@@ -0,0 +1,157 @@
1/*
2 * Copyright (c) 2008 Intel Corporation
3 * All rights reserved.
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 *
8 * -- Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * -- Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * -- Neither the name of the Intel Corporation nor the names of its
14 * contributors may be used to endorse or promote products derived from
15 * this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
20 * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE INTEL OR ITS
21 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
22 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
23 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
24 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
25 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
26 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
27 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 */
29
30using System;
31using System.Collections.Generic;
32using System.Net;
33using OpenMetaverse;
34using OpenMetaverse.StructuredData;
35using OpenSim.Framework;
36
37namespace AssetServer
38{
39 /// <summary>
40 /// Response from a call to a backend provider
41 /// </summary>
42 public enum BackendResponse
43 {
44 /// <summary>The call succeeded</summary>
45 Success,
46 /// <summary>The resource requested was not found</summary>
47 NotFound,
48 /// <summary>A server failure prevented the call from
49 /// completing</summary>
50 Failure
51 }
52
53 public class AssetServerPluginInitialiser : PluginInitialiserBase
54 {
55 private AssetServer server;
56
57 public AssetServerPluginInitialiser (AssetServer server)
58 {
59 this.server = server;
60 }
61
62 public override void Initialise (IPlugin plugin)
63 {
64 IAssetServerPlugin p = plugin as IAssetServerPlugin;
65 p.Initialise (server);
66 }
67 }
68
69 #region Interfaces
70
71 public interface IAssetServerPlugin : IPlugin
72 {
73 void Initialise(AssetServer server);
74 }
75
76 public interface IStorageProvider
77 {
78 BackendResponse TryFetchMetadata(UUID assetID, out Metadata metadata);
79 BackendResponse TryFetchData(UUID assetID, out byte[] assetData);
80 BackendResponse TryFetchDataMetadata(UUID assetID, out Metadata metadata, out byte[] assetData);
81 BackendResponse TryCreateAsset(Metadata metadata, byte[] assetData);
82 BackendResponse TryCreateAsset(Metadata metadata, byte[] assetData, out UUID assetID);
83 int ForEach(Action<Metadata> action, int start, int count);
84 }
85
86 public interface IAssetStorageProvider : IAssetServerPlugin
87 {
88 BackendResponse TryFetchMetadata(UUID assetID, out Metadata metadata);
89 BackendResponse TryFetchData(UUID assetID, out byte[] assetData);
90 BackendResponse TryFetchDataMetadata(UUID assetID, out Metadata metadata, out byte[] assetData);
91 BackendResponse TryCreateAsset(Metadata metadata, byte[] assetData);
92 BackendResponse TryCreateAsset(Metadata metadata, byte[] assetData, out UUID assetID);
93 int ForEach(Action<Metadata> action, int start, int count);
94 }
95
96 public interface IInventoryProvider
97 {
98 BackendResponse TryFetchItem(Uri owner, UUID itemID, out InventoryItem item);
99 BackendResponse TryFetchFolder(Uri owner, UUID folderID, out InventoryFolder folder);
100 BackendResponse TryFetchFolderContents(Uri owner, UUID folderID, out InventoryCollection contents);
101 BackendResponse TryFetchFolderList(Uri owner, out List<InventoryFolder> folders);
102 BackendResponse TryFetchInventory(Uri owner, out InventoryCollection inventory);
103
104 BackendResponse TryFetchActiveGestures(Uri owner, out List<InventoryItem> gestures);
105
106 BackendResponse TryCreateItem(Uri owner, InventoryItem item);
107 BackendResponse TryCreateFolder(Uri owner, InventoryFolder folder);
108 BackendResponse TryCreateInventory(Uri owner, InventoryFolder rootFolder);
109
110 BackendResponse TryDeleteItem(Uri owner, UUID itemID);
111 BackendResponse TryDeleteFolder(Uri owner, UUID folderID);
112 BackendResponse TryPurgeFolder(Uri owner, UUID folderID);
113 }
114
115 public interface IAuthenticationProvider
116 {
117 void AddIdentifier(UUID authToken, Uri identifier);
118 bool RemoveIdentifier(UUID authToken);
119 bool TryGetIdentifier(UUID authToken, out Uri identifier);
120 }
121
122 public interface IAuthorizationProvider
123 {
124 bool IsMetadataAuthorized(UUID authToken, UUID assetID);
125 /// <summary>
126 /// Authorizes access to the data for an asset. Access to asset data
127 /// also implies access to the metadata for that asset
128 /// </summary>
129 /// <param name="authToken">Authentication token to check for access</param>
130 /// <param name="assetID">ID of the requested asset</param>
131 /// <returns>True if access is granted, otherwise false</returns>
132 bool IsDataAuthorized(UUID authToken, UUID assetID);
133 bool IsCreateAuthorized(UUID authToken);
134
135 bool IsInventoryReadAuthorized(UUID authToken, Uri owner);
136 bool IsInventoryWriteAuthorized(UUID authToken, Uri owner);
137 }
138
139 public interface IMetricsProvider
140 {
141 void LogAssetMetadataFetch(string extension, BackendResponse response, UUID assetID, DateTime time);
142 void LogAssetDataFetch(string extension, BackendResponse response, UUID assetID, int dataSize, DateTime time);
143 void LogAssetCreate(string extension, BackendResponse response, UUID assetID, int dataSize, DateTime time);
144
145 void LogInventoryFetch(string extension, BackendResponse response, Uri owner, UUID objID, bool folder, DateTime time);
146 void LogInventoryFetchFolderContents(string extension, BackendResponse response, Uri owner, UUID folderID, DateTime time);
147 void LogInventoryFetchFolderList(string extension, BackendResponse response, Uri owner, DateTime time);
148 void LogInventoryFetchInventory(string extension, BackendResponse response, Uri owner, DateTime time);
149 void LogInventoryFetchActiveGestures(string extension, BackendResponse response, Uri owner, DateTime time);
150 void LogInventoryCreate(string extension, BackendResponse response, Uri owner, bool folder, DateTime time);
151 void LogInventoryCreateInventory(string extension, BackendResponse response, DateTime time);
152 void LogInventoryDelete(string extension, BackendResponse response, Uri owner, UUID objID, bool folder, DateTime time);
153 void LogInventoryPurgeFolder(string extension, BackendResponse response, Uri owner, UUID folderID, DateTime time);
154 }
155
156 #endregion Interfaces
157}