Summary:
Now that `mount(2)` complete, we can start plumbing the rest of the mount code
to accomodate for NFS. Trying to find a common ground between Prjfs, FUSE and
Prjfs is harder than I wish it would be and thus I wasn't able to find a
satisfatory solution. For now, I went with a std::variant that stores either a
FuseChannel, or the Nfsd3. In the future once Nfs is stabilized and we have a
good understanding of how it differs (and where it doesn't), EdenMount would
probably need a good refactoring.
Reviewed By: kmancini
Differential Revision: D26500111
fbshipit-source-id: f02a2eaf8890261f150d7cdd2cdfd134aa62c2aa
Summary:
Comments affecting runtime behavior disturbs me, so use explicit
structopt annotations on help text. And move those annotations to the
command implementations.
Reviewed By: fanzeyi
Differential Revision: D26412452
fbshipit-source-id: 066dfdd1c54254bae4bd2af65031487b7a1094da
Summary: clap/structopt adds a -V flag to every subcommand by default. Disable that.
Reviewed By: fanzeyi
Differential Revision: D26412093
fbshipit-source-id: 03a0320fd15444f700b359f5ed0ca8c40b10ae1c
Summary:
I don't want the fallback when testing, so add an environment variable
for bypassing it.
Reviewed By: fanzeyi
Differential Revision: D26411754
fbshipit-source-id: f2aea82bf3e79db11e72ad5f5ce33513cfc2f05b
Summary:
Rather than offloading dealing with unexpected errors to each
subcommand, allow them to propogate out. Subcommands can still be
responsible for handling expected "errors" like EdenFS not running.
Reviewed By: fanzeyi
Differential Revision: D26411186
fbshipit-source-id: 4e1c5fb1d7bed495e3e22cca44d3f84f7f4c7f14
Summary:
We should be consistent about how we render mode_t across all of the
FUSE requests.
Reviewed By: singhsrb
Differential Revision: D26286527
fbshipit-source-id: aadf247c0621be79525c4df2da2940c02ee27719
Summary:
By passing the argument to the channel, we can make it so that the NFS code
correctly replies to whether it is case sensitive or not.
Reviewed By: kmancini
Differential Revision: D26500112
fbshipit-source-id: 2988eae403ff3648b50a1a8f0c978be2828ba568
Summary:
By moving the createChannel outside of the EdenMount class, we no longer need
the channelType alias, so let's do it.
Reviewed By: kmancini
Differential Revision: D26500113
fbshipit-source-id: f992ed2aaac5d692d316d06340bf9b219a2d7006
Summary: The RPC just translate the various `struct stat` fields into the fattr3 ones.
Reviewed By: kmancini
Differential Revision: D26389793
fbshipit-source-id: 48c6e109d5d2cb62cab096114c37314d7833035f
Summary:
Similarly to what is done for FUSE and ProjectedFS, the dispatcher is the glue
that sits in between the protocol specific bits and the inodes layer.
For now, this only implements "getattr" but it will be filled overtime as more
RPC can be answered properly.
Reviewed By: kmancini
Differential Revision: D26389795
fbshipit-source-id: 19cf3457feec2ebc100e632cb28c20b11fdde26d
Summary: This merely adds the various datastructures needed to implement GETATTR.
Reviewed By: kmancini
Differential Revision: D26389794
fbshipit-source-id: bda557a21386483449c18aa9e52f4f626b73e69f
Summary:
Timeseries is memory intensive and not really required in the current context
it is being used.
Reviewed By: chadaustin
Differential Revision: D26315632
fbshipit-source-id: ee51c3ad8bef6fce152aa787c8c4602f0b499f92
Summary: This implements the same logic as the `edenfsctl uptime`.
Reviewed By: fanzeyi
Differential Revision: D26412789
fbshipit-source-id: ebcf5f0b4767025ea210f7e9c69116b79436d5d0
Summary:
In Python, no passed in timeout means a 3s connection timeout, let's do the
same in Rust.
Reviewed By: chadaustin
Differential Revision: D26407991
fbshipit-source-id: ad2919e2cb72e5a113499d7e036ae285ecf9ae34
Summary: You can use `instance.get_config()` to get access to global EdenFS configurations
Reviewed By: chadaustin
Differential Revision: D26407350
fbshipit-source-id: 022cc59fd86b2711c15cfd781872465c6ada9081
Summary:
This diff adds `edenfs-config` for loading EdenFS configurations from various
locations.
Reviewed By: xavierd
Differential Revision: D26391272
fbshipit-source-id: 3d34da98b2d530e13cdd831d3dc204e44304c486
Summary:
**Problem:** EdenFS has the classic hierarchical configuration design. We load from `/etc/eden/edenfs.rc` first, then `/etc/eden/conf.d/*` then `$HOME/.edenrc`. The latter can overwrite the former. At the end we have a complete view of the configurations.
`serde` is great, but it can't give us the information of whether it generated a field from `serde(default)` or from de-serialization. So we can't just deserialize then merge the configuration files. We need that information, and nor serde should give us that functionality.
`stack-config` is created to load configurations with serde. It automatically generates code with the intermediate data structure and taking care of merging of multiple configuration files. It derives a data type based on the original struct but wrap each field with `Option<T>` and mark it with Serde. Then it generates the code to merge and build the final concrete configuration data type.
It does not care what kind of data format the configuration file is, as long as it can deserialize into the generate optional type, it accepts it.
Example, say I have a file with this structure:
```
#[derive(StackConfig)]
struct Config {
path: String,
}
```
Then this crate will generate:
```
mod __stack_config_private {
#[derive(serde::Deserialize)]
pub(super) struct ConfigOpt {
path: Option<String>
}
...
}
struct ConfigLoader {
layers: Vec<__stack_config_private::ConfigOpt>,
}
impl ConfigLoader {
fn new() { ... }
fn load(&mut self, layer: __stack_config_private::ConfigOpt> { ... }
fn build(self) -> Config { ... }
}
```
See `examples/parse.rs` for usage.
Reviewed By: xavierd
Differential Revision: D26377547
fbshipit-source-id: 1e07d9867742913fd76ed4f765160f0035a2f2a3
Summary: This diff sets up debug logging for EdenFS CLI with tracing.
Reviewed By: chadaustin
Differential Revision: D26354205
fbshipit-source-id: bcc89fe3eaf4c7ae7642b8c20fd74fd3ea6dd4ee
Summary:
While I was fixing the cli_test I realized that the rest of the tests didn't
enforce strict type checking, let's make sure it is enabled so `pyre -l eden`
works for all the tests now and in the future.
Reviewed By: chadaustin
Differential Revision: D26356267
fbshipit-source-id: 4f026b6f96c410115a6a38d772f8e06ab977293b
Summary:
The default filesystem on macOS (APFS) is case-insensitive, but EdenFS has so
far been case-sensitive except on Windows. Some of the native tools (Unity for
instance), expect macOS to always be case-insensitive, and is thus breaking due
to that.
The safe behavior would be to have EdenFS behave exactly the same as APFS: be
case insensitive. For now, to avoid breaking users this will be done on new
mounts only, and once fully validated, this will be made the default and forced
on.
Reviewed By: chadaustin
Differential Revision: D26356269
fbshipit-source-id: 96ca331d8c9726213520dff3e3563019d0400a95
Summary:
This diff adds a Rust wrapper that will forward any command it fails to parse
to the companion binary `edenfsctl.real` at the same directory. This will allow
us to rewrite some of the subcommands in Rust while keeps the original
functionality.
With `EDENFSCTL_SKIP_RUST` environment variable set, it will skip the argument
parsing process in case of any emergency situation.
Reviewed By: xavierd
Differential Revision: D25758959
fbshipit-source-id: 0fbc69d0e0733ad2608622417be93dc7db2d6fa6
Summary:
My understanding of C++ not being perfect, I thought that these 2 fields would
be default initialized, but it turns out this is wrong, and the values of these
would be whatever is on the stack at the time a non-initialized variant is
used. The XdrSerialize variant test exercise this case and fails when optimized
due to that, this change fixes it.
Reviewed By: chadaustin, fanzeyi
Differential Revision: D26371695
fbshipit-source-id: 489cac846b51508809783bb577c7a97c4e6c060a
Summary:
Instead of having one "Dispatcher" type that the various backend overload,
let's simply have a per-mount type dispatcher type. The previous model worked
fine when EdenFS supported only one way of mounting a repository, but with NFS
coming, unix platform will support both FUSE and NFS, making the Dispatcher
overload nonsensical.
As a behavioral change, the dispatcher lifetime and ownership is changed a bit.
It used to live for the duration of the EdenMount object, but is now tied to
the channel lifetime, as it is now owned by it.
Reviewed By: kmancini
Differential Revision: D26329477
fbshipit-source-id: 3959b90a4909e3ab0898caa308f54686f59a943c
Summary:
As I'm modifying the definition for CheckoutConfig, I'm heavily relying on
`pyre` to tell me about the places I need to fix, but this test not being type
checked means that pyre misses it.
Reviewed By: chadaustin
Differential Revision: D26356268
fbshipit-source-id: 2139c0053b182e656074de3117ee1950e519f19a
Summary: The PATHCONF call gather various POSIX attribute for the passed in file-handle.
Reviewed By: kmancini
Differential Revision: D26270239
fbshipit-source-id: 96a46c58402ce169cacc789c1df3f05f969dcd33
Summary:
The FSINFO procedure is used to collect information about this mount point and
its limits. For now, I've just used random values for most of these, I'll come
back to it later to figure out the ones that makes sense.
Reviewed By: kmancini
Differential Revision: D26269947
fbshipit-source-id: e5fdd961ea7772926208916de0179721930daeab
Summary: Instead of using a plan DBG7, let's use the strace logger to log the RPC calls.
Reviewed By: kmancini
Differential Revision: D26269946
fbshipit-source-id: e8ab7acc658463b9f0f1d4c420f63b2e0c88f46a
Summary: These will be needed when implementing FSINFO.
Reviewed By: kmancini
Differential Revision: D26268588
fbshipit-source-id: 8160f00e988a088769ad682a6de062f6c0443c73
Summary:
Variant are default constructed with the first variant alternative, which means
that when deserialization would not deserialize anything, the first variant
would be initialized. This would mean that deserialize(serialize(myVariant))
would be different from myVariant, which is unexpected.
Reviewed By: kmancini
Differential Revision: D26268586
fbshipit-source-id: ebfd7f9e473509b2a16acdbb6914e828c67c5005
Summary:
With the PrivHelper now being able to try to NFS mount, we can just plug it in
the EdenMount code to actually attempt to mount EdenFS via NFS.
The mount will expectedly fail due to the FSINFO RPC not being implemented just
yet, but that will be the next step.
Reviewed By: kmancini
Differential Revision: D26266143
fbshipit-source-id: a44ae98af76b55a0c24c89e766c072c1a2e1b4fd
Summary:
This will be the main entry point for everything related to the various NFS
programs. For now, it simply starts an nfsd program when registering a new
mount point and returns the ports that mount(2) should use to connect to it.
Reviewed By: kmancini
Differential Revision: D26204060
fbshipit-source-id: 115d2d206109499d5b49c529ebf1f739fc364c23
Summary:
Using the current EventBase can lead to unexpected behavior when the RpcServer
is created on the wrong thread. For instance, if it is created on a thread
pool, and another future is running on that same thread, the RpcServer won't be
able to accept and service new connections, potentially leading to deadlocks.
To avoid this, EdenFS's EventBase is excplicitely passed in, this will ensure
that the RpcServer is created on the proper thread.
Reviewed By: kmancini
Differential Revision: D26266145
fbshipit-source-id: 23211e3aa200c32d2f6fbbfd9ae6fb307896a873
Summary:
MSVC is broken as it doesn't understand the various macros used to generate
XdrTrait for specific types, and I can't figure out a way to make that work.
Even if I provide dummy version of these, the buck build breaks due to glog
trying to redefine the ERROR symbol that some Microsoft headers contain. For
now, let's just ifdef it out since it's unlikely that we're going to be using
NFS on Windows anytime soon.
Reviewed By: singhsrb
Differential Revision: D26293519
fbshipit-source-id: bbaf325c7d1f1688327708360244797a6d48179e
Summary:
Since mounting EdenFS via NFS requires the same privilege as mounting EdenFS
with FUSE, let's re-use the PrivHelper infrastructure that FUSE already uses.
The macOS bit isn't yet implemented as developing on Linux is for now easier,
the mount args are also overly complicated on macOS and not well documented.
Reviewed By: fanzeyi
Differential Revision: D26255629
fbshipit-source-id: 295261dd40442fe7e0f9439c4f4c25e0d50211a3
Summary: This enables the repository to be mounted via NFS, and not FUSE.
Reviewed By: chadaustin
Differential Revision: D26229827
fbshipit-source-id: 5af5a47ebe5f1dd54df7707bf57d9b7476921f29