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

Changed column type of timestamp in LocalChangeEntity #2101

Merged
merged 6 commits into from
Jul 31, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Merge branch 'master' into ak/timestampToInstant
  • Loading branch information
aditya-07 committed Jul 31, 2023
commit 8ec46ca8115dcd48b8ca41ced2b69b2a8e7dbfe0
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2022 Google LLC
* Copyright 2023 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -32,9 +32,11 @@ import com.google.android.fhir.FhirEngineConfiguration
import com.google.android.fhir.FhirEngineProvider
import com.google.android.fhir.ServerConfiguration
import com.google.android.fhir.sync.AcceptRemoteConflictResolver
import com.google.android.fhir.sync.DownloadRequest
import com.google.android.fhir.sync.DownloadWorkManager
import com.google.android.fhir.sync.FhirSyncWorker
import com.google.android.fhir.sync.Request
import com.google.android.fhir.sync.UploadWorkManager
import com.google.android.fhir.sync.upload.SquashedChangesUploadWorkManager
import com.google.common.truth.Truth.assertThat
import java.math.BigDecimal
import java.util.LinkedList
Expand Down Expand Up @@ -85,13 +87,14 @@ class H_FhirSyncWorkerBenchmark {
}
override fun getDownloadWorkManager(): DownloadWorkManager = BenchmarkTestDownloadManagerImpl()
override fun getConflictResolver() = AcceptRemoteConflictResolver
override fun getUploadWorkManager(): UploadWorkManager = SquashedChangesUploadWorkManager()
}

open class BenchmarkTestDownloadManagerImpl(queries: List<String> = listOf("List/sync-list")) :
DownloadWorkManager {
private val urls = LinkedList(queries)

override suspend fun getNextRequest() = urls.poll()?.let { Request.of(it) }
override suspend fun getNextRequest() = urls.poll()?.let { DownloadRequest.of(it) }
override suspend fun getSummaryRequestUrls(): Map<ResourceType, String> {
return emptyMap()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ import com.google.android.fhir.demo.FhirApplication
import com.google.android.fhir.sync.AcceptLocalConflictResolver
import com.google.android.fhir.sync.DownloadWorkManager
import com.google.android.fhir.sync.FhirSyncWorker
import com.google.android.fhir.sync.UploadWorkManager
import com.google.android.fhir.sync.upload.SquashedChangesUploadWorkManager

class DemoFhirSyncWorker(appContext: Context, workerParams: WorkerParameters) :
FhirSyncWorker(appContext, workerParams) {
Expand All @@ -30,6 +32,8 @@ class DemoFhirSyncWorker(appContext: Context, workerParams: WorkerParameters) :
return TimestampBasedDownloadWorkManagerImpl(FhirApplication.dataStore(applicationContext))
}

override fun getUploadWorkManager(): UploadWorkManager = SquashedChangesUploadWorkManager()

override fun getConflictResolver() = AcceptLocalConflictResolver

override fun getFhirEngine() = FhirApplication.fhirEngine(applicationContext)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2022 Google LLC
* Copyright 2023 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -17,8 +17,8 @@
package com.google.android.fhir.demo.data

import com.google.android.fhir.demo.DemoDataStore
import com.google.android.fhir.sync.DownloadRequest
import com.google.android.fhir.sync.DownloadWorkManager
import com.google.android.fhir.sync.Request
import com.google.android.fhir.sync.SyncDataParams
import java.time.ZoneId
import java.time.format.DateTimeFormatter
Expand All @@ -44,15 +44,15 @@ class TimestampBasedDownloadWorkManagerImpl(private val dataStore: DemoDataStore
)
)

override suspend fun getNextRequest(): Request? {
override suspend fun getNextRequest(): DownloadRequest? {
var url = urls.poll() ?: return null

val resourceTypeToDownload =
ResourceType.fromCode(url.findAnyOf(resourceTypeList, ignoreCase = true)!!.second)
dataStore.getLasUpdateTimestamp(resourceTypeToDownload)?.let {
url = affixLastUpdatedTimestamp(url, it)
}
return Request.of(url)
return DownloadRequest.of(url)
}

override suspend fun getSummaryRequestUrls(): Map<ResourceType, String> {
Expand Down
Loading
Loading
You are viewing a condensed version of this merge commit. You can view the full changes here.