コード例 #1
0
		public void TryReadFutureDocument()
		{
			int transactionId = m_db.StartTransaction();
 
			DocumentId id1 = new DocumentId("1");

			// this object is stored out of transaction therefore should be visible for the transaction
			m_db.Update(id1, new byte[1] { 0 });

			byte[] blob = m_db.TransactionGet(transactionId, id1);

			Assert.IsNull(blob);

			m_db.CommitTransaction(transactionId);
		}
コード例 #2
0
        private void Update()
        {
            byte[] documentIdBytes = m_serverSocket.Receive();

            DocumentId documentId = new DocumentId(documentIdBytes);

            byte[] blob = m_serverSocket.Receive();

            try
            {
                m_db.Update(documentId, blob);

                // sending success
                m_serverSocket.Send(Protocol.Success);
            }
            catch (DocumentLockedException)
            {
                m_serverSocket.SendMore(Protocol.Failed).Send("Document locked by another transaction");
            }
        }