// // Created by Tristan Juricek on 9/19/15. // #ifndef FSCLIENT_WORKSPACE_H #define FSCLIENT_WORKSPACE_H #include <string> class WorkspaceImpl; // Maintains information about where our backing p4 workspace is, and just // simplifies logic of path handling class Workspace { public: ~Workspace(); Workspace(); Workspace(const std::string & workspace); void setWorkspace(std::string & w) { _workspace = w; } const std::string & workspace() const { return _workspace; } std::string path(const std::string & p) const; // Handles notifications of creating a new file at the indicated path. // // This just runs "p4 add". Nothing too fancy. // // In general, we expect this to be called back *after* the file exists. int add(const char *path); // Handles notifications that the path is about to receive new data. // // We need to make sure that the path is at least editable via the "p4 edit" // command. int edit(const char * path); // Handles what happens as the file is renamed on disk. // // The generic response is to run 'p4 rename [from] [to]'. int rename(const char * from, const char * to); // Handles what happens when the file gets removed from the system. // // In cases this is just a file where it's headrev is just not deleted, // we run "p4 delete" on it. // // If the file's headrev is deleted, well, nothing to really submit so just // do nothing. // // If this file was, say, already opened for another purpose, we actually // revert the file changes. int unlink(const char * path); //----------------------------------------------------------------------- // Failure codes //----------------------------------------------------------------------- static const int CONNECTION_FAILURE = -1; static const int COMMAND_FAILURE = -2; private: std::string _workspace; WorkspaceImpl* _impl; }; #endif //FSCLIENT_WORKSPACE_H
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#3 | 16236 | tjuricek |
Revise FUSE-client to call p4 reconcile intelligently. This uses the main FUSE callbacks like a loopback with a notification mechanism. After no real disk access after a short period of time (like 500ms) we'll trigger a call to p4 reconcile. The "interface" to this application is currently just a file handle: /.status - Lists "ok" if there's no errors, otherwise, outputs a list of messages |
||
#2 | 16208 | tjuricek |
Naive implementation that adds guesses at rename and unlink abilities. It's becoming *very* apparent that we need a different approach to handling file system events. We likely need to create a log of "here's what I've done" and then after a certain period of time trigger a system that allows you to possibly just reconcile the changes. Matching filesystem calls to p4 commands ends up with *a lot* of p4 commands. |
||
#1 | 16129 | tjuricek |
Rename/move files again... this time to the hyphenated-approach. |
||
//guest/tjuricek/file_system_client/main/Workspace.h | |||||
#1 | 16119 | tjuricek | Rename/move to meet workshop project conventions. | ||
//guest/tjuricek/fsclient/Workspace.h | |||||
#1 | 16118 | tjuricek |
FSClient initial version: handles add, edit This is a proof-of-concept app that mirrors an existing Perforce workspace to handle running commands like "p4 add" and "p4 edit" automatically when your apps add and write files. See the readme for more information. |