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

replication: search for state/sequence number by timestamp #38

Merged
merged 2 commits into from
Jun 7, 2022

Conversation

paulmach
Copy link
Owner

@paulmach paulmach commented Jun 5, 2022

This PR add 4 methods to determine the sequence number from a given timestamp. They will return the state written after the given timestamp.

  • MinuteStateAt(ctx context.Context, timestamp time.Time) (MinuteSeqNum, *State, error)
  • HourStateAt(ctx context.Context, timestamp time.Time) (HourSeqNum, *State, error)
  • DayStateAt(ctx context.Context, timestamp time.Time) (DaySeqNum, *State, error)
  • ChangesetStateAt(ctx context.Context, timestamp time.Time) (ChangesetSeqNum, *State, error)

The binary search across the available states is based on https://github.com/osmcode/pyosmium/blob/000de57139f11cab1f22a99e7d9d3470f79f0947/src/osmium/replication/server.py#L197

@paulmach paulmach merged commit 2ce4c1f into master Jun 7, 2022
@paulmach paulmach deleted the state_at branch June 7, 2022 17:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant