From 08675d44a754156ecdfd09d01ae1209bf73e2533 Mon Sep 17 00:00:00 2001 From: AliciaRaven Date: Sat, 6 Sep 2014 05:19:12 +0100 Subject: [PATCH] Change existing IAR save to use UUID for its callback reference instead of Guid. This is for uniformity as discussed on IRC. --- .../Archiver/InventoryArchiveWriteRequest.cs | 6 +++--- .../Inventory/Archiver/InventoryArchiverModule.cs | 14 +++++++------- .../Tests/InventoryArchiveLoadPathTests.cs | 2 +- .../Archiver/Tests/InventoryArchiveSaveTests.cs | 8 ++++---- .../Archiver/Tests/InventoryArchiveTestCase.cs | 4 ++-- .../Interfaces/IInventoryArchiverModule.cs | 7 ++++--- 6 files changed, 21 insertions(+), 20 deletions(-) diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs index ce81deb598..0605db5ae3 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs @@ -80,7 +80,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver /// /// ID of this request /// - protected Guid m_id; + protected UUID m_id; /// /// Used to collect the uuids of the assets that we need to save into the archive @@ -101,7 +101,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver /// Constructor /// public InventoryArchiveWriteRequest( - Guid id, InventoryArchiverModule module, Scene scene, + UUID id, InventoryArchiverModule module, Scene scene, UserAccount userInfo, string invPath, string savePath) : this( id, @@ -117,7 +117,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver /// Constructor /// public InventoryArchiveWriteRequest( - Guid id, InventoryArchiverModule module, Scene scene, + UUID id, InventoryArchiverModule module, Scene scene, UserAccount userInfo, string invPath, Stream saveStream) { m_id = id; diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs index dc67738d96..0e4d79c47f 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs @@ -66,7 +66,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver /// /// Pending save completions initiated from the console /// - protected List m_pendingConsoleSaves = new List(); + protected List m_pendingConsoleSaves = new List(); /// /// All scenes that this module knows about @@ -175,7 +175,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver /// Trigger the inventory archive saved event. /// protected internal void TriggerInventoryArchiveSaved( - Guid id, bool succeeded, UserAccount userInfo, string invPath, Stream saveStream, + UUID id, bool succeeded, UserAccount userInfo, string invPath, Stream saveStream, Exception reportedException) { InventoryArchiveSaved handlerInventoryArchiveSaved = OnInventoryArchiveSaved; @@ -184,13 +184,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver } public bool ArchiveInventory( - Guid id, string firstName, string lastName, string invPath, string pass, Stream saveStream) + UUID id, string firstName, string lastName, string invPath, string pass, Stream saveStream) { return ArchiveInventory(id, firstName, lastName, invPath, pass, saveStream, new Dictionary()); } public bool ArchiveInventory( - Guid id, string firstName, string lastName, string invPath, string pass, Stream saveStream, + UUID id, string firstName, string lastName, string invPath, string pass, Stream saveStream, Dictionary options) { if (m_scenes.Count > 0) @@ -230,7 +230,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver } public bool ArchiveInventory( - Guid id, string firstName, string lastName, string invPath, string pass, string savePath, + UUID id, string firstName, string lastName, string invPath, string pass, string savePath, Dictionary options) { // if (!ConsoleUtil.CheckFileDoesNotExist(MainConsole.Instance, savePath)) @@ -417,7 +417,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver /// protected void HandleSaveInvConsoleCommand(string module, string[] cmdparams) { - Guid id = Guid.NewGuid(); + UUID id = UUID.Random(); Dictionary options = new Dictionary(); @@ -477,7 +477,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver } private void SaveInvConsoleCommandCompleted( - Guid id, bool succeeded, UserAccount userInfo, string invPath, Stream saveStream, + UUID id, bool succeeded, UserAccount userInfo, string invPath, Stream saveStream, Exception reportedException) { lock (m_pendingConsoleSaves) diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveLoadPathTests.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveLoadPathTests.cs index 08f199adae..dabece3abc 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveLoadPathTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveLoadPathTests.cs @@ -180,7 +180,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests mre.Reset(); archiverModule.ArchiveInventory( - Guid.NewGuid(), userFirstName, userLastName, "Objects", userPassword, archiveWriteStream); + UUID.Random(), userFirstName, userLastName, "Objects", userPassword, archiveWriteStream); mre.WaitOne(60000, false); // LOAD ITEM diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveSaveTests.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveSaveTests.cs index b85739eba5..254aa114ec 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveSaveTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveSaveTests.cs @@ -110,7 +110,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests mre.Reset(); m_archiverModule.ArchiveInventory( - Guid.NewGuid(), userFirstName, userLastName, "/", userPassword, archiveWriteStream); + UUID.Random(), userFirstName, userLastName, "/", userPassword, archiveWriteStream); mre.WaitOne(60000, false); // Test created iar @@ -179,7 +179,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests mre.Reset(); m_archiverModule.ArchiveInventory( - Guid.NewGuid(), userFirstName, userLastName, "f1", userPassword, archiveWriteStream); + UUID.Random(), userFirstName, userLastName, "f1", userPassword, archiveWriteStream); mre.WaitOne(60000, false); // Test created iar @@ -267,7 +267,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests mre.Reset(); m_archiverModule.ArchiveInventory( - Guid.NewGuid(), userFirstName, userLastName, "Objects/" + item1Name, userPassword, archiveWriteStream); + UUID.Random(), userFirstName, userLastName, "Objects/" + item1Name, userPassword, archiveWriteStream); mre.WaitOne(60000, false); byte[] archive = archiveWriteStream.ToArray(); @@ -364,7 +364,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests // When we're not saving assets, archiving is being done synchronously. m_archiverModule.ArchiveInventory( - Guid.NewGuid(), userFirstName, userLastName, "Objects/" + item1Name, userPassword, archiveWriteStream, options); + UUID.Random(), userFirstName, userLastName, "Objects/" + item1Name, userPassword, archiveWriteStream, options); byte[] archive = archiveWriteStream.ToArray(); MemoryStream archiveReadStream = new MemoryStream(archive); diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveTestCase.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveTestCase.cs index db78da9ae6..cc746d5e60 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveTestCase.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveTestCase.cs @@ -163,13 +163,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests scene.AddInventoryItem(coaItem); archiverModule.ArchiveInventory( - Guid.NewGuid(), m_uaLL1.FirstName, m_uaLL1.LastName, "/*", "hampshire", archiveWriteStream); + UUID.Random(), m_uaLL1.FirstName, m_uaLL1.LastName, "/*", "hampshire", archiveWriteStream); m_iarStreamBytes = archiveWriteStream.ToArray(); } protected void SaveCompleted( - Guid id, bool succeeded, UserAccount userInfo, string invPath, Stream saveStream, + UUID id, bool succeeded, UserAccount userInfo, string invPath, Stream saveStream, Exception reportedException) { mre.Set(); diff --git a/OpenSim/Region/Framework/Interfaces/IInventoryArchiverModule.cs b/OpenSim/Region/Framework/Interfaces/IInventoryArchiverModule.cs index ddf7565945..54251a4262 100644 --- a/OpenSim/Region/Framework/Interfaces/IInventoryArchiverModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IInventoryArchiverModule.cs @@ -29,6 +29,7 @@ using System; using System.Collections.Generic; using System.IO; using OpenSim.Services.Interfaces; +using OpenMetaverse; namespace OpenSim.Region.Framework.Interfaces { @@ -42,7 +43,7 @@ namespace OpenSim.Region.Framework.Interfaces /// The stream to which the archive was saved /// Contains the exception generated if the save did not succeed public delegate void InventoryArchiveSaved( - Guid id, bool succeeded, UserAccount userInfo, string invPath, Stream saveStream, Exception reportedException); + UUID id, bool succeeded, UserAccount userInfo, string invPath, Stream saveStream, Exception reportedException); public interface IInventoryArchiverModule { @@ -84,7 +85,7 @@ namespace OpenSim.Region.Framework.Interfaces /// The inventory path from which the inventory should be saved. /// The stream to which the inventory archive will be saved /// true if the first stage of the operation succeeded, false otherwise - bool ArchiveInventory(Guid id, string firstName, string lastName, string invPath, string pass, Stream saveStream); + bool ArchiveInventory(UUID id, string firstName, string lastName, string invPath, string pass, Stream saveStream); /// /// Archive a user's inventory folder to the given stream @@ -97,7 +98,7 @@ namespace OpenSim.Region.Framework.Interfaces /// Archiving options. Currently, there are none. /// true if the first stage of the operation succeeded, false otherwise bool ArchiveInventory( - Guid id, string firstName, string lastName, string invPath, string pass, Stream saveStream, + UUID id, string firstName, string lastName, string invPath, string pass, Stream saveStream, Dictionary options); } }