Add an event callback for loading IAR files. The callback for creating them already existed but not for loading. This is of interest for use by region modules. Also includes reporting numbers of items saved and items filtered to the completed log printout.

mb-throttle-test
AliciaRaven 2014-09-06 20:23:40 +01:00 committed by Justin Clark-Casey (justincc)
parent 08675d44a7
commit 5bc3bbbcf3
9 changed files with 159 additions and 50 deletions

View File

@ -61,6 +61,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
private UserAccount m_userInfo;
private string m_invPath;
/// <value>
/// ID of this request
/// </value>
protected UUID m_id;
/// <summary>
/// Do we want to merge this load with existing inventory?
@ -71,6 +76,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
protected IAssetService m_AssetService;
protected IUserAccountService m_UserAccountService;
private InventoryArchiverModule m_module;
/// <value>
/// The stream from which the inventory archive will be loaded.
/// </value>
@ -117,9 +124,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
protected Dictionary<UUID, UUID> m_creatorIdForAssetId = new Dictionary<UUID, UUID>();
public InventoryArchiveReadRequest(
IInventoryService inv, IAssetService assets, IUserAccountService uacc, UserAccount userInfo, string invPath, string loadPath, bool merge)
UUID id, IInventoryService inv, InventoryArchiverModule module, IAssetService assets, IUserAccountService uacc, UserAccount userInfo, string invPath, string loadPath, bool merge)
: this(
id,
inv,
module,
assets,
uacc,
userInfo,
@ -130,8 +139,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
}
public InventoryArchiveReadRequest(
IInventoryService inv, IAssetService assets, IUserAccountService uacc, UserAccount userInfo, string invPath, Stream loadStream, bool merge)
UUID id, IInventoryService inv, InventoryArchiverModule module, IAssetService assets, IUserAccountService uacc, UserAccount userInfo, string invPath, Stream loadStream, bool merge)
{
m_id = id;
m_InventoryService = inv;
m_AssetService = assets;
m_UserAccountService = uacc;
@ -139,6 +149,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
m_userInfo = userInfo;
m_invPath = invPath;
m_loadStream = loadStream;
m_module = module;
// FIXME: Do not perform this check since older versions of OpenSim do save the control file after other things
// (I thought they weren't). We will need to bump the version number and perform this check on all
@ -161,6 +172,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
{
try
{
Exception reportedException = null;
string filePath = "ERROR";
List<InventoryFolderBase> folderCandidates
@ -197,14 +210,25 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
}
archive.Close();
m_log.DebugFormat(
"[INVENTORY ARCHIVER]: Successfully loaded {0} assets with {1} failures",
m_successfulAssetRestores, m_failedAssetRestores);
m_log.InfoFormat("[INVENTORY ARCHIVER]: Successfully loaded {0} items", m_successfulItemRestores);
//Alicia: When this is called by LibraryModule or Tests, m_module will be null as event is not required
if(m_module != null)
m_module.TriggerInventoryArchiveLoaded(m_id, true, m_userInfo, m_invPath, m_loadStream, reportedException, m_successfulItemRestores);
return m_loadedNodes;
}
catch(Exception Ex)
{
// Trigger saved event with failed result and exception data
if (m_module != null)
m_module.TriggerInventoryArchiveLoaded(m_id, false, m_userInfo, m_invPath, m_loadStream, Ex, 0);
return m_loadedNodes;
}
finally
{
m_loadStream.Close();

View File

@ -61,6 +61,16 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
/// </summary>
public string FilterContent { get; set; }
/// <summary>
/// Counter for inventory items saved to archive for passing to compltion event
/// </summary>
public int CountItems { get; set; }
/// <summary>
/// Counter for inventory items skipped due to permission filter option for passing to compltion event
/// </summary>
public int CountFiltered { get; set; }
/// <value>
/// Used to select all inventory nodes in a folder but not the folder itself
/// </value>
@ -158,7 +168,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
}
m_module.TriggerInventoryArchiveSaved(
m_id, succeeded, m_userInfo, m_invPath, m_saveStream, reportedException);
m_id, succeeded, m_userInfo, m_invPath, m_saveStream, reportedException, CountItems, CountFiltered);
}
protected void SaveInvItem(InventoryItemBase inventoryItem, string path, Dictionary<string, object> options, IUserAccountService userAccountService)
@ -174,6 +184,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
"[INVENTORY ARCHIVER]: Skipping inventory item {0} {1} at {2}",
inventoryItem.Name, inventoryItem.ID, path);
}
CountFiltered++;
return;
}
}
@ -184,6 +197,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
m_log.InfoFormat(
"[INVENTORY ARCHIVER]: Insufficient permissions, skipping inventory item {0} {1} at {2}",
inventoryItem.Name, inventoryItem.ID, path);
// Count Items Excluded
CountFiltered++;
return;
}
@ -202,6 +219,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
AssetType itemAssetType = (AssetType)inventoryItem.AssetType;
// Count inventory items (different to asset count)
CountItems++;
// Don't chase down link asset items as they actually point to their target item IDs rather than an asset
if (SaveAssets && itemAssetType != AssetType.Link && itemAssetType != AssetType.LinkFolder)
m_assetGatherer.GatherAssetUuids(inventoryItem.AssetID, (sbyte)inventoryItem.AssetType, m_assetUuids);
@ -363,7 +383,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
// We couldn't find the path indicated
string errorMessage = string.Format("Aborted save. Could not find inventory path {0}", m_invPath);
Exception e = new InventoryArchiverException(errorMessage);
m_module.TriggerInventoryArchiveSaved(m_id, false, m_userInfo, m_invPath, m_saveStream, e);
m_module.TriggerInventoryArchiveSaved(m_id, false, m_userInfo, m_invPath, m_saveStream, e, 0, 0);
throw e;
}

