Esempio n. 1
0
 public MasterMigratingTable(IConfigurationService <MTableConfiguration> configService,
                             IChainTable2 oldTable, IChainTable2 newTable, IChainTableMonitor monitor,
                             MTableOptionalBug?bugToEnable = null)
     : base(configService, oldTable, newTable, monitor, bugToEnable)
 {
     this.configService = configService;
 }
 public MasterMigratingTable(IConfigurationService<MTableConfiguration> configService,
     IChainTable2 oldTable, IChainTable2 newTable, IChainTableMonitor monitor,
     MTableOptionalBug? bugToEnable = null)
     : base(configService, oldTable, newTable, monitor, bugToEnable)
 {
     this.configService = configService;
 }
 public MigratingTable(IReadOnlyConfigurationService <MTableConfiguration> configService,
                       IChainTable2 oldTable, IChainTable2 newTable, IChainTableMonitor monitor, MTableOptionalBug?bugToEnable = null)
 {
     this.enabledBug    = bugToEnable;
     this.configService = configService;
     this.oldTable      = oldTable;
     this.newTable      = newTable;
     this.monitor       = monitor;
 }
Esempio n. 4
0
 internal ChainTable2PSharpProxy(MachineId callerMachineId, MachineId hostMachineId, IChainTable2 original)
 {
     this.callerMachineId    = callerMachineId;
     this.hostMachineId      = hostMachineId;
     nonannotatableCallProxy = PSharpRealProxy.MakeTransparentProxy(callerMachineId, hostMachineId, original,
                                                                    null, () => new TableNonannotatableCallEvent());
     annotatableCallProxy = PSharpRealProxy.MakeTransparentProxy(callerMachineId, hostMachineId, original,
                                                                 null, () => new TableAnnotatableCallEvent());
 }
Esempio n. 5
0
 internal ChainTable2PSharpProxy(MachineId callerMachineId, MachineId hostMachineId,
                                 IChainTable2 original, string debugName)
 {
     this.callerMachineId = callerMachineId;
     this.hostMachineId   = hostMachineId;
     this.debugName       = debugName;
     plainEventProxy      = PSharpRealProxy.MakeTransparentProxy(callerMachineId, hostMachineId, original,
                                                                 debugName, () => new GenericDispatchableEvent());
     tableCallEventProxy = PSharpRealProxy.MakeTransparentProxy(callerMachineId, hostMachineId, original,
                                                                debugName, () => new TableCallEvent());
 }
Esempio n. 6
0
 internal AppMachineInitializePayload(
     IConfigurationService <MTableConfiguration> configService,
     IChainTable2 oldTable, IChainTable2 newTable,
     ITablesMachinePeek peekProxy, ITablesMachineAnnotation annotationProxy)
 {
     this.configService   = configService;
     this.oldTable        = oldTable;
     this.newTable        = newTable;
     this.peekProxy       = peekProxy;
     this.annotationProxy = annotationProxy;
 }
 /* This may be called concurrently with other async operations, but not with itself.
  * It doesn't return until all in-flight operations on the old backend have finished.
  * TODO: Add cancellation support to IChainTable2 so we can cancel long-running
  * operations on the old table and complete the switch faster?  (We'd stipulate that
  * a batch that is cancelled but takes effect must return the success rather than the
  * cancellation, at least until we find a way to safely retry a batch that ended in
  * an unknown state.) */
 public Task SwitchAsync(IChainTable2 newBackend, QueryStreamMapper queryStreamMapper)
 {
     throw new NotImplementedException();
 }
 public SwitchableTable(IChainTable2 backend)
 {
     this.backend = backend;
 }
Esempio n. 9
0
 public ChainTable2LoggingProxy(IChainTable2 original, string proxyName)
 {
     this.original  = original;
     this.proxyName = proxyName;
 }
Esempio n. 10
0
        Task WalkTableInParallel(IChainTable2 table, TableRequestOptions requestOptions, OperationContext operationContext,
                                 Func <MTableEntity, Task <IQueryStream <MTableEntity> > > rowCallbackAsync)
        {
            return(Task.WhenAll(Enumerable.Range(0, 16).Select(hexNumber => Task.Run(async() =>
            {
                var query = new TableQuery <MTableEntity>();

                if (hexNumber == 0)
                {
                    query.FilterString = TableQuery.GenerateFilterCondition(
                        "PartitionKey",
                        QueryComparisons.LessThanOrEqual,
                        (hexNumber + 1).ToString("x"));
                }
                else if (hexNumber == 15)
                {
                    query.FilterString = TableQuery.GenerateFilterCondition(
                        "PartitionKey",
                        QueryComparisons.GreaterThanOrEqual,
                        hexNumber.ToString("x"));
                }
                else
                {
                    query.FilterString = TableQuery.CombineFilters(
                        TableQuery.GenerateFilterCondition(
                            "PartitionKey",
                            QueryComparisons.GreaterThanOrEqual,
                            hexNumber.ToString("x")),
                        TableOperators.And,
                        TableQuery.GenerateFilterCondition(
                            "PartitionKey",
                            QueryComparisons.LessThanOrEqual,
                            (hexNumber + 1).ToString("x")));
                }

                try
                {
                    IQueryStream <MTableEntity> tableStream = await table.ExecuteQueryStreamedAsync(
                        query, requestOptions, operationContext);

                    MTableEntity entity;
                    while ((entity = await tableStream.ReadRowAsync()) != null)
                    {
                        IQueryStream <MTableEntity> newTableStream = await rowCallbackAsync(entity);
                        if (newTableStream != null)
                        {
                            tableStream = newTableStream;
                        }
                    }
                }
                catch (Exception e)
                {
                    while (e is AggregateException)
                    {
                        e = ((AggregateException)(e)).InnerException;
                    }

                    if (!(e is StorageException && ((StorageException)e).RequestInformation.HttpStatusCode == 404))
                    {
                        throw;
                    }
                }
            }))));
        }