コード例 #1
0
ファイル: StorageHelper.cs プロジェクト: jtmueller/ravendb
		public static void AssertNotModifiedByAnotherTransaction(TableStorage storage, ITransactionStorageActions transactionStorageActions, string key, Table.ReadResult readResult, TransactionInformation transactionInformation)
		{
			if (readResult == null)
				return;
			var txIdAsBytes = readResult.Key.Value<byte[]>("txId");
			if (txIdAsBytes == null)
				return;

			var txId = new Guid(txIdAsBytes);
			if (transactionInformation != null && transactionInformation.Id == txId)
			{
				return;
			}

			var existingTx = storage.Transactions.Read(new RavenJObject { { "txId", txId.ToByteArray() } });
			if (existingTx == null)//probably a bug, ignoring this as not a real tx
				return;

			var timeout = existingTx.Key.Value<DateTime>("timeout");
			if (SystemTime.UtcNow > timeout)
			{
				transactionStorageActions.RollbackTransaction(txId);
				return;
			}

			throw new ConcurrencyException("Document '" + key + "' is locked by transacton: " + txId);
		}
コード例 #2
0
 public DocumentsStorageActions(TableStorage storage, ITransactionStorageActions transactionStorageActions, IUuidGenerator generator, IEnumerable <AbstractDocumentCodec> documentCodecs)
 {
     this.storage = storage;
     this.transactionStorageActions = transactionStorageActions;
     this.generator      = generator;
     this.documentCodecs = documentCodecs;
 }
コード例 #3
0
 public DocumentsStorageActions(TableStorage storage, ITransactionStorageActions transactionStorageActions, IUuidGenerator generator, IEnumerable<AbstractDocumentCodec> documentCodecs)
 {
     this.storage = storage;
     this.transactionStorageActions = transactionStorageActions;
     this.generator = generator;
     this.documentCodecs = documentCodecs;
 }
コード例 #4
0
 public DocumentsStorageActions(TableStorage storage,
                                ITransactionStorageActions transactionStorageActions,
                                IUuidGenerator generator,
                                OrderedPartCollection <AbstractDocumentCodec> documentCodecs,
                                IDocumentCacher documentCacher)
 {
     this.storage = storage;
     this.transactionStorageActions = transactionStorageActions;
     this.generator      = generator;
     this.documentCodecs = documentCodecs;
     this.documentCacher = documentCacher;
 }
コード例 #5
0
        public static void AssertNotModifiedByAnotherTransaction(TableStorage storage, ITransactionStorageActions transactionStorageActions, string key, Table.ReadResult readResult, TransactionInformation transactionInformation)
        {
            if (readResult == null)
            {
                return;
            }
            var txIdAsBytes = readResult.Key.Value <byte[]>("txId");

            if (txIdAsBytes == null)
            {
                return;
            }

            var txId = new Guid(txIdAsBytes);

            if (transactionInformation != null && transactionInformation.Id == txId)
            {
                return;
            }

            var existingTx = storage.Transactions.Read(new RavenJObject {
                { "txId", txId.ToByteArray() }
            });

            if (existingTx == null)//probably a bug, ignoring this as not a real tx
            {
                return;
            }

            var timeout = existingTx.Key.Value <DateTime>("timeout");

            if (DateTime.UtcNow > timeout)
            {
                transactionStorageActions.RollbackTransaction(txId);
                return;
            }

            throw new ConcurrencyException("Document '" + key + "' is locked by transacton: " + txId);
        }
コード例 #6
0
 public DocumentsStorageActions(TableStorage storage, ITransactionStorageActions transactionStorageActions, IUuidGenerator generator)
 {
     this.storage = storage;
     this.transactionStorageActions = transactionStorageActions;
     this.generator = generator;
 }
コード例 #7
0
 public DocumentsStorageActions(TableStorage storage, ITransactionStorageActions transactionStorageActions)
 {
     this.storage = storage;
     this.transactionStorageActions = transactionStorageActions;
 }