public static void Prepare(TestContext testContext)
 {
     Policy policy = new Policy();
     policy.timeout = 0; // Do not timeout on index create.
     IndexTask task = client.CreateIndex(policy, args.ns, args.set, indexName, binName, IndexType.NUMERIC);
     task.Wait();
 }
 public ReadHeaderCommand(Cluster cluster, Policy policy, Key key)
 {
     this.cluster = cluster;
     this.policy = policy;
     this.key = key;
     this.partition = new Partition(key);
 }
        public static void Prepare(TestContext testContext)
        {
            Assembly assembly = Assembly.GetExecutingAssembly();
            RegisterTask rtask = client.Register(null, assembly, "Aerospike.Test.Resources.record_example.lua", "record_example.lua", Language.LUA);
            rtask.Wait();

            Policy policy = new Policy();
            policy.timeout = 0; // Do not timeout on index create.
            IndexTask task = client.CreateIndex(policy, args.ns, args.set, indexName, binName, IndexType.STRING, IndexCollectionType.MAPKEYS);
            task.Wait();

            for (int i = 1; i <= size; i++)
            {
                Key key = new Key(args.ns, args.set, keyPrefix + i);
                Dictionary<string, string> map = new Dictionary<string, string>();

                map[mapKeyPrefix + 1] = mapValuePrefix + i;
                if (i % 2 == 0)
                {
                    map[mapKeyPrefix + 2] = mapValuePrefix + i;
                }
                if (i % 3 == 0)
                {
                    map[mapKeyPrefix + 3] = mapValuePrefix + i;
                }

                Bin bin = new Bin(binName, map);
                client.Put(null, key, bin);
            }
        }
        public static void Main(string[] args)
        {
            var client = Connect();
            var policy = new Policy();
            var writePolicy = new WritePolicy();
            var batchPolicy = new BatchPolicy();

            //NOTE: adjust the timeout value depending on your demo machine
            writePolicy.timeout = 1000;
            var key = new Key("test", "myset", "mykey");

            WriteSingleValue(client, writePolicy, key);
            CheckKeyExists(client, policy, key);
            AddSingleValue(client, writePolicy);
            WriteMultipleValues(client, writePolicy, key);
            WriteValueWithTtl(client);

            ReadAllValuesForKey(client, policy, key);
            ReadSomeValuesForKey(client, policy, key);

            DeleteValue(client, writePolicy, key);
            DeleteRecord(client, writePolicy, key);

            AddRecords(client, writePolicy);
            BatchReadRecords(client, batchPolicy);

            MultiOps(client, writePolicy, key);

            client.Close();
        }
 public QueryRecordCommand(Node node, Policy policy, Statement statement, RecordSet recordSet)
     : base(node, true)
 {
     this.policy = policy;
     this.statement = statement;
     this.recordSet = recordSet;
 }
 public AsyncReadHeader(AsyncCluster cluster, Policy policy, RecordListener listener, Key key)
     : base(cluster)
 {
     this.policy = policy;
     this.listener = listener;
     this.key = key;
     this.partition = new Partition(key);
 }
Ejemplo n.º 7
0
 public ReadCommand(Cluster cluster, Policy policy, Key key, string[] binNames)
 {
     this.cluster = cluster;
     this.policy = policy;
     this.key = key;
     this.partition = new Partition(key);
     this.binNames = binNames;
 }
 private static void CheckKeyExists(AerospikeClient client, Policy policy,
         Key key)
 {
     Console.WriteLine("Check a record exists");
     var exists = client.Exists(policy, key);
     Console.WriteLine(key + " exists? " + exists);
     Console.WriteLine("");
 }
        private void CreateIndex(AerospikeClient client, Arguments args, IndexCollectionType indexType, string indexName, string binName)
        {
            console.Info("Create GeoJSON {0} index: ns={1} set={2} index={3} bin={4}", indexType, args.ns, args.set, indexName, binName);

            Policy policy = new Policy();
            policy.timeout = 0; // Do not timeout on index create.
            IndexTask task = client.CreateIndex(policy, args.ns, args.set, indexName, binName, IndexType.GEO2DSPHERE, indexType);
            task.Wait();
        }
Ejemplo n.º 10
0
        private void CreateIndex(AsyncClient client, Arguments args, string indexName, string binName)
        {
            console.Info("Create index: ns=" + args.ns + " set=" + args.set + " index=" + indexName + " bin=" + binName);

            Policy policy = new Policy();
            policy.timeout = 0; // Do not timeout on index create.
            IndexTask task = client.CreateIndex(policy, args.ns, args.set, indexName, binName, IndexType.NUMERIC);
            task.Wait();
        }
