feat: sequence and timestamp on searchrequests (#468)

* feat: reread events

* feat: sequence and timestamo on search requests

* feat: sequence and timestamo on search requests

* fix: better naming

* fix: log errors

* fix: read sequence before search request
This commit is contained in:
Fabi
2020-07-15 13:24:36 +02:00
committed by GitHub
parent 87155f8c9e
commit 423b86a03b
102 changed files with 7389 additions and 6302 deletions

View File

@@ -46,7 +46,7 @@ func (n *Notification) EventQuery() (*models.SearchQuery, error) {
if err != nil {
return nil, err
}
return eventsourcing.UserQuery(sequence), nil
return eventsourcing.UserQuery(sequence.CurrentSequence), nil
}
func (n *Notification) Reduce(event *models.Event) (err error) {

View File

@@ -40,7 +40,7 @@ func (p *NotifyUser) EventQuery() (*models.SearchQuery, error) {
}
return es_models.NewSearchQuery().
AggregateTypeFilter(es_model.UserAggregate, org_es_model.OrgAggregate).
LatestSequenceFilter(sequence), nil
LatestSequenceFilter(sequence.CurrentSequence), nil
}
func (u *NotifyUser) Reduce(event *models.Event) (err error) {

View File

@@ -8,7 +8,7 @@ const (
notificationTable = "notification.notifications"
)
func (v *View) GetLatestNotificationSequence() (uint64, error) {
func (v *View) GetLatestNotificationSequence() (*repository.CurrentSequence, error) {
return v.latestSequence(notificationTable)
}

View File

@@ -37,7 +37,7 @@ func (v *View) DeleteNotifyUser(userID string, eventSequence uint64) error {
return v.ProcessedNotifyUserSequence(eventSequence)
}
func (v *View) GetLatestNotifyUserSequence() (uint64, error) {
func (v *View) GetLatestNotifyUserSequence() (*repository.CurrentSequence, error) {
return v.latestSequence(notifyUserTable)
}

View File

@@ -12,6 +12,6 @@ func (v *View) saveCurrentSequence(viewName string, sequence uint64) error {
return repository.SaveCurrentSequence(v.Db, sequencesTable, viewName, sequence)
}
func (v *View) latestSequence(viewName string) (uint64, error) {
func (v *View) latestSequence(viewName string) (*repository.CurrentSequence, error) {
return repository.LatestSequence(v.Db, sequencesTable, viewName)
}