Skip to content

Commit

Permalink
Rename subscribeStreamTemporary to subscribeStreamChangesSince
Browse files Browse the repository at this point in the history
Summary:
# Context

SubscribeStreamTemporary is a function that allows users to recieve notifications whenever there is a change to the edenFS journal. Despite intended to be a temporary function, it's been named as such for about 6 years.

# This Diff
Creates a new function subscribeStreamChangesSince. Move the logic of subscribeStreamTemporary to this new function and have subscribeStreamTemporary call it.

Reviewed By: jdelliot

Differential Revision: D68220555

fbshipit-source-id: de630f60dd66fba77ba3935ca27d95e994acbc7c
  • Loading branch information
Chris Dinh authored and facebook-github-bot committed Jan 17, 2025
1 parent 4add551 commit df5b760
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 12 deletions.
6 changes: 6 additions & 0 deletions eden/fs/service/EdenServiceHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1226,6 +1226,12 @@ void EdenServiceHandler::getCurrentJournalPosition(
apache::thrift::ServerStream<JournalPosition>
EdenServiceHandler::subscribeStreamTemporary(
std::unique_ptr<std::string> mountPoint) {
return streamJournalChanged(std::move(mountPoint));
}

apache::thrift::ServerStream<JournalPosition>
EdenServiceHandler::streamJournalChanged(
std::unique_ptr<std::string> mountPoint) {
auto helper = INSTRUMENT_THRIFT_CALL(DBG3, *mountPoint);
auto mountHandle = lookupMount(mountPoint);

Expand Down
3 changes: 3 additions & 0 deletions eden/fs/service/EdenServiceHandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,9 @@ class EdenServiceHandler : virtual public StreamingEdenServiceSvIf,
apache::thrift::ServerStream<JournalPosition> subscribeStreamTemporary(
std::unique_ptr<std::string> mountPoint) override;

apache::thrift::ServerStream<JournalPosition> streamJournalChanged(
std::unique_ptr<std::string> mountPoint) override;

apache::thrift::ServerStream<FsEvent> traceFsEvents(
std::unique_ptr<std::string> mountPoint,
int64_t eventCategoryMask) override;
Expand Down
25 changes: 13 additions & 12 deletions eden/fs/service/streamingeden.thrift
Original file line number Diff line number Diff line change
Expand Up @@ -110,25 +110,26 @@ typedef binary EdenStartStatusUpdate
*/
service StreamingEdenService extends eden.EdenService {
/**
* Request notification about changes to the journal for
* the specified mountPoint.
* subscribeStreamTemporary is deprecated. Please use streamJournalChanged.
*/
stream<eden.JournalPosition> subscribeStreamTemporary(
1: eden.PathString mountPoint,
) (deprecated);

/**
*
* Returns a stream of "events" indicating that the Journal has changed.
*
* IMPORTANT: Do not use the JournalPosition values in the stream. They are
* meaningless. Instead, call getFilesChangedSince or
* meaningless. Instead, call changesSinceV2 or
* getCurrentJournalPosition which will return up-to-date information and
* unblock future notifications on this subscription. If the subscriber
* never calls getFilesChangedSince or getCurrentJournalPosition in
* never calls changesSinceV2 or getCurrentJournalPosition in
* response to a notification on this stream, future notifications may not
* arrive.
*
* This is an implementation of the subscribe API using the
* new rsocket based streaming thrift protocol.
* The name is temporary: we want to make some API changes
* but want to start pushing out an implementation now because
* we've seen inflated memory usage for the older `subscribe`
* method above.
*/
stream<eden.JournalPosition> subscribeStreamTemporary(
stream<eden.JournalPosition> streamJournalChanged(
1: eden.PathString mountPoint,
);

Expand Down

0 comments on commit df5b760

Please sign in to comment.