Ejemplo n.º 11
0
 public AsyncRead(AsyncCluster cluster, Policy policy, RecordListener listener, Key key, string[] binNames)
     : base(cluster)
 {
     this.policy = policy;
     this.listener = listener;
     this.key = key;
     this.partition = new Partition(key);
     this.binNames = binNames;
 }
Ejemplo n.º 12
0
        private void CreateIndex(AerospikeClient client, Arguments args, string indexName, string binName)
        {
            console.Info("Create index: ns={0} set={1} index={2} bin={3}",
                args.ns, args.set, indexName, binName);

            Policy policy = new Policy();
            policy.timeout = 0; // Do not timeout on index create.
            IndexTask task = client.CreateIndex(policy, args.ns, args.set, indexName, binName, IndexType.NUMERIC);
            task.Wait();
        }
        public static void Prepare(TestContext testContext)
        {
            Policy policy = new Policy();
            policy.timeout = 0; // Do not timeout on index create.
            IndexTask task = client.CreateIndex(policy, args.ns, args.set, indexName, binName, IndexType.NUMERIC);
            task.Wait();

            for (int i = 1; i <= size; i++)
            {
                Key key = new Key(args.ns, args.set, keyPrefix + i);
                Bin bin = new Bin(binName, i);
                client.Put(null, key, bin);
            }
        }
        public QueryAggregateCommand(
			Node node,
			Policy policy,
			Statement statement,
			BlockingCollection<object> inputQueue,
			CancellationToken cancelToken
		)
            : base(node, true)
        {
            this.policy = policy;
            this.statement = statement;
            this.inputQueue = inputQueue;
            this.cancelToken = cancelToken;
        }
 protected override void ReadRecord(Policy policy, Key key, string binName)
 {
     if (shared.readLatency != null)
     {
         Stopwatch watch = Stopwatch.StartNew();
         Record record = client.Get(policy, key, binName);
         double elapsed = watch.Elapsed.TotalMilliseconds;
         OnReadSuccess(elapsed);
     }
     else
     {
         Record record = client.Get(policy, key, binName);
         OnReadSuccess();
     }
 }
        public static void Prepare(TestContext testContext)
        {
            Assembly assembly = Assembly.GetExecutingAssembly();
            RegisterTask rtask = client.Register(null, assembly, "Aerospike.Test.Resources.filter_example.lua", "filter_example.lua", Language.LUA);
            rtask.Wait();

            Policy policy = new Policy();
            policy.timeout = 0; // Do not timeout on index create.
            IndexTask itask = client.CreateIndex(policy, args.ns, args.set, indexName, binName, IndexType.STRING);
            itask.Wait();

            WriteRecord(keyPrefix + 1, "Charlie", "cpass");
            WriteRecord(keyPrefix + 2, "Bill", "hknfpkj");
            WriteRecord(keyPrefix + 3, "Doug", "dj6554");
        }
        public static void Prepare(TestContext testContext)
        {
            Assembly assembly = Assembly.GetExecutingAssembly();
            RegisterTask rtask = client.Register(null, assembly, "Aerospike.Test.Resources.record_example.lua", "record_example.lua", Language.LUA);
            rtask.Wait();

            Policy policy = new Policy();
            policy.timeout = 0; // Do not timeout on index create.
            IndexTask itask = client.CreateIndex(policy, args.ns, args.set, indexName, binName1, IndexType.NUMERIC);
            itask.Wait();

            for (int i = 1; i <= size; i++)
            {
                Key key = new Key(args.ns, args.set, keyPrefix + i);
                client.Put(null, key, new Bin(binName1, i), new Bin(binName2, i));
            }
        }
        protected override void ReadRecord(Policy policy, Key key, string binName)
        {
            // If timeout occurred, yield thread to back off throttle.
            // Fail counters are reset every second.
            if (shared.readTimeoutCount > 0)
            {
                Thread.Yield();
            }

            if (shared.readLatency != null)
            {
                client.Get(policy, new LatencyReadHandler(this, key), key, binName);
            }
            else
            {
                client.Get(policy, new ReadHandler(this, key), key, binName);
            }
        }
