| 352 | } |
| 353 | |
| 354 | static int Read(sqlite3_file *file, void *buf, int len, sqlite_int64 off) |
| 355 | { |
| 356 | auto f = (cephsqlite_file*)file; |
| 357 | auto start = ceph::coarse_mono_clock::now(); |
| 358 | df(5) << buf << " " << off << "~" << len << dendl; |
| 359 | |
| 360 | if (int rc = f->io.rs->read(buf, len, off); rc < 0) { |
| 361 | df(5) << "read failed: " << cpp_strerror(rc) << dendl; |
| 362 | if (rc == -EBLOCKLISTED) { |
| 363 | getdata(f->vfs).maybe_reconnect(f->io.cluster); |
| 364 | } |
| 365 | return SQLITE_IOERR_READ; |
| 366 | } else { |
| 367 | df(5) << "= " << rc << dendl; |
| 368 | auto end = ceph::coarse_mono_clock::now(); |
| 369 | getdata(f->vfs).logger->tinc(P_OPF_READ, end-start); |
| 370 | if (rc < len) { |
| 371 | memset((unsigned char*)buf+rc, 0, len-rc); |
| 372 | return SQLITE_IOERR_SHORT_READ; |
| 373 | } else { |
| 374 | return SQLITE_OK; |
| 375 | } |
| 376 | } |
| 377 | } |
| 378 | |
| 379 | static int Write(sqlite3_file *file, const void *buf, int len, sqlite_int64 off) |
| 380 | { |
nothing calls this directly
no test coverage detected