Annotation of /trunk/AssetServer/Interfaces.cs
Parent Directory
|
Revision Log
Revision 70 - (view) (download)
| 1 : | jhurliman | 48 | /* |
| 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 : | |||
| 30 : | using System; | ||
| 31 : | using System.Collections.Generic; | ||
| 32 : | using System.Net; | ||
| 33 : | using OpenMetaverse; | ||
| 34 : | using OpenMetaverse.StructuredData; | ||
| 35 : | |||
| 36 : | namespace AssetServer | ||
| 37 : | { | ||
| 38 : | /// <summary> | ||
| 39 : | jhurliman | 70 | /// Response from a call to a backend provider |
| 40 : | jhurliman | 48 | /// </summary> |
| 41 : | jhurliman | 70 | public enum BackendResponse |
| 42 : | jhurliman | 48 | { |
| 43 : | jhurliman | 70 | /// <summary>The call succeeded</summary> |
| 44 : | jhurliman | 48 | Success, |
| 45 : | /// <summary>The resource requested was not found</summary> | ||
| 46 : | NotFound, | ||
| 47 : | jhurliman | 70 | /// <summary>A server failure prevented the call from |
| 48 : | jhurliman | 48 | /// completing</summary> |
| 49 : | Failure | ||
| 50 : | } | ||
| 51 : | |||
| 52 : | #region Interfaces | ||
| 53 : | |||
| 54 : | public interface IStorageProvider | ||
| 55 : | { | ||
| 56 : | jhurliman | 70 | BackendResponse TryFetchMetadata(UUID assetID, out Metadata metadata); |
| 57 : | BackendResponse TryFetchData(UUID assetID, out byte[] assetData); | ||
| 58 : | BackendResponse TryFetchDataMetadata(UUID assetID, out Metadata metadata, out byte[] assetData); | ||
| 59 : | BackendResponse TryCreateAsset(Metadata metadata, byte[] assetData); | ||
| 60 : | BackendResponse TryCreateAsset(Metadata metadata, byte[] assetData, out UUID assetID); | ||
| 61 : | jhurliman | 69 | int ForEach(Action<Metadata> action, int start, int count); |
| 62 : | jhurliman | 48 | } |
| 63 : | |||
| 64 : | public interface IInventoryProvider | ||
| 65 : | { | ||
| 66 : | jhurliman | 70 | BackendResponse TryFetchItem(Uri owner, UUID itemID, out InventoryItem item); |
| 67 : | BackendResponse TryFetchFolder(Uri owner, UUID folderID, out InventoryFolder folder); | ||
| 68 : | BackendResponse TryFetchFolderContents(Uri owner, UUID folderID, out InventoryCollection contents); | ||
| 69 : | BackendResponse TryFetchFolderList(Uri owner, out List<InventoryFolder> folders); | ||
| 70 : | BackendResponse TryFetchInventory(Uri owner, out InventoryCollection inventory); | ||
| 71 : | jhurliman | 48 | |
| 72 : | jhurliman | 70 | BackendResponse TryFetchActiveGestures(Uri owner, out List<InventoryItem> gestures); |
| 73 : | jhurliman | 48 | |
| 74 : | jhurliman | 70 | BackendResponse TryCreateItem(Uri owner, InventoryItem item); |
| 75 : | BackendResponse TryCreateFolder(Uri owner, InventoryFolder folder); | ||
| 76 : | BackendResponse TryCreateInventory(Uri owner, InventoryFolder rootFolder); | ||
| 77 : | jhurliman | 48 | |
| 78 : | jhurliman | 70 | BackendResponse TryDeleteItem(Uri owner, UUID itemID); |
| 79 : | BackendResponse TryDeleteFolder(Uri owner, UUID folderID); | ||
| 80 : | BackendResponse TryPurgeFolder(Uri owner, UUID folderID); | ||
| 81 : | jhurliman | 48 | } |
| 82 : | |||
| 83 : | public interface IAuthenticationProvider | ||
| 84 : | { | ||
| 85 : | void AddIdentifier(UUID authToken, Uri identifier); | ||
| 86 : | bool RemoveIdentifier(UUID authToken); | ||
| 87 : | bool TryGetIdentifier(UUID authToken, out Uri identifier); | ||
| 88 : | } | ||
| 89 : | |||
| 90 : | public interface IAuthorizationProvider | ||
| 91 : | { | ||
| 92 : | bool IsMetadataAuthorized(UUID authToken, UUID assetID); | ||
| 93 : | /// <summary> | ||
| 94 : | /// Authorizes access to the data for an asset. Access to asset data | ||
| 95 : | /// also implies access to the metadata for that asset | ||
| 96 : | /// </summary> | ||
| 97 : | /// <param name="authToken">Authentication token to check for access</param> | ||
| 98 : | /// <param name="assetID">ID of the requested asset</param> | ||
| 99 : | /// <returns>True if access is granted, otherwise false</returns> | ||
| 100 : | bool IsDataAuthorized(UUID authToken, UUID assetID); | ||
| 101 : | bool IsCreateAuthorized(UUID authToken); | ||
| 102 : | |||
| 103 : | jhurliman | 51 | bool IsInventoryReadAuthorized(UUID authToken, Uri owner); |
| 104 : | bool IsInventoryWriteAuthorized(UUID authToken, Uri owner); | ||
| 105 : | jhurliman | 48 | } |
| 106 : | |||
| 107 : | public interface IMetricsProvider | ||
| 108 : | { | ||
| 109 : | jhurliman | 70 | void LogAssetMetadataFetch(string extension, BackendResponse response, UUID assetID, DateTime time); |
| 110 : | void LogAssetDataFetch(string extension, BackendResponse response, UUID assetID, int dataSize, DateTime time); | ||
| 111 : | void LogAssetCreate(string extension, BackendResponse response, UUID assetID, int dataSize, DateTime time); | ||
| 112 : | jhurliman | 48 | |
| 113 : | jhurliman | 70 | void LogInventoryFetch(string extension, BackendResponse response, Uri owner, UUID objID, bool folder, DateTime time); |
| 114 : | void LogInventoryFetchFolderContents(string extension, BackendResponse response, Uri owner, UUID folderID, DateTime time); | ||
| 115 : | void LogInventoryFetchFolderList(string extension, BackendResponse response, Uri owner, DateTime time); | ||
| 116 : | void LogInventoryFetchInventory(string extension, BackendResponse response, Uri owner, DateTime time); | ||
| 117 : | void LogInventoryFetchActiveGestures(string extension, BackendResponse response, Uri owner, DateTime time); | ||
| 118 : | void LogInventoryCreate(string extension, BackendResponse response, Uri owner, bool folder, DateTime time); | ||
| 119 : | void LogInventoryCreateInventory(string extension, BackendResponse response, DateTime time); | ||
| 120 : | void LogInventoryDelete(string extension, BackendResponse response, Uri owner, UUID objID, bool folder, DateTime time); | ||
| 121 : | void LogInventoryPurgeFolder(string extension, BackendResponse response, Uri owner, UUID folderID, DateTime time); | ||
| 122 : | jhurliman | 48 | } |
| 123 : | |||
| 124 : | #endregion Interfaces | ||
| 125 : | } |
| ViewVC Help | |
| Powered by ViewVC 1.0.0 |

