Skip to content

Commit

Permalink
Initial Thrift definitions to support EdenFS filesystem notifications
Browse files Browse the repository at this point in the history
Summary:
# Context

We are introducing EdenFS notifications to support scalable and ergonomic file system notifications for EdenFS mounts.

# This Diff

This diff introduces the initial Thrift definitions to support EdenFS filesystem notifications. It defines several new data structures and a single method `streamChangesSinceV2`.

# Technical Details

Simple-ish Thrift definitions that generate code, but are not used yet.

# Discussion Points

* There are two existing, simlar methods. One that has never been used as it was a hack-a-month project that was put on hold. The other is in use. The hack-a-month API, `streamSelectedChangesSince` could be removed now. The used method, `streamChangesSince` will need to remain until such time was we remove support for EdenFS mounts from Watchman.

Reviewed By: MichaelCuevas

Differential Revision: D65305161

fbshipit-source-id: 15a4b7cf89b37ebd1427193bfc06360006fa6bca
  • Loading branch information
jdelliot authored and facebook-github-bot committed Nov 6, 2024
1 parent 4161e94 commit 9d3f5ee
Showing 1 changed file with 85 additions and 0 deletions.
85 changes: 85 additions & 0 deletions eden/fs/service/streamingeden.thrift
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,54 @@ const i64 FS_EVENT_READ = 1;
const i64 FS_EVENT_WRITE = 2;
const i64 FS_EVENT_OTHER = 4;

struct CommitTransition {
1: eden.ThriftRootId from;
2: eden.ThriftRootId to;
}

struct DirectoryRenamed {
1: eden.PathString from;
2: eden.PathString to;
}

struct Renamed {
1: eden.Dtype fileType;
2: eden.PathString from;
3: eden.PathString to;
}

struct Added {
1: eden.Dtype fileType;
3: eden.PathString path;
}

struct Deleted {
1: eden.Dtype fileType;
3: eden.PathString path;
}

struct Modified {
1: eden.Dtype fileType;
3: eden.PathString path;
}

union SmallChangeNotification {
1: Renamed renamed;
2: Added added;
3: Deleted deleted;
4: Modified modified;
}

union LargeChangeNotification {
1: DirectoryRenamed directoryRenamed;
2: CommitTransition commitTransition;
}

union ChangeNotification {
1: SmallChangeNotification smallChange;
2: LargeChangeNotification largeChange;
}

/**
* The value of a stream item.
*
Expand All @@ -82,6 +130,23 @@ struct ChangesSinceResult {
1: eden.JournalPosition toPosition;
}

/**
* The value of a stream item in a streamChangedSinceV2 result stream.
*
* Each stream item refers to a single change notification
* since the notification clock provided.
*/
struct ChangeNotificationResult {
1: ChangeNotification change;
}

/**
* Return value of the streamChangedSinceV2 API
*/
struct ChangesSinceV2Result {
1: eden.JournalPosition toPosition;
}

/**
* Argument to streamChangesSince API.
*/
Expand All @@ -98,6 +163,14 @@ struct StreamSelectedChangesSinceParams {
2: list<string> globs;
}

/**
* Argument to streamChangedSinceV2 API
*/
struct StreamChangesSinceV2Params {
1: eden.PathString mountPoint;
2: eden.JournalPosition fromPosition;
}

struct TraceTaskEventsRequest {}

typedef binary EdenStartStatusUpdate
Expand Down Expand Up @@ -196,6 +269,18 @@ service StreamingEdenService extends eden.EdenService {
1: eden.EdenError ex,
);

/**
* Returns a stream of change notifications for a given path since a specific point in time.
*
* This does not resolve expensive operations like moving a directory or changing
* commits. Callers must query Sapling to evaluate those potentially expensive operations.
*/
ChangesSinceV2Result, stream<
ChangeNotificationResult throws (1: eden.EdenError ex)
> streamChangesSinceV2(1: StreamChangesSinceV2Params params) throws (
1: eden.EdenError ex,
);

/**
* Same as the API above but only returns files that match the globs in filter.
* This API is intend to replace the above API but it's currently under development.
Expand Down

0 comments on commit 9d3f5ee

Please sign in to comment.