示例#1
0
        public void Put <K, V>(K key, V value, PutOption option = PutOption.Unspecific)
        {
            ISerializer <K> keySerializer   = SerializerRegistry.Get <K>();
            ISerializer <V> valueSerializer = SerializerRegistry.Get <V>();

            Put(keySerializer.Serialize(key), valueSerializer.Serialize(value), option);
        }
示例#2
0
        internal static void Put(IntPtr txn, uint dbi, DbValue key, DbValue value, PutOption options)
        {
            int err = _putDelegate(txn, dbi, ref key, ref value, (uint)options);

            if (err != 0)
            {
                throw new MdbxException("mdbx_put", err);
            }
        }
示例#3
0
        public void ReturnTheCorrectValueOfPut(double S, double K,
                                               double t, double sigma,
                                               double r, double expectedPriceValue)
        {
            BlackScholesParametersModel inputs = new BlackScholesParametersModel(S, K, t, sigma, r);

            PutOption   putOption = new PutOption();
            OptionModel put       = putOption.GetOptionData(inputs);

            Assert.AreEqual(expectedPriceValue, put.Value, 0.0001);
        }
示例#4
0
        public PutResponse Put(ByteSequence key, ByteSequence value,
                               PutOption option)
        {
            Etcdserverpb.PutRequest request = new Etcdserverpb.PutRequest();
            request.Key    = key.GetByteString();
            request.Value  = value.GetByteString();
            request.Lease  = option.LeaseId;
            request.PrevKv = option.PrevKV;
            var         rsp      = kVClient.Put(request);
            PutResponse response = new PutResponse(rsp);

            return(response);
            //return Util.ToCompletableFutureWithRetry(
            //     stub.Put(request),
            //     new FunctionResponse<Etcdserverpb.PutRequest, PutResponse>(),
            //     Util.IsRetriable
            //);
        }
示例#5
0
        public void Put(byte[] key, byte[] value, PutOption option = PutOption.Unspecific)
        {
            IntPtr keyPtr   = Marshal.AllocHGlobal(key.Length);
            IntPtr valuePtr = Marshal.AllocHGlobal(value.Length);

            try
            {
                Marshal.Copy(key, 0, keyPtr, key.Length);
                Marshal.Copy(value, 0, valuePtr, value.Length);


                DbValue dbKey   = new DbValue(keyPtr, key.Length);
                DbValue dbValue = new DbValue(valuePtr, value.Length);
                Dbi.Put(_tran._txnPtr, _dbi, dbKey, dbValue, option);
            }
            finally
            {
                Marshal.FreeHGlobal(keyPtr);
                Marshal.FreeHGlobal(valuePtr);
            }
        }
        public void ComputeOptionsPrice()
        {
            try
            {
                if (!UsefulTools.IsBlackScholesVariablesValid(Inputs.InputParametersDict.Values.ToList()))
                {
                    UpdateAppStatus("Invalid input, Please enter all five variables.");
                    return;
                }

                CallOption callOption = new CallOption();
                Call = callOption.GetOptionData(Inputs);

                PutOption putOption = new PutOption();
                Put = putOption.GetOptionData(Inputs);

                UpdateAppStatus("Compute operation successfully completed.");
            }
            catch (Exception ex)
            {
                UpdateAppStatus(ex.Message);
            }
        }
示例#7
0
 private static int RunCommand(PutOption opts)
 {
     using (MediaDevice device = MediaDevice.GetDevices().FirstOrDefault(opts))
     {
         if (device != null)
         {
             device.Connect();
             string destDir = Path.GetDirectoryName(opts.Destination);
             if (!device.DirectoryExists(destDir))
             {
                 device.CreateDirectory(destDir);
             }
             device.UploadFile(opts.Source, opts.Destination);
             device.Disconnect();
         }
         else
         {
             Console.WriteLine("No device connected.");
             return(1);
         }
     }
     return(0);
 }
示例#8
0
 public PutOp(ByteString key, ByteString value, PutOption option) : base(Type.PUT, key)
 {
     this.value  = value;
     this.option = option;
 }
示例#9
0
 public static PutOp Put(ByteSequence key, ByteSequence value, PutOption option)
 {
     return(new PutOp(ByteString.CopyFrom(key.GetBytes()), ByteString.CopyFrom(value.GetBytes()),
                      option));
 }
示例#10
0
 private PutOption(PutOption.Builder builder)
     : base(builder)
 {
 }