コード例 #1
0
ファイル: StudyStore.cs プロジェクト: ronmark1/ClearCanvas-1
        public static StorageConfiguration GetConfiguration(bool forceReload)
        {
            if (!forceReload)
            {
                lock (_syncLock)
                {
                    if (_storageConfigurationCache != null && _storageConfigurationCacheTime > Environment.TickCount - _storageConfigurationCacheExpiry)
                    {
                        return(_storageConfigurationCache.Clone());
                    }
                }
            }

            StorageConfiguration configuration = null;

            Platform.GetService <IStorageConfiguration>(s =>
            {
                configuration = s.GetConfiguration(new GetStorageConfigurationRequest()).Configuration;
                if (configuration != null)
                {
                    lock (_syncLock)
                    {
                        _storageConfigurationCache     = configuration.Clone();
                        _storageConfigurationCacheTime = Environment.TickCount;
                    }
                }
            });
            return(configuration);
        }
コード例 #2
0
        public static StorageConfiguration GetConfiguration()
        {
            StorageConfiguration configuration = null;

            Platform.GetService <IStorageConfiguration>(
                s => configuration = s.GetConfiguration(new GetStorageConfigurationRequest()).Configuration);
            return(configuration);
        }
コード例 #3
0
 public static void UpdateConfiguration(StorageConfiguration configuration)
 {
     Platform.GetService <IStorageConfiguration>(
         s => s.UpdateConfiguration(new UpdateStorageConfigurationRequest
     {
         Configuration = configuration
     }));
 }
コード例 #4
0
ファイル: StudyStore.cs プロジェクト: ronmark1/ClearCanvas-1
        private const long _storageConfigurationCacheExpiry = 10000;         // really short timeout, we're just mitigating against access in tight loops

        public static void UpdateConfiguration(StorageConfiguration configuration)
        {
            Platform.GetService <IStorageConfiguration>(s =>
            {
                s.UpdateConfiguration(new UpdateStorageConfigurationRequest {
                    Configuration = configuration
                });
                lock (_syncLock)
                {
                    // we don't actually just update the cache, because the database is shared and may be updated by other processes
                    _storageConfigurationCache = null;
                }
            });
        }
コード例 #5
0
        // TODO (CR Jun 2012): Move to a helper class?

        #region Implementation of IStorageConfiguration

        public GetStorageConfigurationResult GetConfiguration(GetStorageConfigurationRequest request)
        {
            var storageSettings  = new StorageSettings();
            var deletionSettings = new StudyDeletionSettings();

            var configuration = new StorageConfiguration
            {
                FileStoreDirectory      = storageSettings.FileStoreDirectory,
                MinimumFreeSpacePercent = storageSettings.MinimumFreeSpacePercent,
                DefaultDeletionRule     = new StorageConfiguration.DeletionRule
                {
                    Enabled   = deletionSettings.Enabled,
                    TimeUnit  = deletionSettings.TimeUnit,
                    TimeValue = deletionSettings.TimeValue
                }
            };

            Complete(configuration);
            return(new GetStorageConfigurationResult {
                Configuration = configuration
            });
        }
コード例 #6
0
        private void Complete(StorageConfiguration configuration)
        {
            if (String.IsNullOrEmpty(configuration.FileStoreDirectory))
            {
                configuration.FileStoreDirectory = DefaultFileStoreLocation;
            }

            if (configuration.AutoCalculateMinimumFreeSpacePercent)
            {
                configuration.MinimumFreeSpaceBytes = ComputeMinimumFreeSpaceBytes(configuration.FileStoreDirectory);
            }

            if (configuration.DefaultDeletionRule == null)
            {
                configuration.DefaultDeletionRule = new StorageConfiguration.DeletionRule
                {
                    Enabled   = false,
                    TimeUnit  = TimeUnit.Weeks,
                    TimeValue = 1
                }
            }
            ;
        }