Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: add topic sequence_page #298

Merged
merged 3 commits into from
Oct 7, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 23 additions & 10 deletions proto/cachepubsub.proto
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,20 @@ message _SubscriptionRequest {
// The literal topic name to which you want to subscribe.
string topic = 2;

// --> Providing this is not required. <--
//
// If provided, attempt to reconnect to the topic and replay messages starting from
// the provided sequence number. You may get a discontinuity if some (or all) of the
// messages are not available.
// If provided at 1, you may receive some messages leading up to whatever the
// newest message is. The exact amount is unspecified and subject to change.
malandis marked this conversation as resolved.
Show resolved Hide resolved
// If not provided (or 0), the subscription will begin with the latest messages.
uint64 resume_at_topic_sequence_number = 3;

// Determined by the service when a topic is created. This clarifies the intent of
// a subscription, and ensures the right messages are sent for a given
// `resume_at_topic_sequence_number`.
// Include this in your Subscribe() calls when you are reconnecting. The right value
// is the last sequence_stamp you received.
malandis marked this conversation as resolved.
Show resolved Hide resolved
uint64 sequence_stamp = 4;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: topic_sequence_stamp so that the field naming is similar to topic_sequence_number.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't really like the idea of mixing the names too closely. Stamp versus number being the only discriminator between the two seems confusing, particularly to someone with English as a second, third, or fourth language. It's already subtle enough haha

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea I did have that same thought. If anything I would rather change sequence to something else instead of adding topic to it.

}

// Possible message kinds from a topic. They can be items when they're from you, or
Expand All @@ -101,19 +108,20 @@ message _SubscriptionItem {

// Your subscription has yielded an item you previously published. Here it is!
message _TopicItem {
// Topic sequence numbers are **best-effort** and **informational**.
// They are not transactional.
// They exist:
// * to help reconnect to an existing topic while trying to avoid missing items.
// * to facilitate richer monitoring and logging.
// * to provide a best-effort awareness of stream contiguity, or lack thereof,
// in case you need to know.
// You can safely ignore them if none of that matters to you!
// Topic sequence numbers give an order of messages per-topic.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: They give an order per-topic-sequence-page.

// All subscribers to a topic will receive messages in the same order, with the same sequence numbers.
uint64 topic_sequence_number = 1;

// The value you previously published to this topic.
_TopicValue value = 2;

// Authenticated id from Publisher's disposable token
string publisher_id = 3;

// Sequence stamps exist to determine which sequence number range a message belongs to. On a topic reset,
// the sequence numbers reset and a new sequence_stamp is given.
// For a given sequence_stamp, the next message in a topic is topic_sequence_number + 1.
uint64 sequence_stamp = 4;
}

// A value in a topic - published, duplicated and received in a subscription.
Expand All @@ -135,6 +143,11 @@ message _Discontinuity {
uint64 last_topic_sequence = 1;
// The new topic sequence number after which TopicItems will ostensibly resume.
uint64 new_topic_sequence = 2;
// The new topic sequence_stamp. If you had one before and this one is different, then your topic reset.
malandis marked this conversation as resolved.
Show resolved Hide resolved
// If you didn't have one, then this is just telling you what the sequence stamp is expected to be.
// If you had one before, and this one is the same, then it's just telling you that you missed some messages
// in the topic. Probably your client is consuming messages a little too slowly in this case!
uint64 new_sequence_stamp = 3;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: new_topic_sequence_stamp

}

// A message from Momento for when we want to reassure clients or frameworks that a
Expand Down
Loading