Example #1
0
        public virtual void Initialize(IAssetServer assetServer)
        {
            m_log.InfoFormat("[ASSET CACHE]: Asset cache initialization [{0}/{1}]", Name, Version);

            m_assetServer = assetServer;
            m_assetServer.SetReceiver(this);
        }
Example #2
0
 /// <summary>
 /// 
 /// </summary>
 public AssetCache(IAssetServer assetServer)
 {
     Console.WriteLine("Creating Asset cache");
     _assetServer = assetServer;
     _assetServer.SetReceiver(this);
     Assets = new Dictionary<libsecondlife.LLUUID, AssetInfo>();
     Textures = new Dictionary<libsecondlife.LLUUID, TextureImage>();
     this._assetCacheThread = new Thread(new ThreadStart(RunAssetManager));
     this._assetCacheThread.IsBackground = true;
     this._assetCacheThread.Start();
 }
Example #3
0
 /// <summary>
 ///
 /// </summary>
 public AssetCache(IAssetServer assetServer)
 {
     Console.WriteLine("Creating Asset cache");
     _assetServer = assetServer;
     _assetServer.SetReceiver(this);
     Assets   = new Dictionary <libsecondlife.LLUUID, AssetInfo>();
     Textures = new Dictionary <libsecondlife.LLUUID, TextureImage>();
     this._assetCacheThread = new Thread(new ThreadStart(RunAssetManager));
     this._assetCacheThread.IsBackground = true;
     this._assetCacheThread.Start();
 }
Example #4
0
        public void Initialize(ConfigSettings settings)
        {
            IConfig stratusConfig = settings.SettingsFile["InWorldz.Data.Assets.Stratus"];

            if (stratusConfig != null && stratusConfig.GetBoolean("enabled", true))
            {
                Config.Settings.Instance.Enabled       = true;
                Config.Settings.Instance.CFSupport     = stratusConfig.GetBoolean("CFSupport", true);
                Config.Settings.Instance.LegacySupport = stratusConfig.GetBoolean("LegacySupport", false);
                Config.Settings.Instance.WhipURL       = stratusConfig.GetString("WhipURL", null);
                Config.Settings.Instance.UseAsyncStore = stratusConfig.GetBoolean("UseAsyncStore", false);

                if (Config.Settings.Instance.LegacySupport == true && Config.Settings.Instance.WhipURL == null)
                {
                    //not allowed, we need a whip URL
                    throw new Exception("To enable stratus legacy asset support, you must include the WhipURL setting");
                }

                //used for testing. should be disabled except for unit tests
                Config.Settings.Instance.UnitTest_ThrowTimeout = false;
                Config.Settings.Instance.UnitTest_DeleteOldCacheFilesImmediately = false;

                Config.Settings.Instance.CFDefaultRegion   = stratusConfig.GetString("CFDefaultRegion", null);
                Config.Settings.Instance.CFUsername        = stratusConfig.GetString("CFUsername", null);
                Config.Settings.Instance.CFApiKey          = stratusConfig.GetString("CFAPIKey", null);
                Config.Settings.Instance.CFContainerPrefix = stratusConfig.GetString("CFContainerPrefix", null);
                Config.Settings.Instance.CFWorkerThreads   = stratusConfig.GetInt("CFWorkerThreads", 8);
                Config.Settings.Instance.CFUseInternalURL  = stratusConfig.GetBoolean("CFUseInternalURL", true);
                Config.Settings.Instance.CFUseCache        = stratusConfig.GetBoolean("CFUseCache", true);
                Config.Settings.Instance.CFCacheSize       = stratusConfig.GetInt("CFCacheSize", 20 * 1024 * 1024);

                if (Config.Settings.Instance.CFSupport == true &&
                    (Config.Settings.Instance.CFUsername == null || Config.Settings.Instance.CFApiKey == null ||
                     Config.Settings.Instance.CFContainerPrefix == null || Config.Settings.Instance.CFDefaultRegion == null))
                {
                    //not allowed, we need the full cloudfiles auth information
                    throw new Exception("To enable stratus Cloud Files support, you must include the CFDefaultRegion, CFUsername, CFAPIKey, and CFContainerPrefix settings");
                }

                Config.Settings.Instance.WriteTarget = stratusConfig.GetString("WriteTarget", null);
                if (Config.Settings.Instance.CFSupport && Config.Settings.Instance.LegacySupport && Config.Settings.Instance.WriteTarget == null)
                {
                    throw new Exception("If both legacy and Cloud Files support is enabled, you must specify 'whip' or 'cf' in the WriteTarget setting");
                }

                Config.Settings.Instance.WriteTarget = Config.Settings.Instance.WriteTarget.ToLower();

                m_log.InfoFormat("[InWorldz.Stratus] Plugin is enabled");

                if (Config.Settings.Instance.LegacySupport)
                {
                    _whipAssetClient = new Whip.Client.AssetClient(Config.Settings.Instance.WhipURL);
                    _whipAssetClient.Initialize(settings);

                    if (Config.Settings.Instance.CFSupport)
                    {
                        //legacy and CF support.
                        _firstReadServer = _whipAssetClient; //whip is the first read server with legacy/cf since it has lower latency
                        if (Config.Settings.Instance.WriteTarget == "whip")
                        {
                            _writeServer = _whipAssetClient;
                        }
                    }
                    else
                    {
                        //just legacy
                        _firstReadServer = _whipAssetClient;
                        _writeServer     = _whipAssetClient;
                    }
                }

                if (Config.Settings.Instance.CFSupport)
                {
                    _cfAssetClient = new CloudFilesAssetClient();

                    if (Config.Settings.Instance.LegacySupport)
                    {
                        _secondReadServer = _cfAssetClient; //cf is the second read server when whip is enabled

                        //legacy and CF support
                        if (Config.Settings.Instance.WriteTarget == "cf")
                        {
                            _writeServer = _cfAssetClient;
                        }
                    }
                    else
                    {
                        _firstReadServer = _cfAssetClient; //first read server when only CF is enabled

                        //just CF
                        _writeServer = _cfAssetClient;
                    }
                }

                _firstReadServer.SetReceiver(this);
                if (_secondReadServer != null)
                {
                    _secondReadServer.SetReceiver(this);
                }
            }
            else
            {
                Config.Settings.Instance.Enabled = false;
                m_log.InfoFormat("[InWorldz.Stratus] Plugin is disabled");
            }
        }
Example #5
0
 public virtual void Initialize(IAssetServer assetServer)
 {
     m_log.InfoFormat("[ASSET CACHE]: Asset cache initialization [{0}/{1}]", Name, Version);
  
     m_assetServer = assetServer;
     m_assetServer.SetReceiver(this);
 }