/// <summary>Set an option on this transaction that does not take any parameter</summary>
        /// <param name="option">Option to set</param>
        public void SetOption(FdbTransactionOption option)
        {
            EnsureNotFailedOrDisposed();

            if (Logging.On && Logging.IsVerbose)
            {
                Logging.Verbose(this, "SetOption", String.Format("Setting transaction option {0}", option.ToString()));
            }

            m_handler.SetOption(option, Slice.Nil);
        }
Exemple #2
0
        //TODO: this is redundant with GetApproximateSize which does the exact book-keeping (but is async!). Should we keep it? or get remove it?

        #endregion

        #region Options...

        /// <inheritdoc />
        public void SetOption(FdbTransactionOption option, ReadOnlySpan <byte> data)
        {
            Fdb.EnsureNotOnNetworkThread();

            unsafe
            {
                fixed(byte *ptr = data)
                {
                    Fdb.DieOnError(FdbNative.TransactionSetOption(m_handle, option, ptr, data.Length));
                }
            }
        }
        public void SetOption(FdbTransactionOption option, Slice data)
        {
            Fdb.EnsureNotOnNetworkThread();

            unsafe
            {
                fixed(byte *ptr = data)
                {
                    Fdb.DieOnError(FdbNative.TransactionSetOption(m_handle, option, ptr, data.Count));
                }
            }
        }
        /// <summary>Set an option on this transaction that takes a string value</summary>
        /// <param name="option">Option to set</param>
        /// <param name="value">Value of the parameter (can be null)</param>
        public void SetOption(FdbTransactionOption option, string value)
        {
            EnsureNotFailedOrDisposed();

            if (Logging.On && Logging.IsVerbose)
            {
                Logging.Verbose(this, "SetOption", String.Format("Setting transaction option {0} to '{1}'", option.ToString(), value ?? "<null>"));
            }

            var data = FdbNative.ToNativeString(value, nullTerminated: true);

            m_handler.SetOption(option, data);
        }
        /// <summary>Set an option on this transaction that takes an integer value</summary>
        /// <param name="option">Option to set</param>
        /// <param name="value">Value of the parameter</param>
        public void SetOption(FdbTransactionOption option, long value)
        {
            EnsureNotFailedOrDisposed();

            if (Logging.On && Logging.IsVerbose)
            {
                Logging.Verbose(this, "SetOption", String.Format("Setting transaction option {0} to {1}", option.ToString(), value));
            }

            // Spec says: "If the option is documented as taking an Int parameter, value must point to a signed 64-bit integer (little-endian), and value_length must be 8."
            var data = Slice.FromFixed64(value);

            m_handler.SetOption(option, data);
        }
        public void SetOption(FdbTransactionOption option, Slice data)
        {
            Fdb.EnsureNotOnNetworkThread();

            unsafe
            {
                if (data.IsNull)
                {
                    Fdb.DieOnError(FdbNative.TransactionSetOption(m_handle, option, null, 0));
                }
                else
                {
                    fixed(byte *ptr = data.Array)
                    {
                        Fdb.DieOnError(FdbNative.TransactionSetOption(m_handle, option, ptr + data.Offset, data.Count));
                    }
                }
            }
        }
Exemple #7
0
 public void SetOption(FdbTransactionOption option)
 {
     m_parent.SetOption(option);
 }
Exemple #8
0
 public static extern FdbError fdb_transaction_set_option(TransactionHandle handle, FdbTransactionOption option, byte *value, int valueLength);
Exemple #9
0
 public static FdbError TransactionSetOption(TransactionHandle transaction, FdbTransactionOption option, byte *value, int valueLength)
 {
     return(NativeMethods.fdb_transaction_set_option(transaction, option, value, valueLength));
 }
		public virtual void SetOption(FdbTransactionOption option)
		{
			m_transaction.SetOption(option);
		}
		public virtual void SetOption(FdbTransactionOption option, long value)
		{
			ThrowIfDisposed();
			m_transaction.SetOption(option, value);
		}
 public virtual void SetOption(FdbTransactionOption option, long value)
 {
     ThrowIfDisposed();
     m_transaction.SetOption(option, value);
 }
			public void SetOption(FdbTransactionOption option)
			{
				m_parent.SetOption(option);
			}
Exemple #14
0
		/// <summary>Set an option on this transaction that takes an integer value</summary>
		/// <param name="option">Option to set</param>
		/// <param name="value">Value of the parameter</param>
		public void SetOption(FdbTransactionOption option, long value)
		{
			EnsureNotFailedOrDisposed();

			if (Logging.On && Logging.IsVerbose) Logging.Verbose(this, "SetOption", String.Format("Setting transaction option {0} to {1}", option.ToString(), value));

			// Spec says: "If the option is documented as taking an Int parameter, value must point to a signed 64-bit integer (little-endian), and value_length must be 8."
			var data = Slice.FromFixed64(value);

			m_handler.SetOption(option, data);
		}
 public virtual void SetOption(FdbTransactionOption option, long value)
 {
     m_transaction.SetOption(option, value);
 }
Exemple #16
0
		/// <summary>Set an option on this transaction that does not take any parameter</summary>
		/// <param name="option">Option to set</param>
		public void SetOption(FdbTransactionOption option)
		{
			EnsureNotFailedOrDisposed();

			if (Logging.On && Logging.IsVerbose) Logging.Verbose(this, "SetOption", String.Format("Setting transaction option {0}", option.ToString()));

			m_handler.SetOption(option, Slice.Nil);
		}
