Ejemplo n.º 1
0
        public IAsyncResult BeginSetProperties(AccountPropertyNames propertyNames, IAccountCondition conditions, AsyncCallback callback, object state)
        {
            AsyncIteratorContext <NoResults> asyncIteratorContext = new AsyncIteratorContext <NoResults>("StorageAccount.SetProperties", callback, state);

            asyncIteratorContext.Begin(this.SetPropertiesImpl(propertyNames, conditions, asyncIteratorContext));
            return(asyncIteratorContext);
        }
Ejemplo n.º 2
0
        public IAsyncResult BeginGetProperties(AccountPropertyNames propertyNames, IAccountCondition condition, CacheRefreshOptions cacheRefreshOptions, int localCacheEntryTimeInTicks, AsyncCallback callback, object state)
        {
            AsyncIteratorContext <NoResults> asyncIteratorContext = new AsyncIteratorContext <NoResults>("StorageAccount.GetProperties", callback, state);

            asyncIteratorContext.Begin(this.GetPropertiesImpl(propertyNames, condition, cacheRefreshOptions, asyncIteratorContext));
            return(asyncIteratorContext);
        }
Ejemplo n.º 3
0
        private IEnumerator <IAsyncResult> SetPropertiesImpl(AccountPropertyNames propertyNames, IAccountCondition conditions, AsyncIteratorContext <NoResults> context)
        {
            IStringDataEventStream infoDebug = Logger <INormalAndDebugLogger> .Instance.InfoDebug;

            object[] objArray = new object[] { propertyNames, conditions, this.Timeout };
            infoDebug.Log("SetPropertiesImpl({0},{1},{2})", objArray);
            IAsyncResult asyncResult = this.StorageManager.AsyncProcessor.BeginExecute((TimeSpan param0) => {
                using (DevelopmentStorageDbDataContext dbContext = DevelopmentStorageDbDataContext.GetDbContext())
                {
                    StorageStampHelpers.CheckAccountName(this._account.Name);
                    Account value = this.LoadAccount(dbContext);
                    this._account = value;
                    AnalyticsSettings analyticsSetting      = null;
                    AnalyticsSettings blobAnalyticsSettings = null;
                    AccountServiceMetadataPropertyNames serviceMetadataPropertyNames = propertyNames.ServiceMetadataPropertyNames;
                    if (serviceMetadataPropertyNames <= AccountServiceMetadataPropertyNames.QueueAnalyticsSettings)
                    {
                        if (serviceMetadataPropertyNames == AccountServiceMetadataPropertyNames.BlobAnalyticsSettings)
                        {
                            blobAnalyticsSettings = this.ServiceMetadata.BlobAnalyticsSettings;
                            if (blobAnalyticsSettings != null)
                            {
                                if (value.BlobServiceSettings != null)
                                {
                                    analyticsSetting = ServiceSettingsSerializer.DeSerialize(value.BlobServiceSettings);
                                    this.PreserveUnchangedAnalyticsSettings(blobAnalyticsSettings, analyticsSetting);
                                }
                                value.BlobServiceSettings = ServiceSettingsSerializer.Serialize(blobAnalyticsSettings);
                                dbContext.SubmitChanges();
                            }
                        }
                        else if (serviceMetadataPropertyNames == AccountServiceMetadataPropertyNames.QueueAnalyticsSettings)
                        {
                            blobAnalyticsSettings = this.ServiceMetadata.QueueAnalyticsSettings;
                            if (blobAnalyticsSettings != null)
                            {
                                if (value.QueueServiceSettings != null)
                                {
                                    analyticsSetting = ServiceSettingsSerializer.DeSerialize(value.QueueServiceSettings);
                                    this.PreserveUnchangedAnalyticsSettings(blobAnalyticsSettings, analyticsSetting);
                                }
                                value.QueueServiceSettings = ServiceSettingsSerializer.Serialize(blobAnalyticsSettings);
                                dbContext.SubmitChanges();
                            }
                        }
                    }
                    else if (serviceMetadataPropertyNames == AccountServiceMetadataPropertyNames.TableAnalyticsSettings)
                    {
                        blobAnalyticsSettings = this.ServiceMetadata.TableAnalyticsSettings;
                        if (blobAnalyticsSettings != null)
                        {
                            if (value.TableServiceSettings != null)
                            {
                                analyticsSetting = ServiceSettingsSerializer.DeSerialize(value.TableServiceSettings);
                                this.PreserveUnchangedAnalyticsSettings(blobAnalyticsSettings, analyticsSetting);
                            }
                            value.TableServiceSettings = ServiceSettingsSerializer.Serialize(blobAnalyticsSettings);
                            dbContext.SubmitChanges();
                        }
                    }
                    else if (serviceMetadataPropertyNames == AccountServiceMetadataPropertyNames.SecondaryReadEnabled)
                    {
                        bool?secondaryReadEnabled = this.ServiceMetadata.SecondaryReadEnabled;
                        if (secondaryReadEnabled.HasValue)
                        {
                            value.SecondaryReadEnabled = secondaryReadEnabled.Value;
                            dbContext.SubmitChanges();
                        }
                    }
                }
            }, this.Timeout, context.GetResumeCallback(), context.GetResumeState("StorageAccount.SetPropertiesImpl"));

            yield return(asyncResult);

            this.StorageManager.AsyncProcessor.EndExecute(asyncResult);
        }
