/// <summary>
        /// Adds a conflict range to a transaction without performing the associated read or write.
        /// </summary>
        /// <param name="beginKeyInclusive">Key specifying the beginning of the conflict range. The key is included</param>
        /// <param name="endKeyExclusive">Key specifying the end of the conflict range. The key is excluded</param>
        /// <param name="type">One of the FDBConflictRangeType values indicating what type of conflict range is being set.</param>
        public void AddConflictRange(Slice beginKeyInclusive, Slice endKeyExclusive, FdbConflictRangeType type)
        {
            EnsureCanWrite();

            m_database.EnsureKeyIsValid(ref beginKeyInclusive);
            m_database.EnsureKeyIsValid(ref endKeyExclusive, endExclusive: true);

#if DEBUG
            if (Logging.On && Logging.IsVerbose)
            {
                Logging.Verbose(this, "AddConflictRange", String.Format("Adding {2} conflict range '{0}' <= k < '{1}'", beginKeyInclusive.ToString(), endKeyExclusive.ToString(), type.ToString()));
            }
#endif

            m_handler.AddConflictRange(beginKeyInclusive, endKeyExclusive, type);
        }
Esempio n. 2
0
        public void AddConflictRange(Slice beginKeyInclusive, Slice endKeyExclusive, FdbConflictRangeType type)
        {
            // check
            if (beginKeyInclusive.IsNullOrEmpty)
            {
                throw new ArgumentException("Begin key cannot be null or empty");
            }
            if (endKeyExclusive.IsNullOrEmpty)
            {
                throw new ArgumentException("End key cannot be null or empty");
            }
            if (type != FdbConflictRangeType.Read && type != FdbConflictRangeType.Write)
            {
                throw new ArgumentOutOfRangeException("type", "Invalid range conflict type");
            }

            CheckAccessToSystemKeys(beginKeyInclusive);
            CheckAccessToSystemKeys(endKeyExclusive, end: true);

            FdbKeyRange range;

            lock (m_buffer)
            {
                range = m_buffer.InternRange(beginKeyInclusive, endKeyExclusive);
            }

            lock (m_lock)
            {
                if (type == FdbConflictRangeType.Read)
                {
                    AddReadConflict_NeedsLocking(range);
                }
                else
                {
                    AddWriteConflict_NeedsLocking(range);
                }
            }
        }
Esempio n. 3
0
        /// <inheritdoc />
        public void AddConflictRange(ReadOnlySpan <byte> beginKeyInclusive, ReadOnlySpan <byte> endKeyExclusive, FdbConflictRangeType type)
        {
            FdbError err = FdbNative.TransactionAddConflictRange(m_handle, beginKeyInclusive, endKeyExclusive, type);

            Fdb.DieOnError(err);
        }
		public override void AddConflictRange(Slice beginKeyInclusive, Slice endKeyExclusive, FdbConflictRangeType type)
		{
			base.AddConflictRange(Encode(beginKeyInclusive), Encode(endKeyExclusive), type);
		}
Esempio n. 5
0
 public AddConflictRangeCommand(Slice begin, Slice end, FdbConflictRangeType type)
 {
     this.Begin = begin;
     this.End   = end;
     this.Type  = type;
 }
 public virtual void AddConflictRange(Slice beginKeyInclusive, Slice endKeyExclusive, FdbConflictRangeType type)
 {
     ThrowIfDisposed();
     m_transaction.AddConflictRange(beginKeyInclusive, endKeyExclusive, type);
 }
Esempio n. 7
0
 public static extern FdbError fdb_transaction_add_conflict_range(TransactionHandle transaction, byte *beginKeyName, int beginKeyNameLength, byte *endKeyName, int endKeyNameLength, FdbConflictRangeType type);