View File

@ -57,6 +57,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
// public bool DisablePresenceChecks { get; set; }
public event InventoryArchiveSaved OnInventoryArchiveSaved;
public event InventoryArchiveLoaded OnInventoryArchiveLoaded;
/// <summary>
/// The file to load and save inventory if no filename has been specified
@ -64,9 +65,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
protected const string DEFAULT_INV_BACKUP_FILENAME = "user-inventory.iar";
/// <value>
/// Pending save completions initiated from the console
/// Pending save and load completions initiated from the console
/// </value>
protected List<UUID> m_pendingConsoleSaves = new List<UUID>();
protected List<UUID> m_pendingConsoleTasks = new List<UUID>();
/// <value>
/// All scenes that this module knows about
@ -111,6 +112,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
{
scene.RegisterModuleInterface<IInventoryArchiverModule>(this);
OnInventoryArchiveSaved += SaveInvConsoleCommandCompleted;
OnInventoryArchiveLoaded += LoadInvConsoleCommandCompleted;
scene.AddCommand(
"Archiving", this, "load iar",
@ -176,11 +178,23 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
/// </summary>
protected internal void TriggerInventoryArchiveSaved(
UUID id, bool succeeded, UserAccount userInfo, string invPath, Stream saveStream,
Exception reportedException)
Exception reportedException, int SaveCount, int FilterCount)
{
InventoryArchiveSaved handlerInventoryArchiveSaved = OnInventoryArchiveSaved;
if (handlerInventoryArchiveSaved != null)
handlerInventoryArchiveSaved(id, succeeded, userInfo, invPath, saveStream, reportedException);
handlerInventoryArchiveSaved(id, succeeded, userInfo, invPath, saveStream, reportedException, SaveCount , FilterCount);
}
/// <summary>
/// Trigger the inventory archive loaded event.
/// </summary>
protected internal void TriggerInventoryArchiveLoaded(
UUID id, bool succeeded, UserAccount userInfo, string invPath, Stream loadStream,
Exception reportedException, int LoadCount)
{
InventoryArchiveLoaded handlerInventoryArchiveLoaded = OnInventoryArchiveLoaded;
if (handlerInventoryArchiveLoaded != null)
handlerInventoryArchiveLoaded(id, succeeded, userInfo, invPath, loadStream, reportedException, LoadCount);
}
public bool ArchiveInventory(
@ -272,13 +286,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
return false;
}
public bool DearchiveInventory(string firstName, string lastName, string invPath, string pass, Stream loadStream)
public bool DearchiveInventory(UUID id, string firstName, string lastName, string invPath, string pass, Stream loadStream)
{
return DearchiveInventory(firstName, lastName, invPath, pass, loadStream, new Dictionary<string, object>());
return DearchiveInventory(id, firstName, lastName, invPath, pass, loadStream, new Dictionary<string, object>());
}
public bool DearchiveInventory(
string firstName, string lastName, string invPath, string pass, Stream loadStream,
UUID id, string firstName, string lastName, string invPath, string pass, Stream loadStream,
Dictionary<string, object> options)
{
if (m_scenes.Count > 0)
@ -294,7 +308,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
try
{
request = new InventoryArchiveReadRequest(m_aScene.InventoryService, m_aScene.AssetService, m_aScene.UserAccountService, userInfo, invPath, loadStream, merge);
request = new InventoryArchiveReadRequest(id, m_aScene.InventoryService, this, m_aScene.AssetService, m_aScene.UserAccountService, userInfo, invPath, loadStream, merge);
}
catch (EntryPointNotFoundException e)
{
@ -326,7 +340,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
}
public bool DearchiveInventory(
string firstName, string lastName, string invPath, string pass, string loadPath,
UUID id, string firstName, string lastName, string invPath, string pass, string loadPath,
Dictionary<string, object> options)
{
if (m_scenes.Count > 0)
@ -342,7 +356,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
try
{
request = new InventoryArchiveReadRequest(m_aScene.InventoryService, m_aScene.AssetService, m_aScene.UserAccountService, userInfo, invPath, loadPath, merge);
request = new InventoryArchiveReadRequest(id, m_aScene.InventoryService, this, m_aScene.AssetService, m_aScene.UserAccountService, userInfo, invPath, loadPath, merge);
}
catch (EntryPointNotFoundException e)
{
@ -378,6 +392,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
{
try
{
UUID id = UUID.Random();
Dictionary<string, object> options = new Dictionary<string, object>();
OptionSet optionSet = new OptionSet().Add("m|merge", delegate (string v) { options["merge"] = v != null; });
@ -400,10 +416,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
"[INVENTORY ARCHIVER]: Loading archive {0} to inventory path {1} for {2} {3}",
loadPath, invPath, firstName, lastName);
if (DearchiveInventory(firstName, lastName, invPath, pass, loadPath, options))
m_log.InfoFormat(
"[INVENTORY ARCHIVER]: Loaded archive {0} for {1} {2}",
loadPath, firstName, lastName);
lock (m_pendingConsoleTasks)
m_pendingConsoleTasks.Add(id);
DearchiveInventory(id, firstName, lastName, invPath, pass, loadPath, options);
}
catch (InventoryArchiverException e)
{
@ -465,8 +481,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
"[INVENTORY ARCHIVER]: Saving archive {0} using inventory path {1} for {2} {3}",
savePath, invPath, firstName, lastName);
lock (m_pendingConsoleSaves)
m_pendingConsoleSaves.Add(id);
lock (m_pendingConsoleTasks)
m_pendingConsoleTasks.Add(id);
ArchiveInventory(id, firstName, lastName, invPath, pass, savePath, options);
}
@ -478,19 +494,23 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
private void SaveInvConsoleCommandCompleted(
UUID id, bool succeeded, UserAccount userInfo, string invPath, Stream saveStream,
Exception reportedException)
Exception reportedException, int SaveCount, int FilterCount)
{
lock (m_pendingConsoleSaves)
lock (m_pendingConsoleTasks)
{
if (m_pendingConsoleSaves.Contains(id))
m_pendingConsoleSaves.Remove(id);
if (m_pendingConsoleTasks.Contains(id))
m_pendingConsoleTasks.Remove(id);
else
return;
}
if (succeeded)
{
m_log.InfoFormat("[INVENTORY ARCHIVER]: Saved archive for {0} {1}", userInfo.FirstName, userInfo.LastName);
// Report success and include item count and filter count (Skipped items due to --perm or --exclude switches)
if(FilterCount == 0)
m_log.InfoFormat("[INVENTORY ARCHIVER]: Saved archive with {0} items for {1} {2}", SaveCount, userInfo.FirstName, userInfo.LastName);
else
m_log.InfoFormat("[INVENTORY ARCHIVER]: Saved archive with {0} items for {1} {2}. Skipped {3} items due to exclude and/or perm switches", SaveCount, userInfo.FirstName, userInfo.LastName, FilterCount);
}
else
{
@ -500,6 +520,30 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
}
}
private void LoadInvConsoleCommandCompleted(
UUID id, bool succeeded, UserAccount userInfo, string invPath, Stream loadStream,
Exception reportedException, int LoadCount)
{
lock (m_pendingConsoleTasks)
{
if (m_pendingConsoleTasks.Contains(id))
m_pendingConsoleTasks.Remove(id);
else
return;
}
if (succeeded)
{
m_log.InfoFormat("[INVENTORY ARCHIVER]: Loaded {0} items from archive {1} for {2} {3}", LoadCount, invPath, userInfo.FirstName, userInfo.LastName);
}
else
{
m_log.ErrorFormat(
"[INVENTORY ARCHIVER]: Archive load for {0} {1} failed - {2}",
userInfo.FirstName, userInfo.LastName, reportedException.Message);
}
}
/// <summary>
/// Get user information for the given name.
/// </summary>

View File

@ -69,8 +69,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
UserAccountHelpers.CreateUserWithInventory(scene, m_uaMT, "meowfood");
UserAccountHelpers.CreateUserWithInventory(scene, m_uaLL1, "hampshire");
archiverModule.DearchiveInventory(m_uaMT.FirstName, m_uaMT.LastName, "/", "meowfood", m_iarStream);
archiverModule.DearchiveInventory(UUID.Random(), m_uaMT.FirstName, m_uaMT.LastName, "/", "meowfood", m_iarStream);
InventoryItemBase foundItem1
= InventoryArchiveUtils.FindItemByPath(scene.InventoryService, m_uaMT.PrincipalID, m_item1Name);
@ -79,7 +79,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
// Now try loading to a root child folder
UserInventoryHelpers.CreateInventoryFolder(scene.InventoryService, m_uaMT.PrincipalID, "xA", false);
MemoryStream archiveReadStream = new MemoryStream(m_iarStream.ToArray());
archiverModule.DearchiveInventory(m_uaMT.FirstName, m_uaMT.LastName, "xA", "meowfood", archiveReadStream);
archiverModule.DearchiveInventory(UUID.Random(), m_uaMT.FirstName, m_uaMT.LastName, "xA", "meowfood", archiveReadStream);
InventoryItemBase foundItem2
= InventoryArchiveUtils.FindItemByPath(scene.InventoryService, m_uaMT.PrincipalID, "xA/" + m_item1Name);
@ -88,7 +88,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
// Now try loading to a more deeply nested folder
UserInventoryHelpers.CreateInventoryFolder(scene.InventoryService, m_uaMT.PrincipalID, "xB/xC", false);
archiveReadStream = new MemoryStream(archiveReadStream.ToArray());
archiverModule.DearchiveInventory(m_uaMT.FirstName, m_uaMT.LastName, "xB/xC", "meowfood", archiveReadStream);
archiverModule.DearchiveInventory(UUID.Random(), m_uaMT.FirstName, m_uaMT.LastName, "xB/xC", "meowfood", archiveReadStream);
InventoryItemBase foundItem3
= InventoryArchiveUtils.FindItemByPath(scene.InventoryService, m_uaMT.PrincipalID, "xB/xC/" + m_item1Name);
@ -110,7 +110,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
SceneHelpers.SetupSceneModules(scene, serialiserModule, archiverModule);
UserAccountHelpers.CreateUserWithInventory(scene, m_uaMT, "password");
archiverModule.DearchiveInventory(m_uaMT.FirstName, m_uaMT.LastName, "/Objects", "password", m_iarStream);
archiverModule.DearchiveInventory(UUID.Random(), m_uaMT.FirstName, m_uaMT.LastName, "/Objects", "password", m_iarStream);
InventoryItemBase foundItem1
= InventoryArchiveUtils.FindItemByPath(
@ -185,8 +185,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
// LOAD ITEM
MemoryStream archiveReadStream = new MemoryStream(archiveWriteStream.ToArray());
archiverModule.DearchiveInventory(userFirstName, userLastName, "Scripts", userPassword, archiveReadStream);
archiverModule.DearchiveInventory(UUID.Random(), userFirstName, userLastName, "Scripts", userPassword, archiveReadStream);
InventoryItemBase foundItem1
= InventoryArchiveUtils.FindItemByPath(
@ -229,7 +229,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
{
// Test replication of path1
new InventoryArchiveReadRequest(scene.InventoryService, scene.AssetService, scene.UserAccountService, ua1, null, (Stream)null, false)
new InventoryArchiveReadRequest(UUID.Random(), scene.InventoryService, null, scene.AssetService, scene.UserAccountService, ua1, null, (Stream)null, false)
.ReplicateArchivePathToUserInventory(
iarPath1, scene.InventoryService.GetRootFolder(ua1.PrincipalID),
foldersCreated, nodesLoaded);
@ -246,7 +246,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
{
// Test replication of path2
new InventoryArchiveReadRequest(scene.InventoryService, scene.AssetService, scene.UserAccountService, ua1, null, (Stream)null, false)
new InventoryArchiveReadRequest(UUID.Random(), scene.InventoryService, null, scene.AssetService, scene.UserAccountService, ua1, null, (Stream)null, false)
.ReplicateArchivePathToUserInventory(
iarPath2, scene.InventoryService.GetRootFolder(ua1.PrincipalID),
foldersCreated, nodesLoaded);
@ -292,7 +292,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
string itemArchivePath = string.Join("", new string[] { folder1ArchiveName, folder2ArchiveName });
new InventoryArchiveReadRequest(scene.InventoryService, scene.AssetService, scene.UserAccountService, ua1, null, (Stream)null, false)
new InventoryArchiveReadRequest(UUID.Random(), scene.InventoryService, null, scene.AssetService, scene.UserAccountService, ua1, null, (Stream)null, false)
.ReplicateArchivePathToUserInventory(
itemArchivePath, scene.InventoryService.GetRootFolder(ua1.PrincipalID),
new Dictionary<string, InventoryFolderBase>(), new HashSet<InventoryNodeBase>());
@ -343,7 +343,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
string itemArchivePath = string.Join("", new string[] { folder1ArchiveName, folder2ArchiveName });
new InventoryArchiveReadRequest(scene.InventoryService, scene.AssetService, scene.UserAccountService, ua1, folder1ExistingName, (Stream)null, true)
new InventoryArchiveReadRequest(UUID.Random(), scene.InventoryService, null, scene.AssetService, scene.UserAccountService, ua1, folder1ExistingName, (Stream)null, true)
.ReplicateArchivePathToUserInventory(
itemArchivePath, scene.InventoryService.GetRootFolder(ua1.PrincipalID),
new Dictionary<string, InventoryFolderBase>(), new HashSet<InventoryNodeBase>());

View File

@ -72,7 +72,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
// TestHelpers.EnableLogging();
UserAccountHelpers.CreateUserWithInventory(m_scene, m_uaLL1, "password");
m_archiverModule.DearchiveInventory(m_uaLL1.FirstName, m_uaLL1.LastName, "/", "password", m_iarStream);
m_archiverModule.DearchiveInventory(UUID.Random(), m_uaLL1.FirstName, m_uaLL1.LastName, "/", "password", m_iarStream);
InventoryItemBase coaItem
= InventoryArchiveUtils.FindItemByPath(m_scene.InventoryService, m_uaLL1.PrincipalID, m_coaItemName);
@ -106,8 +106,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
// log4net.Config.XmlConfigurator.Configure();
UserAccountHelpers.CreateUserWithInventory(m_scene, m_uaLL1, "meowfood");
m_archiverModule.DearchiveInventory(m_uaLL1.FirstName, m_uaLL1.LastName, "/", "meowfood", m_iarStream);
m_archiverModule.DearchiveInventory(UUID.Random(), m_uaLL1.FirstName, m_uaLL1.LastName, "/", "meowfood", m_iarStream);
InventoryItemBase foundItem1
= InventoryArchiveUtils.FindItemByPath(m_scene.InventoryService, m_uaLL1.PrincipalID, m_item1Name);
@ -171,7 +171,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
// log4net.Config.XmlConfigurator.Configure();
UserAccountHelpers.CreateUserWithInventory(m_scene, m_uaMT, "password");
m_archiverModule.DearchiveInventory(m_uaMT.FirstName, m_uaMT.LastName, "/", "password", m_iarStream);
m_archiverModule.DearchiveInventory(UUID.Random(), m_uaMT.FirstName, m_uaMT.LastName, "/", "password", m_iarStream);
InventoryItemBase foundItem1
= InventoryArchiveUtils.FindItemByPath(m_scene.InventoryService, m_uaMT.PrincipalID, m_item1Name);

View File

@ -85,8 +85,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
byte[] data = tar.ReadEntry(out filePath, out tarEntryType);
Assert.That(filePath, Is.EqualTo(ArchiveConstants.CONTROL_FILE_PATH));
InventoryArchiveReadRequest iarr
= new InventoryArchiveReadRequest(null, null, null, null, null, (Stream)null, false);
InventoryArchiveReadRequest iarr
= new InventoryArchiveReadRequest(UUID.Random(), null, null, null, null, null, null, (Stream)null, false);
iarr.LoadControlFile(filePath, data);
Assert.That(iarr.ControlFileLoaded, Is.True);

View File

@ -170,7 +170,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
protected void SaveCompleted(
UUID id, bool succeeded, UserAccount userInfo, string invPath, Stream saveStream,
Exception reportedException)
Exception reportedException, int SaveCount, int FilterCount)
{
mre.Set();
}

View File

@ -176,7 +176,7 @@ namespace OpenSim.Region.CoreModules.Framework.Library
m_log.InfoFormat("[LIBRARY MODULE]: Loading library archive {0} ({1})...", iarFileName, simpleName);
simpleName = GetInventoryPathFromName(simpleName);
InventoryArchiveReadRequest archread = new InventoryArchiveReadRequest(m_MockScene.InventoryService, m_MockScene.AssetService, m_MockScene.UserAccountService, uinfo, simpleName, iarFileName, false);
InventoryArchiveReadRequest archread = new InventoryArchiveReadRequest(UUID.Random(), m_MockScene.InventoryService, null, m_MockScene.AssetService, m_MockScene.UserAccountService, uinfo, simpleName, iarFileName, false);
try
{
HashSet<InventoryNodeBase> nodes = archread.Execute();
@ -185,7 +185,7 @@ namespace OpenSim.Region.CoreModules.Framework.Library
// didn't find the subfolder with the given name; place it on the top
m_log.InfoFormat("[LIBRARY MODULE]: Didn't find {0} in library. Placing archive on the top level", simpleName);
archread.Close();
archread = new InventoryArchiveReadRequest(m_MockScene.InventoryService, m_MockScene.AssetService, m_MockScene.UserAccountService, uinfo, "/", iarFileName, false);
archread = new InventoryArchiveReadRequest(UUID.Random(), m_MockScene.InventoryService, null, m_MockScene.AssetService, m_MockScene.UserAccountService, uinfo, "/", iarFileName, false);
archread.Execute();
}

View File

@ -42,8 +42,24 @@ namespace OpenSim.Region.Framework.Interfaces
/// <param name="invPath">The inventory path 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="SaveCount">Number of inventory items saved to archive</param>
/// <param name="FilterCount">Number of inventory items skipped due to perm filter option</param>
public delegate void InventoryArchiveSaved(
UUID id, bool succeeded, UserAccount userInfo, string invPath, Stream saveStream, Exception reportedException);
UUID id, bool succeeded, UserAccount userInfo, string invPath, Stream saveStream, Exception reportedException, int SaveCount, int FilterCount);
/// <summary>
/// Used for the OnInventoryArchiveLoaded event.
/// </summary>
/// <param name="id">Request id</param>
/// <param name="succeeded">true if the load succeeded, false otherwise</param>
/// <param name="userInfo">The user for whom the load was conducted</param>
/// <param name="invPath">The inventory path loaded</param>
/// <param name="savePath">The stream from which the archive was loaded</param>
/// <param name="reportedException">Contains the exception generated if the load did not succeed</param>
/// <param name="LoadCount">Number of inventory items loaded from archive</param>
public delegate void InventoryArchiveLoaded(
UUID id, bool succeeded, UserAccount userInfo, string invPath, Stream loadStream, Exception reportedException, int LoadCount);
public interface IInventoryArchiverModule
{
@ -52,6 +68,11 @@ namespace OpenSim.Region.Framework.Interfaces
/// </summary>
event InventoryArchiveSaved OnInventoryArchiveSaved;
/// <summary>
/// Fired when an archive inventory load has been completed.
/// </summary>
event InventoryArchiveLoaded OnInventoryArchiveLoaded;
/// <summary>
/// Dearchive a user's inventory folder from the given stream
/// </summary>
@ -60,7 +81,7 @@ namespace OpenSim.Region.Framework.Interfaces
/// <param name="invPath">The inventory path in which to place the loaded folders and items</param>
/// <param name="loadStream">The stream from which the inventory archive will be loaded</param>
/// <returns>true if the first stage of the operation succeeded, false otherwise</returns>
bool DearchiveInventory(string firstName, string lastName, string invPath, string pass, Stream loadStream);
bool DearchiveInventory(UUID id, string firstName, string lastName, string invPath, string pass, Stream loadStream);
/// <summary>
/// Dearchive a user's inventory folder from the given stream
@ -73,7 +94,7 @@ namespace OpenSim.Region.Framework.Interfaces
/// the loaded IAR with existing folders where possible.</param>
/// <returns>true if the first stage of the operation succeeded, false otherwise</returns>
bool DearchiveInventory(
string firstName, string lastName, string invPath, string pass, Stream loadStream,
UUID id, string firstName, string lastName, string invPath, string pass, Stream loadStream,
Dictionary<string, object> options);
/// <summary>