Run parallel instances over a shared store¶
A shared store keeps a repository's content once on your machine for any number of working trees. Each working tree over the store is an instance, with its own working tree, view, current branch, and staged state. A fragment fetched for one instance is there for every other, and it takes disk space once.
In this guide, you'll set up a shared store, add an instance for each branch, build, or automated tool you run in parallel, and keep the instances in order as you move and remove them.
If you've used Git worktrees, instances cover the same ground without a main repository:
- No instance owns the store. Delete any instance, the first one you cloned included, and the others keep working.
- Every instance is cloned. You create each one with
lore clone, or copy one you have withlore repository instance clone. No instance has to exist before the others. - Branches and revisions live in the store. A revision committed in one instance is in every other instance at once, before you push it, and it stays after you delete the instance that committed it.
- The store outlives its instances. Deleting the last instance leaves the store in place, and the next instance you clone uses it again.
Prerequisites¶
- The
loreCLI on your PATH. See Install the Lore CLI. - A repository on a Lore Server. The examples use
my-projecton the server from the Quickstart, atlore://127.0.0.1:41337/my-project.
Set up the shared store¶
-
Turn on automatic use.
Every
lore cloneandlore repository createon this machine then uses a shared store. To opt in one instance at a time instead, leave the setting off and pass--use-shared-storeeach time you clone. -
Clone the first instance.
Cloning the first instance from a server finds no store for it and creates one:
[Warn] Creating new shared store for remote lore://127.0.0.1:41337 in shared store at /home/you/.local/share/lore/shared_store/127.0.0.1_41337/shared_store Cloning repository 3f2a1b4c5d6e7f8a... branch main into /home/you/my-project-a ... Cloned in 0.12sThe instance's
.lore/holds only its config and identity. Its content lives in the store. -
Check the store.
Shared store will be used automatically: true Remote URL: 127.0.0.1:41337 Path: /home/you/.local/share/lore/shared_store/127.0.0.1_41337/shared_store Exists: trueLinux is shown. The store lives in Lore's data directory, which is
~/Library/Application Support/com.epicgames.loreon macOS and%LOCALAPPDATA%\Epic Games\lore\dataon Windows.
One store serves every repository on a Lore Server, so an instance of another repository cloned from lore://127.0.0.1:41337 uses the same store.
Note
A working tree that keeps its own store in .lore/, such as ~/my-project from the Quickstart, stays on it. To bring a repository onto the shared store, clone a new instance of it.
Keep the store on another drive¶
To keep the store somewhere other than Lore's data directory, create it there before you clone the first instance. Pass the server's address, with no repository path:
Lore creates the store in a subdirectory named after the server, /mnt/data/lore/127.0.0.1_41337/shared_store, and makes it the default store for that server, so instances cloned later use it.
Caution
Create the store before you clone any instance from the server. A store created later becomes the new default, and every instance that follows the default then opens the new, empty store and fails with anchor branch is missing.
Add an instance¶
Clone the repository again for each branch, build, or automated tool you want to run in parallel:
Cloning fetches only what the store doesn't already hold. Every lore clone option works the same over a shared store: --branch starts the instance on another branch, and --view gives it a sparse view of its own.
Clone an instance you already have¶
Each instance writes every file its view selects, so a full working tree costs its full size on disk again. To copy an instance instead, run from it:
The new instance is separate from the source, on the source's branch, revision, and staged state, with the source's uncommitted changes. On the source's volume, on a filesystem that clones files (APFS on macOS, Btrfs, XFS with reflink or bcachefs on Linux, Dev Drive or ReFS on Windows), it shares the source's data blocks and takes little space. Its first lore status --scan hashes only the files a scan of the source would: those with no modified-time record, and those changed since theirs.
Cloning first waits for Lore commands already running on the source instance in its process to finish. While it runs, Lore commands on the source instance wait for it, and so do Lore commands from other processes on every instance over the store. lore repository instance delete waits too, since it opens the store to deregister the source before it removes any file. lore repository instance move of an on-disk instance doesn't wait: it renames the source before it opens the store, so moving the source while cloning copies it makes cloning fail. A move of a virtual instance waits until cloning ends. On Windows the move is refused while cloning lists a directory of the source. Commands that don't open the store, such as lore repository config get, don't wait either. Where the Lore service runs your commands, it runs them in its own process, which also runs the cloning, so commands it runs on other instances over the store don't wait.
A repository nested inside the instance is an instance of its own, and cloning leaves it out. An instance that keeps its own store in .lore/ can't be cloned this way, and the destination can't be inside an instance, the source included.
A FUSE instance on Linux (--vfs fuse) clones into another FUSE instance, which the Lore service mounts at the destination. Only its uncommitted changes and its Lore directory are copied, since its tracked files come from the store, so cloning takes as long and as much space as those changes. The new instance reports the modification times its source reports, which its Lore directory holds. Whether it shares blocks depends on the volume holding Lore's global data directory, where every virtual instance keeps its changes, rather than on the destination's. A write in either instance afterward leaves the other alone. An SWFS instance on Windows (--vfs swfs) can't be cloned.
Elsewhere, such as on NTFS, on ext4, or on another volume, cloning is refused, and the message says what a full copy would cost. Pass --allow-copy to make the copy anyway. A copy writes every file and takes as long as that does. Run with --dry-run first to see whether the new instance shares blocks. Where it can't, the dry run says what a copy would cost and is refused as cloning would be; add --allow-copy to see the copy it would make.
Work across instances¶
Use a branch from another instance¶
A branch you create and commit to in one instance is in every instance at once, before you push it. Switch to it from any other instance:
Any instance can push the branch's revisions.
Keep one instance per branch¶
When you switch to a branch that another instance has checked out, Lore warns you and names that instance:
Warning: Branch 9a1c4b7d... is checked out in other instance(s):
(01a134f3df717142...) /home/you/my-project-b
Two instances on one branch share its latest revision. Once one of them commits, a commit in the other fails with The branch's latest revision has moved on; sync to bring in its new revisions. To commit on top, take your changes off the stage with lore unstage, sync, and stage them again:
lore unstage keeps your changes in the working tree.
List the instances¶
From any instance of the repository:
01a134f3df2b7f50... /home/you/my-project-a main a3f8c2d1...
01a134f3df717142... /home/you/my-project-b feature b4e9f0a2...
Each line gives the instance ID, its path, its branch, and its revision. A line ending in (stale) names an instance whose directory is gone, and one ending in (no checkout) an instance whose directory no longer holds it. Pruning removes both.
To list every shared store on the machine, with the instances of every repository over each:
Store at path: /home/you/.local/share/lore/shared_store/127.0.0.1_41337
Remote URL: lore://127.0.0.1:41337
Instances:
-01a134f3df2b7f50...: /home/you/my-project-a
-01a134f3df717142...: /home/you/my-project-b
--include-instances takes a value, true or false.
Remove an instance¶
-
Commit what you want to keep.
Revisions you've committed stay in the store, on their branch, after the instance is gone. Changes you haven't committed are deleted with the directory.
-
Delete the directory.
-
Prune the instance list.
From any other instance of the repository:
Cloning over the store also prunes the stale instances of its repository, so the list catches up the next time you clone if you skip this step.
Move an instance¶
-
Move the directory.
-
Record the new path.
In the moved instance:
Warning
Run lore repository update-path before any other instance prunes or clones. Until you do, the instance list records the old path, which no longer exists. A prune, including the one cloning over the store runs, takes the moved instance for a deleted one and discards its branch, revision, and staged state. The instance then fails with anchor branch is missing, and you have to delete it and clone it again. The revisions it committed stay in the store.
Free disk space¶
The store keeps itself within the limits in the [store_config] table of its shared_store.toml, 10 GiB by default, which lore shared-store create --max-size sets. Past a limit, Lore evicts content the Lore Server also holds and fetches it again when it's next read. It never evicts revisions you haven't pushed. See the [store] table for the limits and how to change them.
To delete a store and everything in it:
-
Remove every instance over it.
lore shared-store list --include-instances truelists them, for every repository on the server. Remove each one as in Remove an instance. -
Delete the store directory.
Delete the path
lore shared-store inforeports for the server. The next instance cloned from that server creates a new, empty store in the same place.
Warning
Deleting a store deletes every revision committed in its instances and not pushed, on every branch of every repository over it.
Turn off automatic use¶
New instances then keep their own store in .lore/. Instances already over the shared store keep using it. While automatic use is on, you can only clone a repository without the shared store by turning the setting off first.
See also¶
- Quickstart — create a repository, then clone a second working tree over a shared store in Step 6.
- Lore CLI command reference — every
lore shared-store,lore repository instance, andlore cloneflag. - Lore CLI configuration reference — the
[shared_store_to_use]and[store]tables in an instance's config. - Shared stores and instances — why instances are peers with no main repository.