Logo
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
block_node.hh
Go to the documentation of this file.
1 #pragma once
2 
3 #include "../nodes/node.hh"
4 #include "local_io.hh"
5 #include "../messages/IOoperation.hh"
6 #include <string>
7 
8 namespace eclipse {
9 
10 using vec_str = std::vector<std::string>;
11 
12 class BlockNode: public Node {
13  public:
15  ~BlockNode ();
16 
18  bool block_insert_local(Block&, bool replicate = true);
19 
21  bool block_delete_local(Block&, bool replicate = true);
22 
24  bool block_update_local(Block& block, uint32_t pos, uint32_t len, bool replicate = true);
25 
27  bool block_read_local(Block& block, uint64_t off = 0, uint64_t len = 0, bool ignore_params = true);
28 
29  protected:
31 
34 };
35 
36 }
~BlockNode()
Definition: block_node.cc:18
Definition: IOoperation.hh:9
std::pair< std::string, std::string > Block
Definition: block.hh:4
Definition: node.hh:14
Represents the local disk.
Definition: local_io.hh:11
int network_size
Definition: block_node.hh:33
bool block_update_local(Block &block, uint32_t pos, uint32_t len, bool replicate=true)
Update the content of the block.
Definition: block_node.cc:80
std::vector< std::string > vec_str
Definition: block_node.hh:10
Local_io local_io
Definition: block_node.hh:32
void replicate_message(messages::IOoperation *)
Compute the right and left node of the current node and send its replicas of the given block...
Definition: block_node.cc:23
Definition: block_node.hh:12
BlockNode(network::ClientHandler *)
Definition: block_node.cc:13
bool block_delete_local(Block &, bool replicate=true)
Delete Local block.
Definition: block_node.cc:64
Definition: client_handler.hh:12
bool block_read_local(Block &block, uint64_t off=0, uint64_t len=0, bool ignore_params=true)
Read block from the local node.
Definition: block_node.cc:56
bool block_insert_local(Block &, bool replicate=true)
Save to disk a block and replicate.
Definition: block_node.cc:37