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

Read-Your-Write Consistency #2168

Merged
merged 12 commits into from
Sep 30, 2024
Merged

Read-Your-Write Consistency #2168

merged 12 commits into from
Sep 30, 2024

Commits on Sep 26, 2024

  1. ConsistencyManager interface & implementation

    Manages read-your-write tokens. The manager works based on conditions & tokens.
    
    Tokens are stored in a nested map indexed by a unique id (e.g. `onesignalId`) and a token key (e.g. `USER`).
    
    This allows us to track tokens on a per-user basis (e.g. handle switching users).
    
    Conditions work by creating a blocking mechanism with customizable token retrieval until a pre-defined condition is met (e.g. at least two specific tokens are available).
    
    Also allows extensibility for future applications to control offset blocking mechanism in consistency use-cases.
    rgomezp committed Sep 26, 2024
    Configuration menu
    Copy the full SHA
    6e05278 View commit details
    Browse the repository at this point in the history
  2. DI: register ConsistencyManager in UserModule

    Inject ConsistencyManager where it will be used.
    rgomezp committed Sep 26, 2024
    Configuration menu
    Copy the full SHA
    ca6fe5a View commit details
    Browse the repository at this point in the history
  3. IamFetchReadyCondition Implementation

    Motivation: custom condition to block token retrieval until condition is met.
    
    We then return the newest token
    rgomezp committed Sep 26, 2024
    Configuration menu
    Copy the full SHA
    32775a0 View commit details
    Browse the repository at this point in the history
  4. Add offset, retryCount, & sessionDuration to OptionalHeaders

    Motivation: support passing values as headers, add comments
    rgomezp committed Sep 26, 2024
    Configuration menu
    Copy the full SHA
    1505d07 View commit details
    Browse the repository at this point in the history
  5. Update Subscription & User backend services to return offsets

    Motivation: need the offsets to be available to set in the ConsistencyManager
    rgomezp committed Sep 26, 2024
    Configuration menu
    Copy the full SHA
    be10255 View commit details
    Browse the repository at this point in the history
  6. Update IAM manager & backend service with retry logic, optional headers

    Motivation: the IAM fetch call (`listInAppMessages`) will include the rywToken, retryCount, & secondsSinceAppOpen (tracked on backend)
    
    We update the request & related code here.
    
    Handle retry logic
    rgomezp committed Sep 26, 2024
    Configuration menu
    Copy the full SHA
    1a43567 View commit details
    Browse the repository at this point in the history
  7. Flush track session start operation

    Motivation: we want to update the user as soon as possible in order to not delay IAM fetch
    rgomezp committed Sep 26, 2024
    Configuration menu
    Copy the full SHA
    591bbe7 View commit details
    Browse the repository at this point in the history
  8. IamFetchRywTokenKey Enum

    Motivation: to be used to index read your write tokens specific to the IamFetch consistency use case
    rgomezp committed Sep 26, 2024
    Configuration menu
    Copy the full SHA
    c3f15f5 View commit details
    Browse the repository at this point in the history
  9. Update User & Subscription operation executors to set the tokens

    Motivation: the executors call the respective backend services who's result will include the token value. We then hold in memory via `setRywToken`
    rgomezp committed Sep 26, 2024
    Configuration menu
    Copy the full SHA
    5b83545 View commit details
    Browse the repository at this point in the history
  10. Update HttpClient to put new optional headers into request

    Motivation: offset, secondsSinceAppOpen, & retryCount will be sent as headers
    rgomezp committed Sep 26, 2024
    Configuration menu
    Copy the full SHA
    2083bd0 View commit details
    Browse the repository at this point in the history

Commits on Sep 27, 2024

  1. Configuration menu
    Copy the full SHA
    55a3e25 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    5873b16 View commit details
    Browse the repository at this point in the history