351 if (action ==
"Open")
357 std::tie(url, flags, mode, timeout) = GetOpenArgs();
362 metric.ios[
"OpenW::n"]++;
366 metric.ios[
"OpenR::n"]++;
369 metric.ios[
"Open::n"]++;
375 [
this, orgststr{ orgststr }, ending, closing, timer, &metric](XRootDStatus& s)
mutable
377 metric.addIos(
"Open",
"e", HandleStatus(s, orgststr,
"Open"));
378 metric.addDelays(
"Open",
"tmeas", timer.elapsed());
388 else if (action ==
"Close")
390 uint16_t timeout = GetCloseArgs();
395 auto& sem = closing->get();
400 metric.ios[
"Close::n"]++;
404 [
this, orgststr{ orgststr }, ending, timer, &metric](XRootDStatus& s)
mutable
406 metric.addIos(
"Close",
"e", HandleStatus(s, orgststr,
"Close"));
407 metric.addDelays(
"Close",
"tmeas", timer.elapsed());
415 else if (action ==
"Stat")
419 std::tie(force, timeout) = GetStatArgs();
420 metric.ios[
"Stat::n"]++;
425 [
this, orgststr{ orgststr }, ending, closing, timer, &metric](XRootDStatus& s, StatInfo& r)
mutable
427 metric.addIos(
"Stat",
"e", HandleStatus(s, orgststr,
"Stat"));
428 metric.addDelays(
"Stat",
"tmeas", timer.elapsed());
438 else if (action ==
"Read")
443 std::tie(offset, buffer, timeout) = GetReadArgs();
444 metric.ios[
"Read::n"]++;
445 metric.ios[
"Read::b"] += buffer->size();
446 if ((offset + buffer->size()) > metric.ios[
"Read::o"])
447 metric.ios[
"Read::o"] = offset + buffer->size();
451 Async(
Read(file, offset, buffer->size(), buffer->data(), timeout) >>
452 [buffer, orgststr{ orgststr }, ending, closing, timer, &metric](XRootDStatus& s,
453 ChunkInfo& r)
mutable
455 metric.addIos(
"Read",
"e", HandleStatus(s, orgststr,
"Read"));
456 metric.addDelays(
"Read",
"tmeas", timer.elapsed());
468 else if (action ==
"PgRead")
473 std::tie(offset, buffer, timeout) = GetPgReadArgs();
474 metric.ios[
"PgRead::n"]++;
475 metric.ios[
"PgRead::b"] += buffer->size();
476 if ((offset + buffer->size()) > metric.ios[
"Read::o"])
477 metric.ios[
"Read::o"] = offset + buffer->size();
480 Async(
PgRead(file, offset, buffer->size(), buffer->data(), timeout) >>
481 [buffer, orgststr{ orgststr }, ending, closing, timer, &metric](XRootDStatus& s,
484 metric.addIos(
"PgRead",
"e", HandleStatus(s, orgststr,
"PgRead"));
485 metric.addDelays(
"PgRead",
"tmeas", timer.elapsed());
497 else if (action ==
"Write")
502 std::tie(offset, buffer, timeout) = GetWriteArgs();
503 metric.ios[
"Write::n"]++;
504 metric.ios[
"Write::b"] += buffer->size();
505 if ((offset + buffer->size()) > metric.ios[
"Write::o"])
506 metric.ios[
"Write::o"] = offset + buffer->size();
511 Write(file, offset, buffer->size(), buffer->data(), timeout) >>
512 [buffer, orgststr{ orgststr }, ending, closing, timer, &metric](XRootDStatus& s)
mutable
514 metric.addIos(
"Write",
"e", HandleStatus(s, orgststr,
"Write"));
515 metric.addDelays(
"Write",
"tmeas", timer.elapsed());
527 else if (action ==
"PgWrite")
532 std::tie(offset, buffer, timeout) = GetPgWriteArgs();
533 metric.ios[
"PgWrite::n"]++;
534 metric.ios[
"PgWrite::b"] += buffer->size();
535 if ((offset + buffer->size()) > metric.ios[
"Write::o"])
536 metric.ios[
"Write::o"] = offset + buffer->size();
540 PgWrite(file, offset, buffer->size(), buffer->data(), timeout) >>
541 [buffer, orgststr{ orgststr }, ending, closing, timer, &metric](XRootDStatus& s)
mutable
543 metric.addIos(
"PgWrite",
"e", HandleStatus(s, orgststr,
"PgWrite"));
544 metric.addDelays(
"PgWrite",
"tmeas", timer.elapsed());
556 else if (action ==
"Sync")
558 uint16_t timeout = GetSyncArgs();
559 metric.ios[
"Sync::n"]++;
563 [
this, orgststr{ orgststr }, ending, closing, timer, &metric](XRootDStatus& s)
mutable
565 metric.addIos(
"Sync",
"e", HandleStatus(s, orgststr,
"Sync"));
566 metric.addDelays(
"Sync",
"tmeas", timer.elapsed());
576 else if (action ==
"Truncate")
580 std::tie(size, timeout) = GetTruncateArgs();
581 metric.ios[
"Truncate::n"]++;
582 if (size > metric.ios[
"Truncate::o"])
583 metric.ios[
"Truncate::o"] = size;
588 [
this, orgststr{ orgststr }, ending, closing, timer, &metric](XRootDStatus& s)
mutable
590 metric.addIos(
"Truncate",
"e", HandleStatus(s, orgststr,
"Truncate"));
591 metric.addDelays(
"Truncate",
"tmeas", timer.elapsed());
601 else if (action ==
"VectorRead")
605 std::vector<buffer_t> buffers;
606 std::tie(chunks, timeout, buffers) = GetVectorReadArgs();
607 metric.ios[
"VectorRead::n"]++;
608 for (
auto& ch : chunks)
610 metric.ios[
"VectorRead::b"] += ch.GetLength();
611 if ((ch.GetOffset() + ch.GetLength()) > metric.ios[
"Read::o"])
612 metric.ios[
"Read::o"] = ch.GetOffset() + ch.GetLength();
619 [
this, orgststr{ orgststr }, buffers, ending, closing, timer, &metric](XRootDStatus& s, VectorReadInfo& r)
mutable
621 metric.addIos(
"VectorRead",
"e", HandleStatus(s, orgststr,
"VectorRead"));
622 metric.addDelays(
"VectorRead",
"tmeas", timer.elapsed());
634 else if (action ==
"VectorWrite")
638 std::vector<buffer_t> buffers;
639 std::tie(chunks, timeout, buffers) = GetVectorWriteArgs();
640 metric.ios[
"VectorWrite::n"]++;
641 for (
auto& ch : chunks)
643 metric.ios[
"VectorWrite::b"] += ch.GetLength();
644 if ((ch.GetOffset() + ch.GetLength()) > metric.ios[
"Write::o"])
645 metric.ios[
"Write::o"] = ch.GetOffset() + ch.GetLength();
650 [
this, orgststr{ orgststr }, buffers, ending, closing, timer, &metric](XRootDStatus& s)
mutable
652 metric.addIos(
"VectorWrite",
"e", HandleStatus(s, orgststr,
"VectorWrite"));
653 metric.addDelays(
"VectorWrite",
"tmeas", timer.elapsed());
static Log * GetLog()
Get default log.
void Warning(uint64_t topic, const char *format,...)
Report a warning.
VectorWriteImpl< false > VectorWrite(Ctx< File > file, Arg< ChunkList > chunks, uint16_t timeout=0)
Factory for creating VectorWriteImpl objects.
StatImpl< false > Stat(Ctx< File > file, Arg< bool > force, uint16_t timeout=0)
WriteImpl< false > Write(Ctx< File > file, Arg< uint64_t > offset, Arg< uint32_t > size, Arg< const void * > buffer, uint16_t timeout=0)
Factory for creating WriteImpl objects.
std::future< XRootDStatus > Async(Pipeline pipeline, uint16_t timeout=0)
ReadImpl< false > Read(Ctx< File > file, Arg< uint64_t > offset, Arg< uint32_t > size, Arg< void * > buffer, uint16_t timeout=0)
Factory for creating ReadImpl objects.
XRootDStatus WaitFor(Pipeline pipeline, uint16_t timeout=0)
OpenImpl< false > Open(Ctx< File > file, Arg< std::string > url, Arg< OpenFlags::Flags > flags, Arg< Access::Mode > mode=Access::None, uint16_t timeout=0)
Factory for creating ReadImpl objects.
PgWriteImpl< false > PgWrite(Ctx< File > file, Arg< uint64_t > offset, Arg< uint32_t > size, Arg< void * > buffer, Arg< std::vector< uint32_t >> cksums, uint16_t timeout=0)
Factory for creating PgReadImpl objects.
SyncImpl< false > Sync(Ctx< File > file, uint16_t timeout=0)
Factory for creating SyncImpl objects.
VectorReadImpl< false > VectorRead(Ctx< File > file, Arg< ChunkList > chunks, Arg< void * > buffer, uint16_t timeout=0)
Factory for creating VectorReadImpl objects.
std::vector< ChunkInfo > ChunkList
List of chunks.
TruncateImpl< false > Truncate(Ctx< File > file, Arg< uint64_t > size, uint16_t timeout)
PgReadImpl< false > PgRead(Ctx< File > file, Arg< uint64_t > offset, Arg< uint32_t > size, Arg< void * > buffer, uint16_t timeout=0)
Factory for creating PgReadImpl objects.
CloseImpl< false > Close(Ctx< File > file, uint16_t timeout=0)
Factory for creating CloseImpl objects.
Flags
Open flags, may be or'd when appropriate.
@ Write
Open only for writing.
@ Update
Open for reading and writing.