Exemple #17
0
		/// <summary>Set an option on this transaction that takes a string value</summary>
		/// <param name="option">Option to set</param>
		/// <param name="value">Value of the parameter (can be null)</param>
		public void SetOption(FdbTransactionOption option, string value)
		{
			EnsureNotFailedOrDisposed();

			if (Logging.On && Logging.IsVerbose) Logging.Verbose(this, "SetOption", String.Format("Setting transaction option {0} to '{1}'", option.ToString(), value ?? "<null>"));

			var data = FdbNative.ToNativeString(value, nullTerminated: true);
			m_handler.SetOption(option, data);
		}
		public static FdbError TransactionSetOption(TransactionHandle transaction, FdbTransactionOption option, byte* value, int valueLength)
		{
			return NativeMethods.fdb_transaction_set_option(transaction, option, value, valueLength);
		}
			public static extern FdbError fdb_transaction_set_option(TransactionHandle handle, FdbTransactionOption option, byte* value, int valueLength);
			public void SetOption(FdbTransactionOption option, long value)
			{
				m_parent.SetOption(option, value);
			}
Exemple #21
0
 public void SetOption(FdbTransactionOption option, long value)
 {
     m_parent.SetOption(option, value);
 }
Exemple #22
0
 public SetOptionCommand(FdbTransactionOption option, long value)
 {
     this.Option   = option;
     this.IntValue = value;
 }
 public virtual void SetOption(FdbTransactionOption option)
 {
     ThrowIfDisposed();
     m_transaction.SetOption(option);
 }
Exemple #24
0
 /// <inheritdoc />
 public virtual void SetOption(FdbTransactionOption option, ReadOnlySpan <char> value)
 {
     m_transaction.SetOption(option, value);
 }
 public virtual void SetOption(FdbTransactionOption option)
 {
     m_transaction.SetOption(option);
 }
		public virtual void SetOption(FdbTransactionOption option, long value)
		{
			m_transaction.SetOption(option, value);
		}
Exemple #27
0
 public SetOptionCommand(FdbTransactionOption option)
 {
     this.Option = option;
 }
 public override void SetOption(FdbTransactionOption option, string value)
 {
     ThrowIfDisposed();
     this.Log.AddOperation(new FdbTransactionLog.SetOptionCommand(option, value), countAsOperation: false);
     m_transaction.SetOption(option, value);
 }
Exemple #29
0
 public SetOptionCommand(FdbTransactionOption option, string value)
 {
     this.Option      = option;
     this.StringValue = value;
 }
		public void SetOption(FdbTransactionOption option, Slice data)
		{
			Fdb.EnsureNotOnNetworkThread();

			unsafe
			{
				if (data.IsNull)
				{
					Fdb.DieOnError(FdbNative.TransactionSetOption(m_handle, option, null, 0));
				}
				else
				{
					fixed (byte* ptr = data.Array)
					{
						Fdb.DieOnError(FdbNative.TransactionSetOption(m_handle, option, ptr + data.Offset, data.Count));
					}
				}
			}
		}
Exemple #31
0
 /// <inheritdoc />
 public virtual void SetOption(FdbTransactionOption option, ReadOnlySpan <char> value)
 {
     ThrowIfDisposed();
     m_transaction.SetOption(option, value);
 }
 public void SetOption(FdbTransactionOption option, ReadOnlySpan <char> value)
 {
     m_parent.SetOption(option, value);
 }
Exemple #33
0
        public void SetOption(FdbTransactionOption option, Slice data)
        {
            switch (option)
            {
            case FdbTransactionOption.AccessSystemKeys:
            {
                this.AccessSystemKeys = (data.IsNullOrEmpty || DecodeBooleanOption(data)) ? READ_WRITE_ACCESS : NO_ACCESS;
                break;
            }

            case FdbTransactionOption.ReadSystemKeys:
            {
                this.AccessSystemKeys = (data.IsNullOrEmpty || DecodeBooleanOption(data)) ? READ_ACCESS : NO_ACCESS;
                break;
            }

            case FdbTransactionOption.RetryLimit:
            {
                if (data.Count != 8)
                {
                    throw new FdbException(FdbError.InvalidOptionValue);
                }
                long value = data.ToInt64();
                if (value < 0 || value >= int.MaxValue)
                {
                    throw new FdbException(FdbError.InvalidOptionValue);
                }
                this.RetryLimit = (int)value;
                break;
            }

            case FdbTransactionOption.Timeout:
            {
                if (data.Count != 8)
                {
                    throw new FdbException(FdbError.InvalidOptionValue);
                }
                long value = data.ToInt64();
                if (value < 0 || value >= int.MaxValue)
                {
                    throw new FdbException(FdbError.InvalidOptionValue);
                }
                this.Timeout = (int)value;
                break;
            }

            case FdbTransactionOption.NextWriteNoWriteConflictRange:
            {
                this.NextWriteNoWriteConflictRange = data.IsNullOrEmpty || DecodeBooleanOption(data);
                break;
            }

            case FdbTransactionOption.ReadYourWritesDisable:
            {
                this.ReadYourWritesDisable = data.IsNullOrEmpty || DecodeBooleanOption(data);
                break;
            }

            default:
            {
                throw new FdbException(FdbError.InvalidOption);
            }
            }
        }
		public virtual void SetOption(FdbTransactionOption option)
		{
			ThrowIfDisposed();
			m_transaction.SetOption(option);
		}