forked from xrootd/xrootd
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
XrdApps::JCache: add a seperate handler for Read calls since the return
object is different from PgRead (ChunkInfo vs PageInfo)
- Loading branch information
Andreas Joachim Peters
committed
Jun 10, 2024
1 parent
f6ca2c0
commit 28cf161
Showing
4 changed files
with
82 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
72 changes: 72 additions & 0 deletions
72
src/XrdApps/XrdClJCachePlugin/handler/XrdClJCachePgReadHandler.hh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
//------------------------------------------------------------------------------ | ||
// Copyright (c) 2024 by European Organization for Nuclear Research (CERN) | ||
// Author: Andreas-Joachim Peters <[email protected]> | ||
//------------------------------------------------------------------------------ | ||
// This file is part of the XRootD software suite. | ||
// | ||
// XRootD is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU Lesser General Public License as published by | ||
// the Free Software Foundation, either version 3 of the License, or | ||
// (at your option) any later version. | ||
// | ||
// XRootD is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU General Public License for more details. | ||
// | ||
// You should have received a copy of the GNU Lesser General Public License | ||
// along with XRootD. If not, see <http://www.gnu.org/licenses/>. | ||
// | ||
// In applying this licence, CERN does not waive the privileges and immunities | ||
// granted to it by virtue of its status as an Intergovernmental Organization | ||
// or submit itself to any jurisdiction. | ||
|
||
#pragma once | ||
/*----------------------------------------------------------------------------*/ | ||
#include "XrdCl/XrdClFile.hh" | ||
#include "XrdCl/XrdClXRootDResponses.hh" | ||
/*----------------------------------------------------------------------------*/ | ||
#include "cache/Journal.hh" | ||
/*----------------------------------------------------------------------------*/ | ||
|
||
namespace XrdCl { | ||
|
||
class JCachePgReadHandler : public XrdCl::ResponseHandler | ||
// ---------------------------------------------------------------------- // | ||
{ | ||
public: | ||
JCachePgReadHandler() { } | ||
|
||
JCachePgReadHandler(JCacheReadHandler* other) { | ||
rbytes = other->rbytes; | ||
journal = other->journal; | ||
} | ||
|
||
JCachePgReadHandler(XrdCl::ResponseHandler* handler, | ||
std::atomic<uint64_t>* rbytes, | ||
Journal* journal) : handler(handler), rbytes(rbytes), journal(journal) {} | ||
|
||
virtual ~JCachePgReadHandler() {} | ||
|
||
virtual void HandleResponse(XrdCl::XRootDStatus* pStatus, | ||
XrdCl::AnyObject* pResponse) { | ||
|
||
XrdCl::PageInfo* pageInfo; | ||
if (pStatus->IsOK()) { | ||
if (pResponse) { | ||
pResponse->Get(pageInfo); | ||
// store successfull reads in the journal | ||
if (journal) journal->pwrite(pageInfo->GetBuffer(), pageInfo->GetLength(), pageInfo->GetOffset()); | ||
*rbytes+= pageInfo->GetLength(); | ||
} | ||
} | ||
handler->HandleResponse(pStatus, pResponse); | ||
} | ||
|
||
XrdCl::ResponseHandler* handler; | ||
std::atomic<uint64_t>* rbytes; | ||
Journal* journal; | ||
|
||
}; | ||
|
||
} // namespace XrdCl |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters