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

feat(endpoint-cache): add EndpointCache for Endpoint Discovery #2355

Merged
merged 20 commits into from
May 11, 2021

Conversation

trivikr
Copy link
Member

@trivikr trivikr commented May 6, 2021

Issue

Refs: #2211

Description

adds EndpointCache for Endpoint Discovery:

  • uses mnemonist/lru-cache for storing the cache.
  • the set operation stores milliseconds elapsed since the UNIX epoch in Expires param based on CachePeriodInMinutes provided in Endpoint.
  • the get operation returns a random un-expired endpoint.

Testing

Unit tests


By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@codecov-commenter
Copy link

codecov-commenter commented May 6, 2021

Codecov Report

❗ No coverage uploaded for pull request base (main@9a0c2b7). Click here to learn what that means.
The diff coverage is n/a.

❗ Current head d102d16 differs from pull request most recent head cba536d. Consider uploading reports for the commit cba536d to get more accurate results
Impacted file tree graph

@@           Coverage Diff           @@
##             main    #2355   +/-   ##
=======================================
  Coverage        ?   60.15%           
=======================================
  Files           ?      473           
  Lines           ?    24900           
  Branches        ?     5894           
=======================================
  Hits            ?    14978           
  Misses          ?     9922           
  Partials        ?        0           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9a0c2b7...cba536d. Read the comment docs.

trivikr added 19 commits May 11, 2021 17:46
In future, the callee may want to get all unexpired endpoints
and add their own logic as more weights and priorities are added.
The callee will make decision based on value in Expires parameter
as per SDK enhancement proposal.
TimeStream Service Developer Guide refers to CachePeriodInMinutes as Time to Live (TTL)
value. It also specifies calls to be made for the duration of TTL.

Refs: https://a.co/2e8J7xT
Copy link
Contributor

@AllanZhengYP AllanZhengYP left a comment

Choose a reason for hiding this comment

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

The change is straightforward. Only have a minor question.

@trivikr trivikr merged commit f164177 into aws:main May 11, 2021
@trivikr trivikr deleted the endpoint-cache branch May 11, 2021 23:20
@github-actions
Copy link

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs and link to relevant comments in this thread.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 26, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants