#include <XrdEcWrtBuff.hh>
|
| WrtBuff (const ObjCfg &objcfg) |
|
| WrtBuff (WrtBuff &&wrtbuff) |
| Move constructor.
|
|
| ~WrtBuff () |
|
bool | Complete () |
| True if the buffer if full, false otherwise.
|
|
bool | Empty () |
| True if there are no data in the buffer, false otherwise.
|
|
void | Encode () |
| Calculate the parity for the data stripes and the crc32cs.
|
|
uint32_t | GetBlkSize () |
| Get size of the data in the buffer.
|
|
uint32_t | GetCrc32c (size_t strpnb) |
|
char * | GetStrpBuff (uint8_t strpnb) |
|
uint32_t | GetStrpSize (uint8_t strp) |
|
void | Pad (uint32_t size) |
|
uint32_t | Write (uint32_t size, const char *buffer) |
|
Write cache, accumulates full block and then calculates parity and all of it to the storage
Definition at line 132 of file XrdEcWrtBuff.hh.
◆ WrtBuff() [1/2]
XrdEc::WrtBuff::WrtBuff |
( |
const ObjCfg & | objcfg | ) |
|
|
inline |
Constructor
- Parameters
-
objcfg | : data object configuration |
Definition at line 140 of file XrdEcWrtBuff.hh.
140 : objcfg( objcfg ),
142 {
143 stripes.reserve( objcfg.nbchunks );
144 memset( wrtbuff.GetBuffer(), 0, wrtbuff.GetSize() );
145 }
static BufferPool & Instance()
Singleton access to the object.
References Create.
Referenced by WrtBuff().
◆ WrtBuff() [2/2]
XrdEc::WrtBuff::WrtBuff |
( |
WrtBuff && | wrtbuff | ) |
|
|
inline |
Move constructor.
Definition at line 149 of file XrdEcWrtBuff.hh.
149 : objcfg( wrtbuff.objcfg ),
150 wrtbuff( std::move( wrtbuff.wrtbuff ) ),
151 stripes( std::move( wrtbuff.stripes ) ),
152 cksums( std::move( wrtbuff.cksums ) )
153 {
154 }
References WrtBuff().
◆ ~WrtBuff()
XrdEc::WrtBuff::~WrtBuff |
( |
| ) |
|
|
inline |
◆ Complete()
bool XrdEc::WrtBuff::Complete |
( |
| ) |
|
|
inline |
True if the buffer if full, false otherwise.
Definition at line 243 of file XrdEcWrtBuff.hh.
244 {
245 return wrtbuff.GetCursor() == objcfg.datasize;
246 }
◆ Empty()
bool XrdEc::WrtBuff::Empty |
( |
| ) |
|
|
inline |
True if there are no data in the buffer, false otherwise.
Definition at line 250 of file XrdEcWrtBuff.hh.
251 {
252 return ( wrtbuff.GetSize() == 0 || wrtbuff.GetCursor() == 0 );
253 }
◆ Encode()
void XrdEc::WrtBuff::Encode |
( |
| ) |
|
|
inline |
Calculate the parity for the data stripes and the crc32cs.
Definition at line 257 of file XrdEcWrtBuff.hh.
258 {
259
260 uint8_t i ;
261 for( i = 0; i < objcfg.nbchunks; ++i )
262 stripes.emplace_back( wrtbuff.GetBuffer( i * objcfg.chunksize ), i < objcfg.nbdata );
264 cfg.GetRedundancy( objcfg ).compute( stripes );
265
266 cksums.reserve( objcfg.nbchunks );
267 for( uint8_t strpnb = 0; strpnb < objcfg.nbchunks; ++strpnb )
268 {
271 cksums.emplace_back( std::move( ftr ) );
272 }
273 }
static Config & Instance()
Singleton access.
static ThreadPool & Instance()
Singleton access.
std::future< std::invoke_result_t< FUNC, ARGs... > > Execute(FUNC func, ARGs... args)
Schedule a functional (together with its arguments) for execution.
uint32_t GetStrpSize(uint8_t strp)
References XrdEc::RedundancyProvider::compute(), XrdEc::ThreadPool::Execute(), XrdEc::Config::GetRedundancy(), GetStrpSize(), XrdEc::Config::Instance(), and XrdEc::ThreadPool::Instance().
◆ GetBlkSize()
uint32_t XrdEc::WrtBuff::GetBlkSize |
( |
| ) |
|
|
inline |
Get size of the data in the buffer.
Definition at line 236 of file XrdEcWrtBuff.hh.
237 {
238 return wrtbuff.GetCursor();
239 }
◆ GetCrc32c()
uint32_t XrdEc::WrtBuff::GetCrc32c |
( |
size_t | strpnb | ) |
|
|
inline |
Calculate the crc32c for given data stripe
- Parameters
-
strpnb | : number of the stripe |
- Returns
- : the crc32c of the data stripe
Definition at line 280 of file XrdEcWrtBuff.hh.
281 {
282 return cksums[strpnb].get();
283 }
◆ GetStrpBuff()
char * XrdEc::WrtBuff::GetStrpBuff |
( |
uint8_t | strpnb | ) |
|
|
inline |
Return buffer corresponding to given stripe
- Parameters
-
strpnb | : number of the stripe |
Definition at line 202 of file XrdEcWrtBuff.hh.
203 {
204 return stripes[strpnb].buffer;
205 }
◆ GetStrpSize()
uint32_t XrdEc::WrtBuff::GetStrpSize |
( |
uint8_t | strp | ) |
|
|
inline |
Return size of the data in the given stripe
- Parameters
-
strp | : number of the stripe |
Definition at line 211 of file XrdEcWrtBuff.hh.
212 {
213
214 if( strp < objcfg.nbdata )
215 {
216
217
218 uint64_t expsize = ( strp + 1) * objcfg.chunksize;
219 if( expsize <= wrtbuff.GetCursor() )
220 return objcfg.chunksize;
221
222
223 uint64_t delta = expsize - wrtbuff.GetCursor();
224 if( delta < objcfg.chunksize )
225 return objcfg.chunksize - delta;
226
227 return 0;
228 }
229
230
232 }
References GetStrpSize().
Referenced by Encode(), and GetStrpSize().
◆ Pad()
void XrdEc::WrtBuff::Pad |
( |
uint32_t | size | ) |
|
|
inline |
Pad the buffer with zeros.
- Parameters
-
size | : number of zeros to be written into the buffer |
Definition at line 183 of file XrdEcWrtBuff.hh.
184 {
185
186 if( wrtbuff.GetSize() != 0 )
187 {
188 wrtbuff.AdvanceCursor( size );
189 return;
190 }
191
192 wrtbuff.Allocate( objcfg.datasize );
193 memset( wrtbuff.GetBuffer(), 0, wrtbuff.GetSize() );
194 wrtbuff.SetCursor( size );
195 return;
196 }
◆ Write()
uint32_t XrdEc::WrtBuff::Write |
( |
uint32_t | size, |
|
|
const char * | buffer ) |
|
inline |
Write data into the buffer
- Parameters
-
size | : number of bytes to be written |
buffer | : buffer with data to be written |
- Returns
- : number of bytes accepted by the buffer
Definition at line 169 of file XrdEcWrtBuff.hh.
170 {
171 uint64_t bytesAccepted = size;
172 if( wrtbuff.GetCursor() + bytesAccepted > objcfg.datasize )
173 bytesAccepted = objcfg.datasize - wrtbuff.GetCursor();
174 memcpy( wrtbuff.GetBufferAtCursor(), buffer, bytesAccepted );
175 wrtbuff.AdvanceCursor( bytesAccepted );
176 return bytesAccepted;
177 }
The documentation for this class was generated from the following file: