----------------------------------------------------------------------------------------------------------------------------

Merge data from one storage to another

If you deal with large quantities of data (files in my case) you may want to have your (huge) FileStorage run in productions (basically being read only), while constructing other incremental FileStorages in another location which will periodically have to be loaded (merged) into the production one. If you have this scenario yourself, and you want to merge the incremental one to the other one, use the CLI tool merge command (or do it in your code in an automated way);

First we create the production storage


H:\CLI>FileStorageCmd.exe new production
File storage production created
This operation took 9 msecs
 

Then we create the first increment storage


H:\CLI>FileStorageCmd.exe new increment
File storage increment created
This operation took 99 msecs


We add 3 items (3x the file 'NConsoler.dll') to the increment

 
H:\CLI>FileStorageCmd.exe add increment NConsoler.dll
Storing file identifier 31998b1f-4a8e-48ac-a861-f880ad6941e9
This operation took 91 msecs
 
H:\CLI>FileStorageCmd.exe add increment NConsoler.dll
Storing file identifier 0d9f3ce7-d57d-49c4-b818-c9eb784e5457
This operation took 20 msecs
 
H:\CLI>FileStorageCmd.exe add increment NConsoler.dll
Storing file identifier cfa01c17-777e-49a9-a0e9-61972f1d0b4b
This operation took 18 msecs


We merge the increment to the production storage

 
H:\CLI>FileStorageCmd.exe merge increment production
[Source increment]
[Destination production]
  
Press enter to start merging (files will be overriden when they already exist) ...
 
. 3 (3 files/sec, 00:00:00 mins) Reading indexes....................................................
. 3 (3 files/sec, 00:00:00 mins) Writing............................................................
This operation took 121 msecs


We create a new increment

  
H:\CLI>FileStorageCmd.exe new increment2
File storage increment2 created
This operation took 9 msecs


We fill it (with the file "NConsoler.dll")

 
H:\CLI>FileStorageCmd.exe add increment2 NConsoler.dll
Storing file identifier 7a561fa4-a129-49db-96e1-0204b71374ca
This operation took 20 msecs


And we merge the second one to the production one

 
H:\CLI>FileStorageCmd.exe merge increment2 production
[Source increment2]
[Destination production]
 
Press enter to start merging (files will be overriden when they already exist) ...
 
. 1 (1 files/sec, 00:00:00 mins) Reading indexes....................................................
. 1 (1 files/sec, 00:00:00 mins) Writing............................................................
This operation took 28 msecs


The end result is a production storage containing the 4 items (3 from the first increment, and 1 from the second)

 
H:\CLI>FileStorageCmd.exe dir production
. 4 (4 files/sec, 00:00:00 mins) Dir................................................................
.
cfa01c17-777e-49a9-a0e9-61972f1d0b4b
31998b1f-4a8e-48ac-a861-f880ad6941e9
7a561fa4-a129-49db-96e1-0204b71374ca
0d9f3ce7-d57d-49c4-b818-c9eb784e5457
4 files found
This operation took 17 msecs
 

----------------------------------------------------------------------------------------------------------------------------

Last edited May 30, 2009 at 11:23 AM by barkgj, version 8

Comments

No comments yet.