CernVM-FS  2.9.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
task_hash.cc
Go to the documentation of this file.
1 
5 #include "cvmfs_config.h"
6 #include "task_hash.h"
7 
8 #include <cstdlib>
9 
10 #include "hash.h"
11 #include "util/exception.h"
12 
13 
14 void TaskHash::Process(BlockItem *input_block) {
15  ChunkItem *chunk = input_block->chunk_item();
16  assert(chunk != NULL);
17 
18  switch (input_block->type()) {
20  shash::Update(input_block->data(), input_block->size(),
21  chunk->hash_ctx());
22  break;
24  shash::Final(chunk->hash_ctx(), chunk->hash_ptr());
25  break;
26  default:
27  PANIC(NULL);
28  }
29 
30  tubes_out_->Dispatch(input_block);
31 }
#define PANIC(...)
Definition: exception.h:26
assert((mem||(size==0))&&"Out Of Memory")
unsigned char * data()
Definition: item.h:213
TubeGroup< BlockItem > * tubes_out_
Definition: task_hash.h:20
void Update(const unsigned char *buffer, const unsigned buffer_length, ContextPtr context)
Definition: hash.cc:190
void Final(ContextPtr context, Any *any_digest)
Definition: hash.cc:221
ChunkItem * chunk_item()
Definition: item.h:221
uint32_t size()
Definition: item.h:215
Tube< ItemT >::Link * Dispatch(ItemT *item)
Definition: tube.h:256
shash::ContextPtr hash_ctx()
Definition: item.h:145
virtual void Process(BlockItem *input_block)
Definition: task_hash.cc:14
BlockType type()
Definition: item.h:218
shash::Any * hash_ptr()
Definition: item.h:146