sapling/eden/fs/takeover/takeover.thrift

44 lines
1.2 KiB
Thrift
Raw Normal View History

include "eden/fs/fuse/handlemap.thrift"
namespace cpp2 facebook.eden
add version handshake to takeover protocol Summary: Whilst chatting with simpkins we realized that we lost the handshake portion of the takeover protocol during a refactor. The handshake is important for a couple of reasons: 1. It prevents unmounting and loosing all the mounts in the case that sometime decides to netcat or otherwise connect to the socket 2. It gives us an opportunity to short circuit any heavy lifting if we know that it will be impossible to succeed. 3. It allows us to rollback to earlier builds with older versions of the takeover protocol. This diff adds a little bit of machinery to enable passing a set of supported takeover protocol version numbers. The intent is to retain support for the two of these at a time; any time we change the encoding/protocol for takeover we'll bump the version number and add supporting code to handle the new format, retaining support for the prior version. Retaining the ability to handle the prior version allows us to downgrade to an earlier build gracefully if/when the need arises. I opted to do this here rather than by bumping the `kProtocolID` constant in `UnixSocket.h` becase we're not really changing the lowest level of the protocol; just the takeover specific portions. I haven't actually changed the takeover serialization in this diff, but do have some work on that happening in D6733406; that diff will be amended to take advantage and demonstrate how this versioning scheme works. A key thing to note about the implementation of this diff is that the client sends the version number to the server, but doesn't add any explicit version encoding in the response we receive. This is deliberate and allows us to upgrade prior builds to this new scheme. I'll add a more definitive check for this situation when I actually rev the format in the following diff. Reviewed By: simpkins Differential Revision: D6743065 fbshipit-source-id: c991cebfee918daad098105ca6bcfef76374c0ff
2018-01-31 01:16:05 +03:00
// A list of takeover data serialization versions that the client supports
struct TakeoverVersionQuery {
// The set of versions supported by the client
1: set<i32> versions,
}
struct SerializedInodeMapEntry {
1: i64 inodeNumber,
2: i64 parentInode,
3: string name,
4: bool isUnlinked,
5: i64 numFuseReferences,
6: string hash,
7: i32 mode,
}
struct SerializedInodeMap {
2: list<SerializedInodeMapEntry> unloadedInodes,
}
struct SerializedMountInfo {
1: string mountPath,
2: string stateDirectory,
3: list<string> bindMountPaths,
// This binary blob is really a fuse_init_out instance.
// We don't transcribe that into thrift because the layout
// is system dependent and happens to be flat and thus is
// suitable for reinterpret_cast to be used upon it to
// access the struct once we've moved it across the process
// boundary. Note that takeover is always local to the same
// machine and thus has the same endianness.
4: binary connInfo, // fuse_init_out
5: handlemap.SerializedFileHandleMap fileHandleMap,
6: SerializedInodeMap inodeMap,
}
union SerializedTakeoverData {
1: list<SerializedMountInfo> mounts,
2: string errorReason,
}