Skip to content

Commit

Permalink
Clean up data API
Browse files Browse the repository at this point in the history
Remove unused functionality and disable modification to tables that should only be written by librustzcash
  • Loading branch information
gmale committed Mar 13, 2019
1 parent c7d85f2 commit 764455d
Show file tree
Hide file tree
Showing 9 changed files with 10 additions and 343 deletions.
55 changes: 0 additions & 55 deletions src/androidTest/java/cash/z/wallet/sdk/dao/ComplactBlockDaoTest.kt

This file was deleted.

57 changes: 0 additions & 57 deletions src/androidTest/java/cash/z/wallet/sdk/dao/TransactionDaoTest.kt

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,6 @@ class DerivedDbIntegrationTest {
assertNotNull(blocks)
}

@Test
fun testCount_Transaction() {
assertEquals(5, transactions.count())
}

@Test
fun testCount_Block() {
assertEquals(80101, blocks.count())
Expand All @@ -55,13 +50,6 @@ class DerivedDbIntegrationTest {
assertEquals(343987, tran?.block)
}

@Test
fun testBlockDaoPrepopulated() {
val tran = blocks.findById(1)?.apply {
assertEquals(343987, this.height)
}
}

companion object {
private lateinit var transactions: TransactionDao
private lateinit var blocks: BlockDao
Expand Down
18 changes: 0 additions & 18 deletions src/main/java/cash/z/wallet/sdk/dao/BlockDao.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,9 @@ import cash.z.wallet.sdk.entity.Block

@Dao
interface BlockDao {
@Insert(onConflict = OnConflictStrategy.REPLACE)
fun insert(block: Block)

@Query("SELECT * FROM blocks WHERE height = :height")
fun findById(height: Int): Block?

@Query("DELETE FROM blocks WHERE height = :height")
fun deleteById(height: Int)

@Delete
fun delete(block: Block)

@Query("SELECT COUNT(height) FROM blocks")
fun count(): Int

@Query("DELETE FROM blocks")
fun deleteAll()

@Query("SELECT MAX(height) FROM blocks")
fun lastScannedHeight(): Int

@Query("UPDATE blocks SET time=:time WHERE height = :height")
fun updateTime(height: Int, time: Int)
}
18 changes: 4 additions & 14 deletions src/main/java/cash/z/wallet/sdk/dao/CompactBlockDao.kt
Original file line number Diff line number Diff line change
@@ -1,26 +1,16 @@
package cash.z.wallet.sdk.dao

import androidx.room.*
import androidx.room.Dao
import androidx.room.Insert
import androidx.room.OnConflictStrategy
import androidx.room.Query
import cash.z.wallet.sdk.entity.CompactBlock

@Dao
interface CompactBlockDao {

@Query("SELECT COUNT(height) FROM compactblocks")
fun count(): Int

@Insert(onConflict = OnConflictStrategy.IGNORE)
fun insert(block: CompactBlock)

@Query("SELECT * FROM compactblocks WHERE height = :height")
fun findById(height: Int): CompactBlock?

@Query("DELETE FROM compactblocks WHERE height = :height")
fun deleteById(height: Int)

@Delete
fun delete(block: CompactBlock)

@Query("SELECT MAX(height) FROM compactblocks")
fun latestBlockHeight(): Int
}
22 changes: 0 additions & 22 deletions src/main/java/cash/z/wallet/sdk/dao/NoteDao.kt

This file was deleted.

Loading

0 comments on commit 764455d

Please sign in to comment.