Esempio n. 8
0
 public override void AddConflictRange(Slice beginKeyInclusive, Slice endKeyExclusive, FdbConflictRangeType type)
 {
     base.AddConflictRange(Encode(beginKeyInclusive), Encode(endKeyExclusive), type);
 }
		public void AddConflictRange(Slice beginKeyInclusive, Slice endKeyExclusive, FdbConflictRangeType type)
		{
			FdbError err = FdbNative.TransactionAddConflictRange(m_handle, beginKeyInclusive, endKeyExclusive, type);
			Fdb.DieOnError(err);
		}
        public void AddConflictRange(Slice beginKeyInclusive, Slice endKeyExclusive, FdbConflictRangeType type)
        {
            FdbError err = FdbNative.TransactionAddConflictRange(m_handle, beginKeyInclusive, endKeyExclusive, type);

            Fdb.DieOnError(err);
        }
 public override void AddConflictRange(Slice beginKeyInclusive, Slice endKeyExclusive, FdbConflictRangeType type)
 {
     Execute(
         new FdbTransactionLog.AddConflictRangeCommand(beginKeyInclusive, endKeyExclusive, type),
         (_tr, _cmd) => _tr.AddConflictRange(_cmd.Begin, _cmd.End, _cmd.Type)
         );
 }
Esempio n. 12
0
		/// <summary>
		/// Adds a conflict range to a transaction without performing the associated read or write.
		/// </summary>
		/// <param name="beginKeyInclusive">Key specifying the beginning of the conflict range. The key is included</param>
		/// <param name="endKeyExclusive">Key specifying the end of the conflict range. The key is excluded</param>
		/// <param name="type">One of the FDBConflictRangeType values indicating what type of conflict range is being set.</param>
		public void AddConflictRange(Slice beginKeyInclusive, Slice endKeyExclusive, FdbConflictRangeType type)
		{
			EnsureCanWrite();

			m_database.EnsureKeyIsValid(beginKeyInclusive);
			m_database.EnsureKeyIsValid(endKeyExclusive, endExclusive: true);

#if DEBUG
			if (Logging.On && Logging.IsVerbose) Logging.Verbose(this, "AddConflictRange", String.Format("Adding {2} conflict range '{0}' <= k < '{1}'", beginKeyInclusive.ToString(), endKeyExclusive.ToString(), type.ToString()));
#endif

			m_handler.AddConflictRange(beginKeyInclusive, endKeyExclusive, type);
		}
		public static FdbError TransactionAddConflictRange(TransactionHandle transaction, Slice beginKey, Slice endKey, FdbConflictRangeType type)
		{
			fixed (byte* pBeginKey = beginKey.Array)
			fixed (byte* pEndKey = endKey.Array)
			{
#if DEBUG_NATIVE_CALLS
				Debug.WriteLine("fdb_transaction_add_conflict_range(0x" + transaction.Handle.ToString("x") + ", beginKey: '" + FdbKey.Dump(beginKey) + ", endKey: '" + FdbKey.Dump(endKey) + "', " + type.ToString() + ")");
#endif
				return NativeMethods.fdb_transaction_add_conflict_range(transaction, pBeginKey + beginKey.Offset, beginKey.Count, pEndKey + endKey.Offset, endKey.Count, type);
			}
		}
			public static extern FdbError fdb_transaction_add_conflict_range(TransactionHandle transaction, byte* beginKeyName, int beginKeyNameLength, byte* endKeyName, int endKeyNameLength, FdbConflictRangeType type);
		public virtual void AddConflictRange(Slice beginKeyInclusive, Slice endKeyExclusive, FdbConflictRangeType type)
		{
			ThrowIfDisposed();
			m_transaction.AddConflictRange(beginKeyInclusive, endKeyExclusive, type);
		}
Esempio n. 16
0
 /// <inheritdoc />
 public virtual void AddConflictRange(ReadOnlySpan <byte> beginKeyInclusive, ReadOnlySpan <byte> endKeyExclusive, FdbConflictRangeType type)
 {
     ThrowIfDisposed();
     m_transaction.AddConflictRange(beginKeyInclusive, endKeyExclusive, type);
 }