/** * @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; }
public function write($oid, $buffer, $offset) { return \rados_write($this->_ioctx, $oid, $buffer, $offset); }
/** * @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; }