-
-
Notifications
You must be signed in to change notification settings - Fork 147
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
Provide DocEvent Webhook #1002
Comments
Hello! Could I try this issue? |
What Events Should We Send?To keep external services informed about the state of documents, we should send events corresponding to the CRUD (Create, Read, Update, Delete) operations. Common Webhook Specifications
Event Types and Payloadsa. Document Created
b. Document Watched
c. Document Unwatched
d. Document Changed1. Change Event
2. Snapshot Event
e. Document Deleted
|
Explanation of EventsCommon Parts
Document Watched / Unwatched
Document ChangedChange Event
Snapshot Stored
|
If the above data types are finalized, we should consider the following:
|
@hackerwins @devleejb @sejongk Any thoughts on this proposed schema? |
@window9u Sorry for late check. Overall looks good. I have a few questions.
|
@devleejb Thank you for reviewing my comments!
I lean toward removing
Thank you for catching that mistake—I missed that point as well. As you mentioned, it’s better to remove Additionally, as discussed in our previous weekly sync, I agree with your perspective on the following:
I believe that customers could potentially use
I agree with your perspective. The implementation of the Here’s my suggested implementation order:
Here’s the webhook code I envision for this implementation. For example, we could define the webhook in the Backend component like this: type Backend struct {
Config *Config
serverInfo *sync.ServerInfo
AuthWebhookCache *cache.LRUExpireCache[string, *types.AuthWebhookResponse]
Metrics *prometheus.Metrics
Webhook docevent.Webhook // Add webhook component here
DB database.Database
Coordinator sync.Coordinator
Background *background.Background
Housekeeping *housekeeping.Housekeeping
} Then, publishing a webhook could follow the pattern used for metrics: s.backend.Metrics.AddWatchDocumentEventPayloadBytes(
s.backend.Config.Hostname,
project,
event.Type,
event.Body.PayloadLen(),
)
// This is example code for POC. And will be modified
s.backend.Webhook.PublishWatchedEvent(
docInfo.Key,
clientKey,
issuedAt,
watchingNum,
)
|
What would you like to be added:
We are currently implementing an LLM-based document search functionality in CodePair. As part of this, we need to maintain a vector of document content in Vector Store. It's crucial that any updates to the document are reflected in the Vector Store by continually editing the content.
To achieve this, we require a mechanism that notifies external services like CodePair when documents are modified in Yorkie. We propose the introduction of a Webhook system that triggers when a document event occurs.
Specifically, we suggest that when handling the PushPullChanges requests, the server should check if a Webhook for the DocEvent is registered for the project. If it is, the server would call that Webhook during the background routine of the PushPullChanges API execution, right before publishing the DocEvent.
I think it will have a similar structure to the Auth Webhook, and if changes occur frequently, an event control device such as debouncing will also be needed.
Why is this needed:
This enhancement would enable seamless integration with external services, allowing for real-time updates to Search Engine or Vector Store based on document changes in Yorkie, thereby enhancing the overall document management and search capabilities of our application.
The text was updated successfully, but these errors were encountered: