This class provides file repo capabilities to the knowledge base.  
 More...
#include <Files.h>
|  | 
|  | Files (ThreadSafeContext &map) | 
|  | Constructor.  More... 
 | 
|  | 
| MADARA_Export int | read_file (const std::string &knowledge_key, const std::string &filename) | 
|  | Read a file into the knowledge base.  More... 
 | 
|  | 
| MADARA_Export int | read_file (const char *filename, ACE_Mem_Map &mem_map) | 
|  | Read a file into an ACE_Mem_Map.  More... 
 | 
|  | 
| MADARA_Export int | read_policy (const std::string &policy_key, const std::string &policy_file) | 
|  | Read a policy into the knowledge base.  More... 
 | 
|  | 
| MADARA_Export int | shape_file (const std::string &source_key, const std::string &target_key, const std::string &policy_key) | 
|  | Shape a file according to a shaping policy.  More... 
 | 
|  | 
| MADARA_Export ssize_t | write_file (const std::string &knowledge_key, const std::string &filename) | 
|  | Write a file from the knowledge base to a specified location.  More... 
 | 
|  | 
| MADARA_Export ssize_t | write_file (const char *filename, void *&buffer, size_t &size) | 
|  | Write a memory buffer to file.  More... 
 | 
|  | 
This class provides file repo capabilities to the knowledge base. 
Definition at line 24 of file Files.h.
Constructor. 
- Parameters
- 
  
  
Definition at line 14 of file Files.cpp.
 
 
      
        
          | int madara::knowledge::Files::read_file | ( | const std::string & | knowledge_key, | 
        
          |  |  | const std::string & | filename | 
        
          |  | ) |  |  | 
      
 
Read a file into the knowledge base. 
- Parameters
- 
  
    | filename | file to read |  | knowledge_key | key to store the file into |  
 
Definition at line 43 of file Files.cpp.
 
 
      
        
          | int madara::knowledge::Files::read_file | ( | const char * | filename, | 
        
          |  |  | ACE_Mem_Map & | mem_map | 
        
          |  | ) |  |  | 
      
 
Read a file into an ACE_Mem_Map. 
Read a file and update a buffer and size.
- Parameters
- 
  
    | filename | file to read |  | mem_map | memory map of file |  
 
- Returns
Definition at line 32 of file Files.cpp.
 
 
      
        
          | int madara::knowledge::Files::read_policy | ( | const std::string & | policy_key, | 
        
          |  |  | const std::string & | policy_file | 
        
          |  | ) |  |  | 
      
 
Read a policy into the knowledge base. 
- Parameters
- 
  
    | policy_key | key to read the policy into |  | policy_file | file to read the policy from |  
 
Definition at line 207 of file Files.cpp.
 
 
      
        
          | int madara::knowledge::Files::shape_file | ( | const std::string & | source_key, | 
        
          |  |  | const std::string & | target_key, | 
        
          |  |  | const std::string & | policy_key | 
        
          |  | ) |  |  | 
      
 
Shape a file according to a shaping policy. 
- Parameters
- 
  
    | source_key | file that needs to be shaped |  | target_key | target key to save the shaped file into |  | policy_key | policy to use for shaping the file |  
 
Definition at line 21 of file Files.cpp.
 
 
      
        
          | ssize_t madara::knowledge::Files::write_file | ( | const std::string & | knowledge_key, | 
        
          |  |  | const std::string & | filename | 
        
          |  | ) |  |  | 
      
 
Write a file from the knowledge base to a specified location. 
- Parameters
- 
  
    | filename | file to write to |  | knowledge_key | key to read the file from |  
 
Definition at line 111 of file Files.cpp.
 
 
      
        
          | ssize_t madara::knowledge::Files::write_file | ( | const char * | filename, | 
        
          |  |  | void *& | buffer, | 
        
          |  |  | size_t & | size | 
        
          |  | ) |  |  | 
      
 
Write a memory buffer to file. 
- Parameters
- 
  
    | filename | file to write to |  | buffer | pointer to buffer |  | size | size of the buffer |  
 
- Returns
- amount written to file (-1 if error) 
Definition at line 179 of file Files.cpp.
 
 
  
  | 
        
          | const std::string madara::knowledge::Files::files_folder_ = "files" |  | staticprivate | 
 
 
  
  | 
        
          | const std::string madara::knowledge::Files::policies_folder_ = "policies" |  | staticprivate | 
 
 
The documentation for this class was generated from the following files: