- Exclusive mode - By default (
archil mount), mounting an Archil disk puts it in exclusive mode. This locks the entire file system for the machine which mounted. That machine will receive local-like performance that matches an EBS volume, but other machines will not be able to access the disk until its unmounted. - Shared mode - If you mount the disk in shared mode (
archil mount --shared), no lock is taken out on the disk. By default, the entire disk will appear read-only to the client until it manually requests a delegation (archil checkout <path>). With a delegation, the client will have exclusive write access to the specified<path>and receive local-like performance. - Conditional mode - If you mount the disk in conditional mode (
archil mount --conditional), you enable the disk to execute operations remotely, like an NFS or 9p file system. This means that all files (which are not write-locked by another client) are immediately writeable, but the disk performance will be reduced to that of a remote file system. Users in conditional mode can continue to usearchil checkoutto get exclusive write access and higher performance to subdirectories on the disk.
Selecting a mode on serverless sandboxes
By default, serverless sandboxes mount in Shared mode (archil mount --shared) to enable multiple sandboxes to easily access
the same data.
You can change the disk into Exclusive mode by first executing archil checkout /mnt/archil as part of your serverless sandbox
command.
You can select Conditional mode by using the more verbose serverless sandbox API, like below:
/mnt/archil/data instead of /mnt/archil.
Automatic delegations in shared mode
When mounting in Shared mode, some operations automatically grant a write-lock on the file, to reduce the number of times that you need to callarchil checkout. These operations are:
- Creating a new file inside of a directory that does not have a delegation
- Opening a file that is not covered by a delegation for writing (delegation automatically released on close)
- Creating a new directory
archil checkin on
the resource after creation.
These rules lead to a common pitfall with Archil in which it’s possible to create a file or directory, but a removal
operation will fail with EROFS: Read-only file system. This is because of the automatic delegation granting on
file/folder creation. Deleting a file or folder is a directory-level operation, and requires a delegation on the parent
directory of the file being removed.
These rules apply only to clients in Shared mode. Clients mounting in Conditional mode will never have delegations
automatically issued to them.
Understanding delegations
Each delegation is an exclusive write-lock on a part of an Archil disk for a single client. When you callarchil checkout <path>,
all files and folders underneath that path will be included as part of the write delegation. This will prevent other write operations,
including S3 PutObject operations, from completing against those paths.
For example, consider a file system with the following structure:
archil checkout group/ to get exclusive write-access to the “group” directory, it will also have exclusive
write access to the group/models/ directory and its contents. Other clients will be able to continue to read these files and folders
but will not be able to write to them, or call PutObject. Unless it’s mounted in conditional mode, this client would not be
able to edit any other part of the disk. Other clients are simultaneously able to call PutObject to add files to the data/ directory
or get exclusive write access over that directory by calling archil checkout data/.
When your client is operating in conditional mode, write operations are executed on the server-side, and multiple clients can
simultaneously read and write to any part of the file system without a delegation.
Releasing delegations
Delegations represent an exclusive write-lock on a part of the Archil disk. As a result, they need to be manually released by clients to signal that they are no longer performing writes to that portion of the disk. You can do this by either unmounting the disk from the server which requested the delegation or by manually callingarchil checkin <path>.
Forcing ownership
In some cases, a client may crash or poweroff without cleanly unmounting or callingarchil checkin to release a delegation.
If this happens, you will not automatically be able to write to the location where the client’s delegation was held. Instead,
you will need to force release the delegation. This will cause any in-progress writes from the original client to be lost. This
mirrors “force detaching” a block device, such as an EBS or Hyperdisk disk.
You can force checkout a delegation by calling archil checkout <path> --force, and you can force mount a disk into exclusive
mode by calling archil mount --force.
You can also remove delegations using the Archil API, if you don’t have the disk mounted locally:
Typescript