Last active
July 9, 2019 18:47
-
-
Save Atternatt/3cc6fb9b2a003a115d41c856b4cec726 to your computer and use it in GitHub Desktop.
Rsync colector exporter class made in kotlin
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class CollectorExporter constructor(context: Context, | |
private val executor: AppExecutor, | |
private val sync: Sync = SyncClient(context)) { | |
fun export(analyticsFolder: File, metadataFolder: File, collectorNetworkAddress: String, executor: ListeningExecutorService = this.executor, uploadFolder: String): | |
ListenableFuture<Unit> { | |
return executor.submit(Callable { | |
sync.sync(analyticsFolder.absolutePath, collectorNetworkAddress, uploadFolder) | |
sync.sync(metadataFolder.absolutePath, collectorNetworkAddress, uploadFolder) | |
}) | |
} | |
fun export(file: File, collectorNetworkAddress: String, executor: ListeningExecutorService = this.executor, uploadFolder: String): ListenableFuture<Unit> { | |
return executor.submit(Callable { | |
sync.sync(file.absolutePath, collectorNetworkAddress, uploadFolder) | |
}) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment