some changes; let regions have own assets connector, make the services connector one be like ther older simpler one (as 0.8x). still not good

This commit is contained in:
UbitUmarov
2020-10-24 17:39:30 +01:00
parent 3ec5d46a2f
commit cdd5dba5b0
13 changed files with 1138 additions and 679 deletions

View File

@@ -562,6 +562,11 @@ namespace OpenSim.Region.CoreModules.Asset
return asset;
}
public AssetBase Get(string id, string ForeignAssetService)
{
return null;
}
public bool Get(string id, out AssetBase asset)
{
asset = null;

View File

@@ -33,7 +33,6 @@ using System.Reflection;
using OpenSim.Framework;
using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes;
using OpenSim.Server.Base;
using OpenSim.Services.Connectors;
using OpenSim.Services.Interfaces;
@@ -41,12 +40,10 @@ using OpenSim.Services.Interfaces;
namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset
{
[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "HGAssetBroker")]
public class HGAssetBroker : AssetServicesConnector, ISharedRegionModule, IAssetService
public class HGAssetBroker : RegionBaseAssetServicesConnector, ISharedRegionModule, IAssetService
{
private static readonly ILog m_log = LogManager.GetLogger( MethodBase.GetCurrentMethod().DeclaringType);
private IAssetCache m_Cache = null;
private Scene m_aScene;
private bool m_Enabled = false;
@@ -70,7 +67,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset
Initialise(config);
}
public override void Initialise(IConfigSource source)
public void Initialise(IConfigSource source)
{
IConfig moduleConfig = source.Configs["Modules"];
if (moduleConfig != null)
@@ -78,17 +75,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset
string name = moduleConfig.GetString("AssetServices", "");
if (name == Name)
{
IConfig assetConfig = source.Configs["AssetService"];
if (assetConfig == null)
{
m_log.Error("[HG ASSET CONNECTOR]: AssetService missing from OpenSim.ini");
return;
}
IConfig hgConfig = source.Configs["HGAssetService"];
m_AssetPerms = new AssetPermissions(hgConfig); // it's ok if arg is null
if(hgConfig != null)
m_AssetPerms = new AssetPermissions(hgConfig); // it's ok if arg is null
base.Initialise(source);
baseInitialise(source);
m_Enabled = true;
m_log.Info("[HG ASSET CONNECTOR]: HG asset broker enabled");
}
@@ -128,8 +119,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset
if (!(m_Cache is ISharedRegionModule))
m_Cache = null;
else
SetCache(m_Cache);
}
if (m_Cache != null)

View File

@@ -131,19 +131,12 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset
m_Cache = null;
}
if (m_Cache != null)
{
m_log.DebugFormat(
"[LOCAL ASSET SERVICES CONNECTOR]: Enabled asset connector with caching for region {0}",
if (m_Cache == null)
m_log.DebugFormat("[LOCAL ASSET SERVICES CONNECTOR]: Enabled asset connector with caching for region {0}",
scene.RegionInfo.RegionName);
}
else
{
// Short-circuit directly to storage layer. This ends up storing temporary and local assets.
//
scene.UnregisterModuleInterface<IAssetService>(this);
scene.RegisterModuleInterface<IAssetService>(m_AssetService);
}
m_log.DebugFormat("[LOCAL ASSET SERVICES CONNECTOR]: Enabled asset connector without caching for region {0}",
scene.RegionInfo.RegionName);
}
public AssetBase Get(string id)
@@ -168,6 +161,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset
return asset;
}
public AssetBase Get(string id, string ForeignAssetService)
{
return null;
}
public AssetBase GetCached(string id)
{
// m_log.DebugFormat("[LOCAL ASSET SERVICES CONNECTOR]: Cache request for {0}", id);

View File

@@ -40,13 +40,11 @@ using OpenSim.Services.Interfaces;
namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset
{
[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "RemoteAssetServicesConnector")]
public class RemoteAssetServicesConnector : AssetServicesConnector, ISharedRegionModule, IAssetService
public class RemoteAssetServicesConnector : RegionBaseAssetServicesConnector, ISharedRegionModule, IAssetService
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private bool m_Enabled = false;
private IAssetCache m_Cache;
public Type ReplaceableInterface
{
get { return null; }
@@ -57,7 +55,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset
get { return "RemoteAssetServicesConnector"; }
}
public override void Initialise(IConfigSource source)
public void Initialise(IConfigSource source)
{
IConfig moduleConfig = source.Configs["Modules"];
if (moduleConfig != null)
@@ -65,17 +63,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset
string name = moduleConfig.GetString("AssetServices", "");
if (name == Name)
{
IConfig assetConfig = source.Configs["AssetService"];
if (assetConfig == null)
{
m_log.Error("[ASSET CONNECTOR]: AssetService missing from OpenSim.ini");
return;
}
baseInitialise(source);
m_Enabled = true;
base.Initialise(source);
m_log.Info("[ASSET CONNECTOR]: Remote assets enabled");
}
}
@@ -115,17 +105,12 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset
//
if (!(m_Cache is ISharedRegionModule))
m_Cache = null;
else
SetCache(m_Cache);
}
m_log.InfoFormat("[ASSET CONNECTOR]: Enabled remote assets for region {0}", scene.RegionInfo.RegionName);
if (m_Cache != null)
{
m_log.InfoFormat("[ASSET CONNECTOR]: Enabled asset caching for region {0}", scene.RegionInfo.RegionName);
}
m_log.InfoFormat("[ASSET CONNECTOR]: Enabled remote assets with caching for region {0}", scene.RegionInfo.RegionName);
else
m_log.InfoFormat("[ASSET CONNECTOR]: Enabled remote assets without caching for region {0}", scene.RegionInfo.RegionName);
}
}
}