示例#1
0
 /**
  * @depends testRadosCreateIoCTX
  */
 public function testRadosWrite($ioctx)
 {
     $oid = md5(rand(0, 9999999999));
     $buf = sha1($oid);
     $r = rados_write($ioctx, $oid, $buf, 0);
     $this->assertTrue($r);
     $info = array();
     $info['oid'] = $oid;
     $info['buf'] = $buf;
     $info['ioctx'] = $ioctx;
     return $info;
 }
示例#2
0
文件: IO.php 项目: shen2/rados
 public function write($oid, $buffer, $offset)
 {
     return \rados_write($this->_ioctx, $oid, $buffer, $offset);
 }
示例#3
0
 /**
  * @param string $data
  * @return int
  * @throws RadosException
  */
 public function stream_write($data)
 {
     if (!$this->writable) {
         return 0;
     }
     if (!$this->stat) {
         throw new IOException('stat unknown');
     }
     $size = strlen($data);
     $ret = \rados_write($this->ioctx, $this->stat['oid'], $data, $this->pos);
     if (!$ret) {
         throw new IOException("Could not write to '" . $this->stat['oid'] . "'");
     }
     $this->pos += $size;
     return $size;
 }