Ejemplo n.º 4
0
        IAsyncResult Microsoft.Cis.Services.Nephos.Common.Storage.IStorageAccount.BeginSetProperties(AccountPropertyNames propertyNames, IAccountCondition conditions, AsyncCallback callback, object state)
        {
            AsyncIteratorContext <NoResults> asyncIteratorContext = new AsyncIteratorContext <NoResults>("StorageAccount.SetProperties", callback, state);

            asyncIteratorContext.Begin(this.SetPropertiesImpl(propertyNames, conditions, asyncIteratorContext));
            return(asyncIteratorContext);
        }
Ejemplo n.º 5
0
        private IEnumerator <IAsyncResult> GetPropertiesImpl(AccountPropertyNames propertyNames, IAccountCondition condition, AsyncIteratorContext <NoResults> context)
        {
            IStringDataEventStream verboseDebug = Logger <INormalAndDebugLogger> .Instance.VerboseDebug;

            object[] objArray = new object[] { propertyNames, condition, this.Timeout };
            verboseDebug.Log("StorageAccount.GetPropertiesImpl({0},{1},{2})", objArray);
            IAsyncResult asyncResult = this.StorageManager.AsyncProcessor.BeginExecute((TimeSpan param0) => {
                using (DevelopmentStorageDbDataContext dbContext = DevelopmentStorageDbDataContext.GetDbContext())
                {
                    StorageStampHelpers.CheckAccountName(this._account.Name);
                    Account account = this.LoadAccount(dbContext);
                    this._account   = account;
                    if (account.SecondaryReadEnabled)
                    {
                        if (this._accountServiceMetadata == null)
                        {
                            this._accountServiceMetadata = new AccountServiceMetadata();
                        }
                        this._accountServiceMetadata.SecondaryReadEnabled = new bool?(true);
                    }
                    if (propertyNames.ServiceMetadataPropertyNames.HasFlag((AccountServiceMetadataPropertyNames)((long)32768)))
                    {
                        if (this._accountServiceMetadata == null)
                        {
                            this._accountServiceMetadata = new AccountServiceMetadata();
                        }
                        if (account.BlobServiceSettings == null)
                        {
                            this._accountServiceMetadata.BlobAnalyticsSettings = new AnalyticsSettings();
                        }
                        else
                        {
                            this._accountServiceMetadata.BlobAnalyticsSettings = ServiceSettingsSerializer.DeSerialize(account.BlobServiceSettings);
                        }
                        this._accountServiceMetadata.BlobGeoReplicationStats = this.LoadGeoReplicationStats(dbContext);
                    }
                    if (propertyNames.ServiceMetadataPropertyNames.HasFlag((AccountServiceMetadataPropertyNames)((long)65536)))
                    {
                        if (this._accountServiceMetadata == null)
                        {
                            this._accountServiceMetadata = new AccountServiceMetadata();
                        }
                        if (account.QueueServiceSettings == null)
                        {
                            this._accountServiceMetadata.QueueAnalyticsSettings = new AnalyticsSettings();
                        }
                        else
                        {
                            this._accountServiceMetadata.QueueAnalyticsSettings = ServiceSettingsSerializer.DeSerialize(account.QueueServiceSettings);
                        }
                        this._accountServiceMetadata.QueueGeoReplicationStats = this.LoadGeoReplicationStats(dbContext);
                    }
                    if (propertyNames.ServiceMetadataPropertyNames.HasFlag((AccountServiceMetadataPropertyNames)((long)131072)))
                    {
                        if (this._accountServiceMetadata == null)
                        {
                            this._accountServiceMetadata = new AccountServiceMetadata();
                        }
                        if (account.TableServiceSettings == null)
                        {
                            this._accountServiceMetadata.TableAnalyticsSettings = new AnalyticsSettings();
                        }
                        else
                        {
                            this._accountServiceMetadata.TableAnalyticsSettings = ServiceSettingsSerializer.DeSerialize(account.TableServiceSettings);
                        }
                        this._accountServiceMetadata.TableGeoReplicationStats = this.LoadGeoReplicationStats(dbContext);
                    }
                }
            }, this.Timeout, context.GetResumeCallback(), context.GetResumeState("StorageAccount.GetPropertiesImpl"));

            yield return(asyncResult);

            this.StorageManager.AsyncProcessor.EndExecute(asyncResult);
        }