Ejemplo n.º 19
0
        private bool RetryOnInit()
        {
            if (complete != 0)
            {
                AlreadyCompleted(complete);
                return(true);
            }

            Policy policy = GetPolicy();

            if (++iteration > policy.maxRetries)
            {
                return(FailOnNetworkInit());
            }

            // Disable sleep between retries.  Sleeping in asynchronous mode makes no sense.
            //if (watch != null && (watch.ElapsedMilliseconds + policy.sleepBetweenRetries) > timeout)
            if (watch != null && watch.ElapsedMilliseconds > timeout)
            {
                // Might as well stop here because the transaction will
                // timeout after sleep completed.
                return(FailOnNetworkInit());
            }

            // Prepare for retry.
            ResetConnection();

            // Disable sleep between retries.  Sleeping in asynchronous mode makes no sense.
            //if (policy.sleepBetweenRetries > 0)
            //{
            //	Util.Sleep(policy.sleepBetweenRetries);
            //}

            // Retry command recursively.
            ExecuteCommand();
            return(true);
        }
Ejemplo n.º 20
0
        public AsyncBatchExistsArrayDirect(
			AsyncMultiExecutor parent,
			AsyncCluster cluster,
			AsyncNode node,
			BatchNode.BatchNamespace batch,
			Policy policy,
			Key[] keys,
			bool[] existsArray
		)
            : base(parent, cluster, node, false)
        {
            this.batch = batch;
            this.policy = policy;
            this.keys = keys;
            this.existsArray = existsArray;
        }
Ejemplo n.º 21
0
 /// <summary>
 /// Initialize task with fields needed to query server nodes.
 /// </summary>
 public IndexTask(Cluster cluster, Policy policy, string ns, string indexName)
     : base(cluster, policy)
 {
     this.ns        = ns;
     this.indexName = indexName;
 }
Ejemplo n.º 22
0
 /// <summary>
 /// Initialize task with fields needed to query server nodes.
 /// </summary>
 public RegisterTask(Cluster cluster, Policy policy, string packageName)
     : base(cluster, policy)
 {
     this.packageName = packageName;
 }
Ejemplo n.º 23
0
        private void WriteKey(Policy policy, Key key)
        {
            // Write key into buffer.
            if (key.ns != null)
            {
                WriteField(key.ns, FieldType.NAMESPACE);
            }

            if (key.setName != null)
            {
                WriteField(key.setName, FieldType.TABLE);
            }

            WriteField(key.digest, FieldType.DIGEST_RIPE);

            if (policy.sendKey)
            {
                WriteField(key.userKey, FieldType.KEY);
            }
        }
Ejemplo n.º 24
0
        public void Execute()
        {
            Policy    policy          = GetPolicy();
            int       remainingMillis = policy.timeout;
            DateTime  limit           = DateTime.UtcNow.AddMilliseconds(remainingMillis);
            Node      node            = null;
            Exception exception       = null;
            int       failedNodes     = 0;
            int       failedConns     = 0;
            int       iterations      = 0;

            dataBuffer = ThreadLocalData.GetBuffer();

            // Execute command until successful, timed out or maximum iterations have been reached.
            while (true)
            {
                try
                {
                    node = GetNode();
                    Connection conn = node.GetConnection(remainingMillis);

                    try
                    {
                        // Set command buffer.
                        WriteBuffer();

                        // Check if timeout needs to be changed in send buffer.
                        if (remainingMillis != policy.timeout)
                        {
                            // Reset timeout in send buffer (destined for server) and socket.
                            ByteUtil.IntToBytes((uint)remainingMillis, dataBuffer, 22);
                        }

                        // Send command.
                        conn.Write(dataBuffer, dataOffset);

                        // Parse results.
                        ParseResult(conn);

                        // Put connection back in pool.
                        node.PutConnection(conn);

                        // Command has completed successfully.  Exit method.
                        return;
                    }
                    catch (AerospikeException ae)
                    {
                        if (ae.KeepConnection())
                        {
                            // Put connection back in pool.
                            node.PutConnection(conn);
                        }
                        else
                        {
                            // Close socket to flush out possible garbage.  Do not put back in pool.
                            node.CloseConnection(conn);
                        }
                        throw;
                    }
                    catch (SocketException se)
                    {
                        // Socket errors are considered temporary anomalies.
                        // Retry after closing connection.
                        node.CloseConnection(conn);
                        exception = se;
                    }
                    catch (Exception)
                    {
                        // All other exceptions are considered fatal.  Do not retry.
                        // Close socket to flush out possible garbage.  Do not put back in pool.
                        node.CloseConnection(conn);
                        throw;
                    }
                }
                catch (AerospikeException.InvalidNode ine)
                {
                    // Node is currently inactive.  Retry.
                    exception = ine;
                    failedNodes++;
                }
                catch (AerospikeException.Connection ce)
                {
                    // Socket connection error has occurred. Retry.
                    exception = ce;
                    failedConns++;
                }

                if (++iterations > policy.maxRetries)
                {
                    break;
                }

                // Check for client timeout.
                if (policy.timeout > 0 && !policy.retryOnTimeout)
                {
                    // Timeout is absolute.  Stop if timeout has been reached.
                    remainingMillis = (int)limit.Subtract(DateTime.UtcNow).TotalMilliseconds - policy.sleepBetweenRetries;

                    if (remainingMillis <= 0)
                    {
                        break;
                    }
                }

                if (policy.sleepBetweenRetries > 0)
                {
                    // Sleep before trying again.
                    Util.Sleep(policy.sleepBetweenRetries);
                }

                // Reset node reference and try again.
                node = null;
            }

            // Retries have been exhausted.  Throw last exception.
            if (exception is SocketException && ((SocketException)exception).ErrorCode == (int)SocketError.TimedOut)
            {
                throw new AerospikeException.Timeout(node, policy.timeout, iterations, failedNodes, failedConns);
            }
            throw exception;
        }
