Recent

Author Topic: Parallel archiver using my ParallelZlib..  (Read 17879 times)

aminer

  • Hero Member
  • *****
  • Posts: 956
Parallel archiver using my ParallelZlib..
« on: February 16, 2013, 03:38:30 am »

Hello,


PZArchiver 1.0 is here...


Author: Amine Moulay Ramdane


Description: Parallel archiver using my ParallelZlib..


Supported features:

- Opens and creates archives using my ParrallelZlib

- Compiles into exe - no dll/ocx required.

- 64 bit supports - lets you create archive files over 4 GB

- Now my ParallelZlb gives 5% better performance than Pigz.

- Parallel compression and parallel decompression are extremely fast

- It supports both compression and decommpression rate indicator

- You can test your arvhive

- Easy object programming interface

- Full source codes available.

- Platform: Win32 ,Win64 (will be ported soon to Linux and Mac OS

Will support parallel encryption and LZMA and LZ and Bzip and memory streams in the near future


Please look at test.pas inside the zip file, compile and execute it.. -


You can download PZArchiver versoin 1.0 from:

http://pages.videotron.com/aminer/


Language: FPC Pascal v2.2.0+ / Delphi 7+: http://www.freepascal.org/

Operating Systems: Win32 and Win64 (will be ported soon to Linux and Mac (x86)).

And inside defines.inc you can use the following defines:

{$DEFINE CPU32} and {$DEFINE Win32} for 32 bits systems

{$DEFINE CPU64} and {$DEFINE Win64} for 64 bits systems

Required FPC switches: -O3 -Sd -dFPC -dWin32 -dFreePascal

-Sd for delphi mode....

Required Delphi switches: -DMSWINDOWS -$H+ -DDelphi



Thank you,
Amine Moulay Ramdane.

aminer

  • Hero Member
  • *****
  • Posts: 956
Re: Parallel archiver using my ParallelZlib..
« Reply #1 on: February 16, 2013, 03:41:55 am »

Hello,

You have to call the LoadIndex() method before calling any
other methods. It's mandatory.


The Object Pascal interface is very easy to use..

Here is a demo program:

==

PROGRAM TEST;

uses classes,PZarchiver,variants,zlibex,findfile,sysutils;

 var
   pzr: TPZArchiver;
   str:string;   
  st:tstrings;
 i:integer;
  ff: Tfindfile;
finfo:TZSearchRec;

Begin
 
   pzr :=TPZarchiver.Create('amine.z',1000,1000,false,4);
pzr.LoadIndex; // load the index in a hashtable: file names and its corresponding file position

st:=tstringlist.create;

ff:=TFindFile.create(nil);
ff.recurse:=true;
ff.directory:='.\';
ff.Attributes:=[ffArchive];
ff.filter:='*.dll';
ff.execute;

//st.add('tbbmalloc.dll');

pzr.indicator:=true; // to show the compression and decompression rate indicator
pzr.compressionlevel:=zcLevel6;

pzr.AddFiles(ff.files);
pzr.AddFiles(ff.files);
writeln;
st.clear;
pzr.getkeys(st);
for i:=0 to st.count-1
do writeln(st);

for i:=0 to st.count-1
do
begin
finfo:=pzr.getinfo(st);

writeln('Name is: ',finfo.name);
writeln('Uncompressed size is: ',finfo.USize);
writeln('Compressed size is: ',finfo.CSize);
writeln('Datetime is: ',DateTimeToStr(finfo.datetime));
writeln;
end;

write('Click on a key to continue...: ');
readln;

pzr.ExtractFiles(st,'c:\tmp1000'); // extract the TStringlist to the c:\tmp1000
//pzr.ExtractAll('c:\tmp1000');

pzr.test; // Test the archive file

writeln;

//pzr.DeleteFiles(st); // Delete the files in the st StringList.
//writeln('Number of files marked deleted: ', pzr.deleteditems);
//pzr.clean;

pzr.free;
st.free;
ff.free;
End.

===


Thank you,
Amine Moulay Ramdane.








aminer

  • Hero Member
  • *****
  • Posts: 956
Re: Parallel archiver using my ParallelZlib..
« Reply #2 on: February 16, 2013, 03:43:30 am »

Hello,


It's almost 3000 lines of code, so enjoy it...


Thanks,
Amine Moulay Ramdane.

aminer

  • Hero Member
  • *****
  • Posts: 956
Re: Parallel archiver using my ParallelZlib..
« Reply #3 on: February 16, 2013, 04:37:08 am »

Hello,

I want to add an important thing...

I have designed my parallel archiver 1.0  to be fault tolerant to power failures etc.

You have to call the LoadIndex() method just  after you create
you object with the constructor and it will be fault tolerant.



Thank you,
Amine Moulay Ramdane.




aminer

  • Hero Member
  • *****
  • Posts: 956
Re: Parallel archiver using my ParallelZlib..
« Reply #4 on: February 16, 2013, 01:03:04 pm »

Hello,

You can give the following CompressionLevel:

zcNone or zcLevel1 to zcLevel9.

And my parallel archiver uses direct access to the archive when
decompression etc. so it's very fast.

Next time i will add parallel encryption, and also
i will add LZMA , LZ and BZip compression and decompression,
and i will add support for memory streams, and i will
port it to Linux and Mac OSX(x86).



Thank you,
Amine Moulay Ramdane.



 




aminer

  • Hero Member
  • *****
  • Posts: 956
Re: Parallel archiver using my ParallelZlib..
« Reply #5 on: February 16, 2013, 01:05:27 pm »

Hello,

I mean my parallel archiver uses direct access to the files indide
the archive when decompression etc. so it's very fast.


Thanl you,
Amine Moulay Ramdane.

aminer

  • Hero Member
  • *****
  • Posts: 956
Re: Parallel archiver using my ParallelZlib..
« Reply #6 on: February 16, 2013, 02:29:48 pm »

Hello,

I want to add somthing..


When you want to delete files inside the archive you have to call
the DeleteFiles() method , the DeleteFiles() method will not delete
the files, it will mark the files as deleted , but it will
not delete the files , when you want to delete
completly the files , you have to calll the DeletedItems() method
to see how many files are marked deleted and after that
you use the Clean() method to delete completly the file from
the archive.

I have implemented it like that, cause it's better in my opinion..


Other than that, you have to call the LoadIndex() just
after you create your object with the constructor, it's mandatory,
and by calling the LoadIndex() method , my  Parallel archiver
will be fault tolerant to power failures etc.


That's all, hope you will enjoy it , cause my parallel archiver is  very fast and very easy to use...

 


Thank's
Amine Moulay Ramdane.
















aminer

  • Hero Member
  • *****
  • Posts: 956
Re: Parallel archiver using my ParallelZlib..
« Reply #7 on: February 16, 2013, 02:42:35 pm »

Hello

And here are all the methods that you can use:


PUBLIC METHODS:

 Constructor Create(file1:string,size,mrews:integer;casesensitive:boolean;nbrprocs);
   - Creates a new PZArchiver ready to use, size is the hashtable size for the index(Key file names and the correponding file position and with mrews The number of MREWs and casesensitive
     for case sensitive keys,the number of MREWS(multiple-readers-exclusive-writer) must be less or
     equal to the Hashtable size and file1 is the file archive,
nbrprocs is the number of cores you have specify to run parallelzlib in parallel.

Destructor Destroy;
   - Destroys the PZArchiver object and cleans up.

    procedure AddFiles;
   - Add the TStringList content to the archive.

    procedure DeleteFiles;
   - Delete the TStringList content to the archive.

  procedure ExtractFiles;
   - Extract the TStringList content from the archive.

procedure Test;
   - Test the files inside the archive.

  procedure GetInfo;
   - Get the file info that is returned in a TPZArchiver record.

 procedure ClearFile;
   - Deletes all contents of the archive.

   function Clean:boolean
   - Clean the marked deleted items from the file.

  function DeletedItems:integer
   - Return the number of items marked deleted.

  function LoadIndex:boolean
   - Load the the the key indexed and there correpondant values from the file passed to the constructor.

   function Delete(Name : String):boolean;
   - Deletes the variable with Name.

  function Exists(Name : String) : Boolean;
   - Returns True if a variable with Name exists

   procedure GetKeys(Strings : Tstrings);
   - Fills up a TStrings descendant with all the file names.

   function Count : Integer;
   - Returns the number of files.
   
 


Thank you,
Amine Moulay Ramdane.



aminer

  • Hero Member
  • *****
  • Posts: 956
Re: Parallel archiver using my ParallelZlib..
« Reply #8 on: February 16, 2013, 02:45:22 pm »

I correct:

function Exists(Name : String) : Boolean;
   - Returns True if the file Name exists


Thank's
Amine Moulay Ramdane.

aminer

  • Hero Member
  • *****
  • Posts: 956
Re: Parallel archiver using my ParallelZlib..
« Reply #9 on: February 16, 2013, 02:51:54 pm »

Hello,


Also, i have included the FindFile component, it's very easy
to use, here is how to use it:

ff:=TFindFile.create(nil); // the constructor
ff.recurse:=true; // recurse on directories
ff.directory:='c:\zip'; // your directory
ff.Attributes:=[ffArchive];
ff.filter:='*.*'; // your files..
ff.execute; // and execute

After that you pass the ff.files (that is a TStrings) to the AddFiles() method.

That's very easy.

Pealse look at the test.pas demo inside the zip file to see
how to use my Parallel archiver.




Thank's
Amine Moulay Ramdane










aminer

  • Hero Member
  • *****
  • Posts: 956
Re: Parallel archiver using my ParallelZlib..
« Reply #10 on: February 16, 2013, 03:12:40 pm »

Hello,

PZArchiver was updated to version 1.01 , i have cleaned
the public interface, you can download it from:

http://pages.videotron.com/aminer/



Thank you,
Amine Moulay Ramdane.


aminer

  • Hero Member
  • *****
  • Posts: 956
Re: Parallel archiver using my ParallelZlib..
« Reply #11 on: February 16, 2013, 03:21:20 pm »

Hello,

Please don't use directly the ParalleZlib.pas that i have
included inside the Parallel archiver zip file, cause i have
modified it to work correclty with my Parallel archiver.

If you want to use my ParallelZlib library and my Parallel compression library , you can download them 
from:

http://pages.videotron.com/aminer/


Thank you,
Amine Moulay Ramdane.



 

aminer

  • Hero Member
  • *****
  • Posts: 956
Re: Parallel archiver using my ParallelZlib..
« Reply #12 on: February 16, 2013, 03:46:33 pm »

Hello,

Question:

Why have you implemented Parallel Compression library,
ParalleZlib and also Parallel Archiver ?


Answer:

Just look here for example at the Easy Compression Library Pricing:

http://www.componentace.com/order/order_product.php?id=4

http://www.componentace.com/compression_delphi_component_streaming_compression_easy_compression_library.htm

http://www.componentace.com/products/


My Parallel compression library costs you 0$, and
my Parallel Archiver costs you also 0$.





Thank's
Amine Moulay Ramdane.









aminer

  • Hero Member
  • *****
  • Posts: 956
Re: Parallel archiver using my ParallelZlib..
« Reply #13 on: February 16, 2013, 03:58:41 pm »

Hello,

My Parallel compression library  and my ParalleZlib
and my Parallel Archiver looks like the following song of Santana:

My Parallel Archiver will get better and better in the near future...


https://www.youtube.com/watch?v=v13JAf6Oohc


Thank's
Amine Moulay Ramdane.




aminer

  • Hero Member
  • *****
  • Posts: 956
Re: Parallel archiver using my ParallelZlib..
« Reply #14 on: February 16, 2013, 04:18:43 pm »


Hello,


Here is again the public interface, i have corrected some typos,
and you will find it wrote inside pzarchiver.pas inside the zip file:



PUBLIC METHODS:

Constructor Create(file1:string,size,mrews:integer;casesensitive:boolean;nbrprocs:integer);
   - Creates a new PZArchiver ready to use, size is the hashtable size for the index(Key file names and the correponding file position and with mrews The number of MREWs and casesensitive
     for case sensitive keys,the number of MREWS(multiple-readers-exclusive-writer) must be less or
     equal to the Hashtable size and file1 is the file archive,
nbrprocs is the number of cores you have specify to run parallelzlib in parallel.

Destructor Destroy;
   - Destroys the PZArchiver object and cleans up.
   
function AddFiles;
   - Add the TStringList content to the archive.

function DeleteFiles;
   - Delete the TStringList content from the archive.

function ExtractFiles;
   - Extract the TStringList content from the archive.

function ExtractAll;
   - Extract all the files from the archive.

function Test;
   - Test the files inside the archive.

function GetInfo;
   - Get the file info that is returned in a TPZArchiver record.

function ClearFile;
   - Deletes all contents of the archive.

function Clean:boolean
   - Clean the marked deleted items from the file.

function DeletedItems:integer
   - Return the number of items marked deleted.

  function LoadIndex:boolean
   - Load the the the key indexed and there correpondant values from the file passed to the constructor.

 function Exists(Name : String) : Boolean;
   - Returns True if a file Name exists

   procedure GetKeys(Strings : Tstrings);
   - Fills up a TStrings descendant with all the file names.

   function Count : Integer;
   - Returns the number of files.
   
   function Stream2String(Stream1: TStream;var Mystring:string): boolean;
   
   procedure String2Stream(var String2BeSaved:string;  Stream1: TStream);
   
   procedure Variant2Stream(var VR:variant;  Stream1: TStream);
   
   function Stream2Variant(Stream1: TStream;var VR:variant): boolean;

 PUBLIC PROPERTIES:

   Items : Variant
   - Get the value (indexed).
 



Thank's
Amine Moulay Ramdane.

 

TinyPortal © 2005-2018