Vault Mirror holds a special place in my heart. It's the first utility I ever released publicly, and it was one of the first utilities to be featured on Autodesk Labs. It took me only a few hours to write, and I figured it would have a short lifetime.
Much to my delight, the utility is still in use today by many people, and in ways that I never imagined. Brian Schanen has already blogged about this, but I want to add my own technical perspective.
What is Vault Mirror?
It's a utility that downloads all the files from Vault for read-only purposes. It was designed to be automated, lightweight and efficient. It works with the base version of Vault, and it won't consume a license in the pay-for versions.
Vault Mirror does not create a perfect replica of a Vault. It only downloads the latest version of the files. Other things like items, properties, file history, security, lifecycle states etc. are not copied.
Where can I get it?
It's installed with the Vault Server, but you have to dig a bit in the SDK to find it. The folder location is [ADMS dir]\SDK\VS8\CSharp\VaultMirror\bin\Release
Update: In Vault 2011, the utility has been moved to a new location [ADMS dir]\SDK\util\VaultMirror
The readme (and source code) can be found two levels higher. Feel free to copy things to a more convenient location.
Uses for Vault Mirror:
If you found a use not mentioned in the list below, please let us know by posting it in the comments section.
- A basic version of replication. You want to push files to a remote location or an outside group so that they can consume the files in read-only mode.
- A basic form of backup. If you use Vault for strictly document storage, this is a good way to make backups. As an added bonus, you can quickly restore a single file that gets deleted.
- Copying files to a new Vault. Use Vault Mirror to get the files, then use Autoloader to add them to the new Vault.
- Sample code. Since the Vault API has no event model, you need to use polling to detect changes. The Vault Mirror source code has a great example of how this works. It's the sample that I always refer people to.
Full Mirror command:
The full mirror command will basically synchronize your windows folders to match the Vault folder. Be warned, this includes deleting local files/folders if it there is not a match in the Vault.
The algorithm works by going through the Vault folder-by-folder and comparing the Vault files with the files on disk. If a file exists in the Vault but not on disk, the file is downloaded. If a file exists on disk but not in the Vault, the local file is deleted. If a file exists on disk and in the Vault, the checksum is compared. If the local file has a different checksum as the Vault file, the local file is overwritten.
In practice, this command is only used to clean up things. It may take a long time to run depending on the size of the Vault, so this command should be run rarely if ever.
Partial Mirror command:
The partial mirror command will basically download all new files. Any new file is downloaded. No effort is made to clean up the local folder.
The algorithm works by doing a file search. Vault Mirror remembers when the last, time a command was run, so it searches all file versions created after the time of the last search. Any matching files are downloaded.
Since only new files are downloaded, this is a very scalable command. It's no problem to run this command every few minutes so that your mirror folder is mostly up-to-date.
Since its release, Vault has added a lot of features that I thought would make Vault Mirror obsolete. However the utility is still in use. Maybe people don't know about the other features, maybe they like Vault Mirror better, or maybe there is some aspect of the built-in feature that makes it unusable. Whatever the reason, I thought I should list the features that Vault Mirror "competes" against. That way you can choose the utility or feature that works best for you.
- Workspace Sync - With a single click you can update your workspace to match the files in Vault. It can also be run from the command line, so it's possible to automate things just like with Vault Mirror. But Workspace Sync comes with many more options.
- Replication - This features creates many versions of a file store. But unlike Vault Mirror, the replicated stores can be edited. Vault users can run check-out, rename, copy design, and so on. Basically any operation can be done. To the user, it works just like a regular Vault.
- DWF Publish - This feature existed since the early versions of Vault. You can set a Vault to publish DWF files to a folder share. Basically it's Vault Mirror, but just for DWF files.
- Hot Backup - This feature lets you back up the Vault with out having to take Vault offline. With this type of backup, you get everything. File history, meta-data, items, etc.