Ejemplo n.º 6
0
        private IEnumerator <IAsyncResult> SetPropertiesImpl(AccountPropertyNames propertyNames, IAccountCondition conditions, AsyncIteratorContext <NoResults> context)
        {
            IAsyncResult           asyncResult;
            IStringDataEventStream verboseDebug = Logger <IRestProtocolHeadLogger> .Instance.VerboseDebug;

            object[] objArray = new object[] { propertyNames, conditions, this.Timeout };
            verboseDebug.Log("SetPropertiesImpl({0},{1},{2})", objArray);
            try
            {
                asyncResult = this.internalAccount.BeginSetProperties(propertyNames, null, context.GetResumeCallback(), context.GetResumeState("StorageAccount.SetPropertiesImpl"));
            }
            catch (Exception exception)
            {
                StorageStamp.TranslateException(exception);
                throw;
            }
            yield return(asyncResult);

            try
            {
                this.internalAccount.EndSetProperties(asyncResult);
            }
            catch (Exception exception1)
            {
                StorageStamp.TranslateException(exception1);
                throw;
            }
        }
Ejemplo n.º 7
0
        private IEnumerator <IAsyncResult> GetPropertiesImplOld(AccountPropertyNames propertyNames, IAccountCondition condition, CacheRefreshOptions cacheRefreshOptions, AsyncIteratorContext <NoResults> context)
        {
            IAsyncResult asyncResult;

            try
            {
                asyncResult = this.internalAccount.BeginGetProperties(propertyNames, condition, context.GetResumeCallback(), context.GetResumeState("StorageAccount.GetPropertiesImpl"));
            }
            catch (Exception exception)
            {
                StorageStamp.TranslateException(exception);
                throw;
            }
            yield return(asyncResult);

            try
            {
                this.internalAccount.EndGetProperties(asyncResult);
            }
            catch (Exception exception1)
            {
                StorageStamp.TranslateException(exception1);
                throw;
            }
        }
Ejemplo n.º 8
0
 private IEnumerator <IAsyncResult> GetPropertiesImpl(AccountPropertyNames propertyNames, IAccountCondition condition, CacheRefreshOptions cacheRefreshOptions, AsyncIteratorContext <NoResults> context)
 {
     return(this.GetPropertiesImplOld(propertyNames, condition, cacheRefreshOptions, context));
 }
Ejemplo n.º 9
0
 public IAsyncResult BeginGetProperties(AccountPropertyNames propertyNames, IAccountCondition condition, AsyncCallback callback, object state)
 {
     return(this.BeginGetProperties(propertyNames, condition, CacheRefreshOptions.None, Environment.TickCount & 2147483647, callback, state));
 }