Change existing IAR save to use UUID for its callback reference instead of Guid. This is for uniformity as discussed on IRC.

mb-throttle-test
AliciaRaven 2014-09-06 05:19:12 +01:00 committed by Justin Clark-Casey (justincc)
parent 3bde737f76
commit 08675d44a7
6 changed files with 21 additions and 20 deletions

View File

@ -80,7 +80,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
/// <value> /// <value>
/// ID of this request /// ID of this request
/// </value> /// </value>
protected Guid m_id; protected UUID m_id;
/// <value> /// <value>
/// Used to collect the uuids of the assets that we need to save into the archive /// 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 /// Constructor
/// </summary> /// </summary>
public InventoryArchiveWriteRequest( public InventoryArchiveWriteRequest(
Guid id, InventoryArchiverModule module, Scene scene, UUID id, InventoryArchiverModule module, Scene scene,
UserAccount userInfo, string invPath, string savePath) UserAccount userInfo, string invPath, string savePath)
: this( : this(
id, id,
@ -117,7 +117,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
/// Constructor /// Constructor
/// </summary> /// </summary>
public InventoryArchiveWriteRequest( public InventoryArchiveWriteRequest(
Guid id, InventoryArchiverModule module, Scene scene, UUID id, InventoryArchiverModule module, Scene scene,
UserAccount userInfo, string invPath, Stream saveStream) UserAccount userInfo, string invPath, Stream saveStream)
{ {
m_id = id; m_id = id;

View File

@ -66,7 +66,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
/// <value> /// <value>
/// Pending save completions initiated from the console /// Pending save completions initiated from the console
/// </value> /// </value>
protected List<Guid> m_pendingConsoleSaves = new List<Guid>(); protected List<UUID> m_pendingConsoleSaves = new List<UUID>();
/// <value> /// <value>
/// All scenes that this module knows about /// All scenes that this module knows about
@ -175,7 +175,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
/// Trigger the inventory archive saved event. /// Trigger the inventory archive saved event.
/// </summary> /// </summary>
protected internal void TriggerInventoryArchiveSaved( 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) Exception reportedException)
{ {
InventoryArchiveSaved handlerInventoryArchiveSaved = OnInventoryArchiveSaved; InventoryArchiveSaved handlerInventoryArchiveSaved = OnInventoryArchiveSaved;
@ -184,13 +184,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
} }
public bool ArchiveInventory( 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<string, object>()); return ArchiveInventory(id, firstName, lastName, invPath, pass, saveStream, new Dictionary<string, object>());
} }
public bool ArchiveInventory( 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<string, object> options) Dictionary<string, object> options)
{ {
if (m_scenes.Count > 0) if (m_scenes.Count > 0)
@ -230,7 +230,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
} }
public bool ArchiveInventory( 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<string, object> options) Dictionary<string, object> options)
{ {
// if (!ConsoleUtil.CheckFileDoesNotExist(MainConsole.Instance, savePath)) // if (!ConsoleUtil.CheckFileDoesNotExist(MainConsole.Instance, savePath))
@ -417,7 +417,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
/// <param name="cmdparams"></param> /// <param name="cmdparams"></param>
protected void HandleSaveInvConsoleCommand(string module, string[] cmdparams) protected void HandleSaveInvConsoleCommand(string module, string[] cmdparams)
{ {
Guid id = Guid.NewGuid(); UUID id = UUID.Random();
Dictionary<string, object> options = new Dictionary<string, object>(); Dictionary<string, object> options = new Dictionary<string, object>();
@ -477,7 +477,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
} }
private void SaveInvConsoleCommandCompleted( 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) Exception reportedException)
{ {
lock (m_pendingConsoleSaves) lock (m_pendingConsoleSaves)

View File

@ -180,7 +180,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
mre.Reset(); mre.Reset();
archiverModule.ArchiveInventory( archiverModule.ArchiveInventory(
Guid.NewGuid(), userFirstName, userLastName, "Objects", userPassword, archiveWriteStream); UUID.Random(), userFirstName, userLastName, "Objects", userPassword, archiveWriteStream);
mre.WaitOne(60000, false); mre.WaitOne(60000, false);
// LOAD ITEM // LOAD ITEM

View File

@ -110,7 +110,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
mre.Reset(); mre.Reset();
m_archiverModule.ArchiveInventory( m_archiverModule.ArchiveInventory(
Guid.NewGuid(), userFirstName, userLastName, "/", userPassword, archiveWriteStream); UUID.Random(), userFirstName, userLastName, "/", userPassword, archiveWriteStream);
mre.WaitOne(60000, false); mre.WaitOne(60000, false);
// Test created iar // Test created iar
@ -179,7 +179,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
mre.Reset(); mre.Reset();
m_archiverModule.ArchiveInventory( m_archiverModule.ArchiveInventory(
Guid.NewGuid(), userFirstName, userLastName, "f1", userPassword, archiveWriteStream); UUID.Random(), userFirstName, userLastName, "f1", userPassword, archiveWriteStream);
mre.WaitOne(60000, false); mre.WaitOne(60000, false);
// Test created iar // Test created iar
@ -267,7 +267,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
mre.Reset(); mre.Reset();
m_archiverModule.ArchiveInventory( m_archiverModule.ArchiveInventory(
Guid.NewGuid(), userFirstName, userLastName, "Objects/" + item1Name, userPassword, archiveWriteStream); UUID.Random(), userFirstName, userLastName, "Objects/" + item1Name, userPassword, archiveWriteStream);
mre.WaitOne(60000, false); mre.WaitOne(60000, false);
byte[] archive = archiveWriteStream.ToArray(); 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. // When we're not saving assets, archiving is being done synchronously.
m_archiverModule.ArchiveInventory( 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(); byte[] archive = archiveWriteStream.ToArray();
MemoryStream archiveReadStream = new MemoryStream(archive); MemoryStream archiveReadStream = new MemoryStream(archive);

View File

@ -163,13 +163,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
scene.AddInventoryItem(coaItem); scene.AddInventoryItem(coaItem);
archiverModule.ArchiveInventory( 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(); m_iarStreamBytes = archiveWriteStream.ToArray();
} }
protected void SaveCompleted( 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) Exception reportedException)
{ {
mre.Set(); mre.Set();

View File

@ -29,6 +29,7 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using OpenSim.Services.Interfaces; using OpenSim.Services.Interfaces;
using OpenMetaverse;
namespace OpenSim.Region.Framework.Interfaces namespace OpenSim.Region.Framework.Interfaces
{ {
@ -42,7 +43,7 @@ namespace OpenSim.Region.Framework.Interfaces
/// <param name="savePath">The stream to which the archive was saved</param> /// <param name="savePath">The stream to which the archive was saved</param>
/// <param name="reportedException">Contains the exception generated if the save did not succeed</param> /// <param name="reportedException">Contains the exception generated if the save did not succeed</param>
public delegate void InventoryArchiveSaved( 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 public interface IInventoryArchiverModule
{ {
@ -84,7 +85,7 @@ namespace OpenSim.Region.Framework.Interfaces
/// <param name="invPath">The inventory path from which the inventory should be saved.</param> /// <param name="invPath">The inventory path from which the inventory should be saved.</param>
/// <param name="saveStream">The stream to which the inventory archive will be saved</param> /// <param name="saveStream">The stream to which the inventory archive will be saved</param>
/// <returns>true if the first stage of the operation succeeded, false otherwise</returns> /// <returns>true if the first stage of the operation succeeded, false otherwise</returns>
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);
/// <summary> /// <summary>
/// Archive a user's inventory folder to the given stream /// Archive a user's inventory folder to the given stream
@ -97,7 +98,7 @@ namespace OpenSim.Region.Framework.Interfaces
/// <param name="options">Archiving options. Currently, there are none.</param> /// <param name="options">Archiving options. Currently, there are none.</param>
/// <returns>true if the first stage of the operation succeeded, false otherwise</returns> /// <returns>true if the first stage of the operation succeeded, false otherwise</returns>
bool ArchiveInventory( 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<string, object> options); Dictionary<string, object> options);
} }
} }