Beispiel #1
0
 public AsyncOperate(AsyncOperate other)
     : base(other)
 {
     this.writePolicy = other.writePolicy;
     this.operations  = other.operations;
     this.args        = other.args;
 }
Beispiel #2
0
        public void SetOperate(WritePolicy policy, Key key, Operation[] operations, OperateArgs args)
        {
            Begin();
            int fieldCount = EstimateKeySize(policy, key);
            int predSize   = 0;

            if (policy.predExp != null)
            {
                predSize = EstimatePredExp(policy.predExp);
                fieldCount++;
            }
            dataOffset += args.size;
            SizeBuffer();

            WriteHeader(policy, args.readAttr, args.writeAttr, fieldCount, operations.Length);
            WriteKey(policy, key);

            if (policy.predExp != null)
            {
                WritePredExp(policy.predExp, predSize);
            }

            foreach (Operation operation in operations)
            {
                WriteOperation(operation);
            }
            End();
        }
        public void SetArgs(Cluster cluster, WritePolicy writePolicy, OperateArgs args)
        {
            this.writePolicy = writePolicy;
            this.args        = args;

            if (args.hasWrite)
            {
                partition = Partition.Write(cluster, writePolicy, key);
            }
            else
            {
                partition = Partition.Read(cluster, writePolicy, key);
            }
        }
Beispiel #4
0
        public void SetArgs(AsyncCluster cluster, WritePolicy writePolicy, OperateArgs args)
        {
            base.policy      = writePolicy;
            this.writePolicy = writePolicy;
            this.args        = args;

            if (args.hasWrite)
            {
                base.partition = Partition.Write(cluster, writePolicy, key);
            }
            else
            {
                base.isRead    = true;
                base.partition = Partition.Read(cluster, writePolicy, key);
            }
        }
Beispiel #5
0
        public void SetOperate(WritePolicy policy, Key key, Operation[] operations, OperateArgs args)
        {
            Begin();
            int fieldCount = EstimateKeySize(policy, key);

            dataOffset += args.size;
            SizeBuffer();

            WriteHeader(policy, args.readAttr, args.writeAttr, fieldCount, operations.Length);
            WriteKey(policy, key);

            foreach (Operation operation in operations)
            {
                WriteOperation(operation);
            }
            End();
        }
Beispiel #6
0
        public void EstimateOperate(Operation[] operations, OperateArgs args)
        {
            bool readBin       = false;
            bool readHeader    = false;
            bool respondAllOps = false;

            foreach (Operation operation in operations)
            {
                switch (operation.type)
                {
                case Operation.Type.MAP_READ:
                    // Map operations require respondAllOps to be true.
                    respondAllOps  = true;
                    args.readAttr |= Command.INFO1_READ;

                    // Read all bins if no bin is specified.
                    if (operation.binName == null)
                    {
                        args.readAttr |= Command.INFO1_GET_ALL;
                    }
                    readBin = true;
                    break;

                case Operation.Type.CDT_READ:
                case Operation.Type.READ:
                    args.readAttr |= Command.INFO1_READ;

                    // Read all bins if no bin is specified.
                    if (operation.binName == null)
                    {
                        args.readAttr |= Command.INFO1_GET_ALL;
                    }
                    readBin = true;
                    break;

                case Operation.Type.READ_HEADER:
                    args.readAttr |= Command.INFO1_READ;
                    readHeader     = true;
                    break;

                case Operation.Type.MAP_MODIFY:
                    // Map operations require respondAllOps to be true.
                    respondAllOps  = true;
                    args.writeAttr = Command.INFO2_WRITE;
                    break;

                default:
                    args.writeAttr = Command.INFO2_WRITE;
                    args.hasWrite  = true;
                    break;
                }
                EstimateOperationSize(operation);
            }
            args.size = dataOffset;

            if (readHeader && !readBin)
            {
                args.readAttr |= Command.INFO1_NOBINDATA;
            }

            if (respondAllOps)
            {
                args.writeAttr |= Command.INFO2_RESPOND_ALL_OPS;
            }
        }
Beispiel #7
0
 public void SetArgs(WritePolicy writePolicy, OperateArgs args)
 {
     base.policy      = writePolicy;
     this.writePolicy = writePolicy;
     this.args        = args;
 }
 public AsyncOperate(AsyncOperate other)
     : base(other)
 {
     this.args = other.args;
 }
 public AsyncOperate(AsyncCluster cluster, RecordListener listener, Key key, OperateArgs args)
     : base(cluster, args.writePolicy, listener, key, args.partition)
 {
     this.args = args;
 }
 public OperateCommand(Cluster cluster, Key key, OperateArgs args)
     : base(cluster, args.writePolicy, key, args.partition)
 {
     this.args = args;
 }