Ejemplo n.º 25
0
 public ReadCommand(Policy policy, Key key, string[] binNames)
 {
     this.policy   = policy;
     this.key      = key;
     this.binNames = binNames;
 }
Ejemplo n.º 26
0
 public ReadCommand(Key key)
 {
     this.policy   = null;
     this.key      = key;
     this.binNames = null;
 }
Ejemplo n.º 27
0
 public void SetReadHeader(Policy policy, Key key)
 {
     Begin();
     int fieldCount = EstimateKeySize(policy, key);
     EstimateOperationSize((string)null);
     SizeBuffer();
     WriteHeader(policy, Command.INFO1_READ | Command.INFO1_NOBINDATA, 0, fieldCount, 0);
     WriteKey(policy, key);
     End();
 }
Ejemplo n.º 28
0
        public void SetRead(Policy policy, Key key, string[] binNames)
        {
            if (binNames != null)
            {
                Begin();
                int fieldCount = EstimateKeySize(policy, key);

                foreach (string binName in binNames)
                {
                    EstimateOperationSize(binName);
                }
                SizeBuffer();
                WriteHeader(policy, Command.INFO1_READ, 0, fieldCount, binNames.Length);
                WriteKey(policy, key);

                foreach (string binName in binNames)
                {
                    WriteOperation(binName, Operation.Type.READ);
                }
                End();
            }
            else
            {
                SetRead(policy, key);
            }
        }
Ejemplo n.º 29
0
 public void SetRead(Policy policy, Key key)
 {
     Begin();
     int fieldCount = EstimateKeySize(policy, key);
     SizeBuffer();
     WriteHeader(policy, Command.INFO1_READ | Command.INFO1_GET_ALL, 0, fieldCount, 0);
     WriteKey(policy, key);
     End();
 }
Ejemplo n.º 30
0
 public void SetExists(Policy policy, Key key)
 {
     Begin();
     int fieldCount = EstimateKeySize(policy, key);
     SizeBuffer();
     WriteHeader(policy, Command.INFO1_READ | Command.INFO1_NOBINDATA, 0, fieldCount, 0);
     WriteKey(policy, key);
     End();
 }
		public Executor(Cluster cluster, Policy policy, int capacity)
		{
			this.cluster = cluster;
			this.policy = policy;
			threads = new List<ExecutorThread>(capacity);
		}
Ejemplo n.º 32
0
        public AsyncBatchExistsSequenceDirect(
			AsyncMultiExecutor parent,
			AsyncCluster cluster,
			AsyncNode node,
			BatchNode.BatchNamespace batch,
			Policy policy,
			Key[] keys,
			ExistsSequenceListener listener
		)
            : base(parent, cluster, node, false)
        {
            this.batch = batch;
            this.policy = policy;
            this.keys = keys;
            this.listener = listener;
        }
