Skip to content

Commit

Permalink
[XrdEc] Implement Reader::Close.
Browse files Browse the repository at this point in the history
  • Loading branch information
simonmichal committed Jan 13, 2021
1 parent 9faaa1f commit a3e7d65
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
24 changes: 24 additions & 0 deletions src/XrdEc/XrdEcReader.cc
Expand Up @@ -479,6 +479,30 @@ namespace XrdEc
}
}

//-----------------------------------------------------------------------
// Close the data object
//-----------------------------------------------------------------------
void Reader::Close( XrdCl::ResponseHandler *handler )
{
//---------------------------------------------------------------------
// prepare the pipelines ...
//---------------------------------------------------------------------
std::vector<XrdCl::Pipeline> closes;
closes.reserve( dataarchs.size() );
auto itr = dataarchs.begin();
for( ; itr != dataarchs.end() ; ++itr )
{
XrdCl::ZipArchive &zip = *itr->second;
if( zip.IsOpen() )
closes.emplace_back( XrdCl::CloseArchive( zip ) );
}

// if there is nothing to close just schedule the handler
if( closes.empty() ) ScheduleHandler( handler );
// otherwise close the archives
else XrdCl::Async( XrdCl::Parallel( closes ) >> handler );
}

//-------------------------------------------------------------------------
// on-definition is not allowed here beforeiven stripes from given block
//-------------------------------------------------------------------------
Expand Down
5 changes: 5 additions & 0 deletions src/XrdEc/XrdEcReader.hh
Expand Up @@ -89,6 +89,11 @@ namespace XrdEc
void *buffer,
XrdCl::ResponseHandler *handler );

//-----------------------------------------------------------------------
//! Close the data object
//-----------------------------------------------------------------------
void Close( XrdCl::ResponseHandler *handler );

private:

//-----------------------------------------------------------------------
Expand Down

0 comments on commit a3e7d65

Please sign in to comment.