#SchmierHashtable
"Eu vou passar schimia no pão, ia,ia
vou falar que eu sou alemão,ia,ia
traz a cuca e o salame meu, ia,ia
tudo ao som de um trombone, ia,ia
eu vou passar schimia no pão
vou falar que eu sou alemão
este é o bonde do alemão
então libera, libera, libera mais um chopp!"
Banda 2001
https://www.youtube.com/watch?v=W5UdppSb4YA
A hashtable based file versioning library.
It allows you to create hashtables using the file paths and export it to B64 encoded strings. Where you can easily import again and check what files changed based on the hashtable.
##Installing && Compiling
Everything (build, test, install) can be done simply by:
$ make
# make install
You can make and install only the Linux library by calling:
$ make linux_lib_dynamic
# make install_linux_dynamic install_linux_headers
You can make and install only Python modules by:
$ make python_modules
# make install_python_modules
And you can create production/distribution rpm and deb packages using the command:
$ make
$ make packs
As usual, to clean the project simply:
$ make clean
##Python Integration
To help integrate with python, a full python module is provided. As it is completely in C/C++ it runs as fast as it can. To use it in your script simply import it by:
from ht_file import FileVersioning
You can have any number of FileVersioning
instances as necessary, they simply provides you four methods:
reset
clears the hashtable;add_file
Add a file name to the current hashtable;check_file
Check if the file name is in the current hashtable;get_table
Export the hashtable compressed using LZMA and encoded in B64. Useful to distribute it in JSON and other means;set_table
Sets the hashtable using the same string generated byget_table
;
##C++
###HTFileVersioning
static uint64_t getHTableBitsLen(void)
Return the hashtable size in bits;static uint32_t getHTableBytesLen(void)
Return the hashtable size in bytes;void reset(void)
Clears the hashtable;addFile
Adds a filename to hashtable;void addFile(const char *fname)
void addFile(const std::string &fname)
checkFile
Returns true if the file name is listed on hashtable;bool checkFile(const std::string &fname) const
bool checkFile(const char *fname) const
void getRawHTable(void *place, size_t len) const
Makes a copy of raw hashtable to*place
with lenghlen
;std::string getHTable(void) const
Return the hashtable compressed with LZMA and encoded in B64;setHTable
sets htable;void setHTable(std::string str)
void setHTable(void *place, size_t len)
mergeHTable
Merges the current with given hashtables.void mergeHTable(std::string str)
void mergeHTable(void *place, size_t len)
###HTDataCompress
compress
Prepare data to be used bydecompress
; oOdecompress
Return data put incompress
; =]