Ejemplo n.º 33
0
        protected internal void SetQuery(Policy policy, Statement statement, bool write)
        {
            byte[] functionArgBuffer = null;
            int fieldCount = 0;
            int filterSize = 0;
            int binNameSize = 0;

            Begin();

            if (statement.ns != null)
            {
                dataOffset += ByteUtil.EstimateSizeUtf8(statement.ns) + FIELD_HEADER_SIZE;
                fieldCount++;
            }

            if (statement.indexName != null)
            {
                dataOffset += ByteUtil.EstimateSizeUtf8(statement.indexName) + FIELD_HEADER_SIZE;
                fieldCount++;
            }

            if (statement.setName != null)
            {
                dataOffset += ByteUtil.EstimateSizeUtf8(statement.setName) + FIELD_HEADER_SIZE;
                fieldCount++;
            }

            // Allocate space for TaskId field.
            dataOffset += 8 + FIELD_HEADER_SIZE;
            fieldCount++;

            if (statement.filters != null)
            {
                if (statement.filters.Length >= 1)
                {
                    IndexCollectionType type = statement.filters[0].CollectionType;

                    if (type != IndexCollectionType.DEFAULT)
                    {
                        dataOffset += FIELD_HEADER_SIZE + 1;
                        fieldCount++;
                    }
                }

                dataOffset += FIELD_HEADER_SIZE;
                filterSize++; // num filters

                foreach (Filter filter in statement.filters)
                {
                    filterSize += filter.EstimateSize();
                }
                dataOffset += filterSize;
                fieldCount++;

                // Query bin names are specified as a field (Scan bin names are specified later as operations)
                if (statement.binNames != null)
                {
                    dataOffset += FIELD_HEADER_SIZE;
                    binNameSize++; // num bin names

                    foreach (string binName in statement.binNames)
                    {
                        binNameSize += ByteUtil.EstimateSizeUtf8(binName) + 1;
                    }
                    dataOffset += binNameSize;
                    fieldCount++;
                }
            }
            else
            {
                // Calling query with no filters is more efficiently handled by a primary index scan.
                // Estimate scan options size.
                dataOffset += 2 + FIELD_HEADER_SIZE;
                fieldCount++;
            }

            if (statement.functionName != null)
            {
                dataOffset += FIELD_HEADER_SIZE + 1; // udf type
                dataOffset += ByteUtil.EstimateSizeUtf8(statement.packageName) + FIELD_HEADER_SIZE;
                dataOffset += ByteUtil.EstimateSizeUtf8(statement.functionName) + FIELD_HEADER_SIZE;

                if (statement.functionArgs.Length > 0)
                {
                    functionArgBuffer = Packer.Pack(statement.functionArgs);
                }
                else
                {
                    functionArgBuffer = new byte[0];
                }
                dataOffset += FIELD_HEADER_SIZE + functionArgBuffer.Length;
                fieldCount += 4;
            }

            if (statement.filters == null)
            {
                if (statement.binNames != null)
                {
                    foreach (string binName in statement.binNames)
                    {
                        EstimateOperationSize(binName);
                    }
                }
            }

            SizeBuffer();
            int operationCount = (statement.filters == null && statement.binNames != null) ? statement.binNames.Length : 0;

            if (write)
            {
                WriteHeader((WritePolicy)policy, Command.INFO1_READ, Command.INFO2_WRITE, fieldCount, operationCount);
            }
            else
            {
                WriteHeader(policy, Command.INFO1_READ, 0, fieldCount, operationCount);
            }

            if (statement.ns != null)
            {
                WriteField(statement.ns, FieldType.NAMESPACE);
            }

            if (statement.indexName != null)
            {
                WriteField(statement.indexName, FieldType.INDEX_NAME);
            }

            if (statement.setName != null)
            {
                WriteField(statement.setName, FieldType.TABLE);
            }

            // Write taskId field
            WriteFieldHeader(8, FieldType.TRAN_ID);
            ByteUtil.LongToBytes(statement.taskId, dataBuffer, dataOffset);
            dataOffset += 8;

            if (statement.filters != null)
            {
                if (statement.filters.Length >= 1)
                {
                    IndexCollectionType type = statement.filters[0].CollectionType;

                    if (type != IndexCollectionType.DEFAULT)
                    {
                        WriteFieldHeader(1, FieldType.INDEX_TYPE);
                        dataBuffer[dataOffset++] = (byte)type;
                    }
                }

                WriteFieldHeader(filterSize, FieldType.INDEX_RANGE);
                dataBuffer[dataOffset++] = (byte)statement.filters.Length;

                foreach (Filter filter in statement.filters)
                {
                    dataOffset = filter.Write(dataBuffer, dataOffset);
                }

                // Query bin names are specified as a field (Scan bin names are specified later as operations)
                if (statement.binNames != null)
                {
                    WriteFieldHeader(binNameSize, FieldType.QUERY_BINLIST);
                    dataBuffer[dataOffset++] = (byte)statement.binNames.Length;

                    foreach (string binName in statement.binNames)
                    {
                        int len = ByteUtil.StringToUtf8(binName, dataBuffer, dataOffset + 1);
                        dataBuffer[dataOffset] = (byte)len;
                        dataOffset += len + 1;
                    }
                }
            }
            else
            {
                // Calling query with no filters is more efficiently handled by a primary index scan.
                WriteFieldHeader(2, FieldType.SCAN_OPTIONS);
                byte priority = (byte)policy.priority;
                priority <<= 4;
                dataBuffer[dataOffset++] = priority;
                dataBuffer[dataOffset++] = (byte)100;
            }

            if (statement.functionName != null)
            {
                WriteFieldHeader(1, FieldType.UDF_OP);
                dataBuffer[dataOffset++] = (statement.returnData) ? (byte)1 : (byte)2;
                WriteField(statement.packageName, FieldType.UDF_PACKAGE_NAME);
                WriteField(statement.functionName, FieldType.UDF_FUNCTION);
                WriteField(functionArgBuffer, FieldType.UDF_ARGLIST);
            }

            // Scan bin names are specified after all fields.
            if (statement.filters == null)
            {
                if (statement.binNames != null)
                {
                    foreach (string binName in statement.binNames)
                    {
                        WriteOperation(binName, Operation.Type.READ);
                    }
                }
            }
            End();
        }
