cassandra_Cassandra_describe_ring_result::read PHP Method

read() public method

public read ( $input )
    public function read($input)
    {
        $xfer = 0;
        $fname = null;
        $ftype = 0;
        $fid = 0;
        $xfer += $input->readStructBegin($fname);
        while (true) {
            $xfer += $input->readFieldBegin($fname, $ftype, $fid);
            if ($ftype == TType::STOP) {
                break;
            }
            switch ($fid) {
                case 0:
                    if ($ftype == TType::LST) {
                        $this->success = array();
                        $_size152 = 0;
                        $_etype155 = 0;
                        $xfer += $input->readListBegin($_etype155, $_size152);
                        for ($_i156 = 0; $_i156 < $_size152; ++$_i156) {
                            $elem157 = null;
                            $elem157 = new cassandra_TokenRange();
                            $xfer += $elem157->read($input);
                            $this->success[] = $elem157;
                        }
                        $xfer += $input->readListEnd();
                    } else {
                        $xfer += $input->skip($ftype);
                    }
                    break;
                case 1:
                    if ($ftype == TType::STRUCT) {
                        $this->ire = new cassandra_InvalidRequestException();
                        $xfer += $this->ire->read($input);
                    } else {
                        $xfer += $input->skip($ftype);
                    }
                    break;
                default:
                    $xfer += $input->skip($ftype);
                    break;
            }
            $xfer += $input->readFieldEnd();
        }
        $xfer += $input->readStructEnd();
        return $xfer;
    }

Usage Example

示例#1
0
 public function recv_describe_ring()
 {
     $bin_accel = $this->input_ instanceof TProtocol::$TBINARYPROTOCOLACCELERATED && function_exists('thrift_protocol_read_binary');
     if ($bin_accel) {
         $result = thrift_protocol_read_binary($this->input_, 'cassandra_Cassandra_describe_ring_result', $this->input_->isStrictRead());
     } else {
         $rseqid = 0;
         $fname = null;
         $mtype = 0;
         $this->input_->readMessageBegin($fname, $mtype, $rseqid);
         if ($mtype == TMessageType::EXCEPTION) {
             $x = new TApplicationException();
             $x->read($this->input_);
             $this->input_->readMessageEnd();
             throw $x;
         }
         $result = new cassandra_Cassandra_describe_ring_result();
         $result->read($this->input_);
         $this->input_->readMessageEnd();
     }
     if ($result->success !== null) {
         return $result->success;
     }
     if ($result->ire !== null) {
         throw $result->ire;
     }
     throw new Exception("describe_ring failed: unknown result");
 }
cassandra_Cassandra_describe_ring_result