Ejemplo n.º 34
0
        public AsyncBatchGetSequenceDirect(
			AsyncMultiExecutor parent,
			AsyncCluster cluster,
			AsyncNode node,
			BatchNode.BatchNamespace batch,
			Policy policy,
			Key[] keys,
			string[] binNames,
			RecordSequenceListener listener,
			int readAttr
		)
            : base(parent, cluster, node, false)
        {
            this.batch = batch;
            this.policy = policy;
            this.keys = keys;
            this.binNames = binNames;
            this.listener = listener;
            this.readAttr = readAttr;
        }
Ejemplo n.º 35
0
        private int EstimateKeySize(Policy policy, Key key)
        {
            int fieldCount = 0;

            if (key.ns != null)
            {
                dataOffset += ByteUtil.EstimateSizeUtf8(key.ns) + FIELD_HEADER_SIZE;
                fieldCount++;
            }

            if (key.setName != null)
            {
                dataOffset += ByteUtil.EstimateSizeUtf8(key.setName) + FIELD_HEADER_SIZE;
                fieldCount++;
            }

            dataOffset += key.digest.Length + FIELD_HEADER_SIZE;
            fieldCount++;

            if (policy.sendKey)
            {
                dataOffset += key.userKey.EstimateSize() + FIELD_HEADER_SIZE + 1;
                fieldCount++;
            }
            return fieldCount;
        }
Ejemplo n.º 36
0
 protected internal Arguments()
 {
     this.writePolicy = new WritePolicy();
     this.policy = new Policy();
 }
Ejemplo n.º 37
0
        /// <summary>
        /// Generic header write.
        /// </summary>
        private void WriteHeader(Policy policy, int readAttr, int writeAttr, int fieldCount, int operationCount)
        {
            if (policy.consistencyLevel == ConsistencyLevel.CONSISTENCY_ALL)
            {
                readAttr |= Command.INFO1_CONSISTENCY_ALL;
            }

            dataOffset += 8;

            // Write all header data except total size which must be written last.
            dataBuffer[dataOffset++] = MSG_REMAINING_HEADER_SIZE; // Message header length.
            dataBuffer[dataOffset++] = (byte)readAttr;
            dataBuffer[dataOffset++] = (byte)writeAttr;

            for (int i = 0; i < 15; i++)
            {
                dataBuffer[dataOffset++] = 0;
            }
            dataOffset += ByteUtil.ShortToBytes((ushort)fieldCount, dataBuffer, dataOffset);
            dataOffset += ByteUtil.ShortToBytes((ushort)operationCount, dataBuffer, dataOffset);
        }
Ejemplo n.º 38
0
 public ExistsCommand(Policy policy, Key key)
 {
     this.policy = policy;
     this.key    = key;
 }
 public AsyncMultiCommand(AsyncMultiExecutor parent, AsyncCluster cluster, Policy policy, AsyncNode node, bool stopOnNotFound)
     : base(cluster, policy, null, node, true)
 {
     this.parent         = parent;
     this.stopOnNotFound = stopOnNotFound;
 }