From b1abda97d6f6b2351a4752621614885de7195d34 Mon Sep 17 00:00:00 2001 From: laoyuyu Date: Fri, 20 Jan 2023 10:15:57 +0800 Subject: [PATCH] =?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=BA=93=E9=87=8D=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../arialyy/aria/core/service/DbService.kt | 2 +- .../main/java/com/arialyy/aria/orm/DuaDb.kt | 8 +- .../com/arialyy/aria/orm/dao/DEntityDao.kt | 12 ++- .../com/arialyy/aria/orm/dao/DGEntityDao.kt | 81 +++++++++++++++++++ .../com/arialyy/aria/orm/dao/RecordDao.kt | 67 +++++++++++++++ .../com/arialyy/aria/orm/dao/UEntityDao.kt | 12 ++- .../arialyy/aria/orm/entity/BlockRecord.kt | 54 +++++++++++++ .../aria/orm/{entiry => entity}/DEntity.kt | 9 ++- .../aria/orm/{entiry => entity}/DGEntity.kt | 17 ++-- .../DGSubList.kt => entity/DGSubRelation.kt} | 18 +++-- .../com/arialyy/aria/orm/entity/MEntity.kt | 61 ++++++++++++++ .../com/arialyy/aria/orm/entity/MKeyInfo.kt | 40 +++++++++ .../arialyy/aria/orm/entity/RecordRelation.kt | 42 ++++++++++ .../com/arialyy/aria/orm/entity/TaskRecord.kt | 35 ++++++++ .../aria/orm/{entiry => entity}/UEntity.kt | 2 +- 15 files changed, 434 insertions(+), 26 deletions(-) create mode 100644 PublicComponent/src/main/java/com/arialyy/aria/orm/dao/DGEntityDao.kt create mode 100644 PublicComponent/src/main/java/com/arialyy/aria/orm/dao/RecordDao.kt create mode 100644 PublicComponent/src/main/java/com/arialyy/aria/orm/entity/BlockRecord.kt rename PublicComponent/src/main/java/com/arialyy/aria/orm/{entiry => entity}/DEntity.kt (85%) rename PublicComponent/src/main/java/com/arialyy/aria/orm/{entiry => entity}/DGEntity.kt (85%) rename PublicComponent/src/main/java/com/arialyy/aria/orm/{entiry/DGSubList.kt => entity/DGSubRelation.kt} (74%) create mode 100644 PublicComponent/src/main/java/com/arialyy/aria/orm/entity/MEntity.kt create mode 100644 PublicComponent/src/main/java/com/arialyy/aria/orm/entity/MKeyInfo.kt create mode 100644 PublicComponent/src/main/java/com/arialyy/aria/orm/entity/RecordRelation.kt create mode 100644 PublicComponent/src/main/java/com/arialyy/aria/orm/entity/TaskRecord.kt rename PublicComponent/src/main/java/com/arialyy/aria/orm/{entiry => entity}/UEntity.kt (96%) diff --git a/PublicComponent/src/main/java/com/arialyy/aria/core/service/DbService.kt b/PublicComponent/src/main/java/com/arialyy/aria/core/service/DbService.kt index f28b053a..3046f481 100644 --- a/PublicComponent/src/main/java/com/arialyy/aria/core/service/DbService.kt +++ b/PublicComponent/src/main/java/com/arialyy/aria/core/service/DbService.kt @@ -27,7 +27,7 @@ import com.arialyy.aria.util.ReflectionUtil * @Description * @Date 19:36 AM 2023/1/16 **/ -open class DbService : IService { +internal class DbService : IService { private var duaDb: DuaDb? = null /** diff --git a/PublicComponent/src/main/java/com/arialyy/aria/orm/DuaDb.kt b/PublicComponent/src/main/java/com/arialyy/aria/orm/DuaDb.kt index 7e0a75a4..0c3dfcb7 100644 --- a/PublicComponent/src/main/java/com/arialyy/aria/orm/DuaDb.kt +++ b/PublicComponent/src/main/java/com/arialyy/aria/orm/DuaDb.kt @@ -19,10 +19,14 @@ import androidx.room.Database import androidx.room.RoomDatabase import com.arialyy.aria.orm.dao.DEntityDao import com.arialyy.aria.orm.dao.UEntityDao -import com.arialyy.aria.orm.entiry.UEntity +import com.arialyy.aria.orm.entity.BlockRecord +import com.arialyy.aria.orm.entity.DGEntity +import com.arialyy.aria.orm.entity.MEntity +import com.arialyy.aria.orm.entity.TaskRecord +import com.arialyy.aria.orm.entity.UEntity @Database( - entities = [DbEntity::class, UEntity::class], + entities = [DbEntity::class, UEntity::class, DGEntity::class, MEntity::class, TaskRecord::class, BlockRecord::class], version = 1 ) abstract class DuaDb : RoomDatabase() { diff --git a/PublicComponent/src/main/java/com/arialyy/aria/orm/dao/DEntityDao.kt b/PublicComponent/src/main/java/com/arialyy/aria/orm/dao/DEntityDao.kt index 11d8908a..ab0c5494 100644 --- a/PublicComponent/src/main/java/com/arialyy/aria/orm/dao/DEntityDao.kt +++ b/PublicComponent/src/main/java/com/arialyy/aria/orm/dao/DEntityDao.kt @@ -19,8 +19,9 @@ import androidx.room.Dao import androidx.room.Delete import androidx.room.Insert import androidx.room.Query +import androidx.room.Transaction import androidx.room.Update -import com.arialyy.aria.orm.entiry.DEntity +import com.arialyy.aria.orm.entity.DEntity /** * @Author laoyuyu @@ -29,11 +30,16 @@ import com.arialyy.aria.orm.entiry.DEntity **/ @Dao interface DEntityDao { + + @Transaction + @Query("SELECT * FROM DEntity") + suspend fun getDEntityList():List + @Query("SELECT * FROM DEntity WHERE :dId=dId") - suspend fun queryDEntityById(dId: String): DEntity + suspend fun getDEntityById(did: String): DEntity @Query("SELECT * FROM DEntity WHERE :sourceUrl=sourceUrl") - suspend fun queryDEntityBySource(sourceUrl: String): DEntity + suspend fun getDEntityBySource(sourceUrl: String): DEntity @Insert suspend fun insert(dEntity: DEntity) diff --git a/PublicComponent/src/main/java/com/arialyy/aria/orm/dao/DGEntityDao.kt b/PublicComponent/src/main/java/com/arialyy/aria/orm/dao/DGEntityDao.kt new file mode 100644 index 00000000..fca84f55 --- /dev/null +++ b/PublicComponent/src/main/java/com/arialyy/aria/orm/dao/DGEntityDao.kt @@ -0,0 +1,81 @@ +/* + * Copyright (C) 2016 AriaLyy(https://github.com/AriaLyy/Aria) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.arialyy.aria.orm.dao + +import androidx.room.Dao +import androidx.room.Delete +import androidx.room.Insert +import androidx.room.Query +import androidx.room.Transaction +import androidx.room.Update +import com.arialyy.aria.orm.entity.DEntity +import com.arialyy.aria.orm.entity.DGEntity +import com.arialyy.aria.orm.entity.DGSubRelation + +/** + * @Author laoyuyu + * @Description + * @Date 8:55 AM 2023/1/19 + **/ +@Dao +interface DGEntityDao { + + @Transaction + @Query("SELECT * FROM DGEntity") + suspend fun getDGEntityList(): List + + @Transaction + @Query("SELECT * FROM DGEntity WHERE :gid=gid") + suspend fun getDGEntityByGid(gid: Int): DGSubRelation + + @Transaction + @Query("SELECT * FROM DGEntity WHERE :gid=gid") + suspend fun getDGList(): List + + @Insert + suspend fun insertSubList(subList: List) + + @Update + suspend fun update(dgEntity: DGEntity) + + @Delete + suspend fun deleteSubList(subList: List) + + @Delete + @Deprecated( + "please use ", + ReplaceWith("delete(dgEntity)", "com.arialyy.aria.orm.dao.DGEntityDao.delete") + ) + suspend fun deleteDg(dgEntity: DGEntity) + + @Insert + @Deprecated( + "please use ", + ReplaceWith("insert(dgEntity)", "com.arialyy.aria.orm.dao.DGEntityDao.insert") + ) + suspend fun insertDg(dgEntity: DGEntity) + + @Transaction + suspend fun delete(dgEntity: DGEntity) { + deleteSubList(dgEntity.subList) + deleteDg(dgEntity) + } + + suspend fun insert(dgEntity: DGEntity) { + insertDg(dgEntity) + insertSubList(dgEntity.subList) + } +} \ No newline at end of file diff --git a/PublicComponent/src/main/java/com/arialyy/aria/orm/dao/RecordDao.kt b/PublicComponent/src/main/java/com/arialyy/aria/orm/dao/RecordDao.kt new file mode 100644 index 00000000..307992fa --- /dev/null +++ b/PublicComponent/src/main/java/com/arialyy/aria/orm/dao/RecordDao.kt @@ -0,0 +1,67 @@ +/* + * Copyright (C) 2016 AriaLyy(https://github.com/AriaLyy/Aria) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.arialyy.aria.orm.dao + +import androidx.room.Dao +import androidx.room.Delete +import androidx.room.Insert +import androidx.room.Query +import androidx.room.Transaction +import androidx.room.Update +import com.arialyy.aria.orm.entity.BlockRecord +import com.arialyy.aria.orm.entity.RecordRelation +import com.arialyy.aria.orm.entity.TaskRecord + +/** + * @Author laoyuyu + * @Description + * @Date 10:34 AM 2023/1/19 + **/ +@Dao +interface RecordDao { + + @Transaction + @Query("SELECT * FROM TaskRecord WHERE :key=taskKey") + suspend fun getTaskRecordByKey(key: String): RecordRelation + + @Insert + @Deprecated( + "please use ", + ReplaceWith( + "deleteTaskRecord(taskRecord)", + "com.arialyy.aria.orm.dao.RecordDao.insert" + ) + ) + suspend fun insertTaskRecord(taskRecord: TaskRecord) + + @Insert + suspend fun insertSubList(blockList: List) + + @Update + suspend fun update(record: TaskRecord) + + @Delete + suspend fun deleteTaskRecord(record: TaskRecord) + + @Delete + suspend fun deleteBlockRecord(blockRecord: List) + + @Transaction + suspend fun insert(taskRecord: TaskRecord) { + insertTaskRecord(taskRecord) + insertSubList(taskRecord.blockList) + } +} \ No newline at end of file diff --git a/PublicComponent/src/main/java/com/arialyy/aria/orm/dao/UEntityDao.kt b/PublicComponent/src/main/java/com/arialyy/aria/orm/dao/UEntityDao.kt index 4955f5e7..80a26e6d 100644 --- a/PublicComponent/src/main/java/com/arialyy/aria/orm/dao/UEntityDao.kt +++ b/PublicComponent/src/main/java/com/arialyy/aria/orm/dao/UEntityDao.kt @@ -19,8 +19,9 @@ import androidx.room.Dao import androidx.room.Delete import androidx.room.Insert import androidx.room.Query +import androidx.room.Transaction import androidx.room.Update -import com.arialyy.aria.orm.entiry.UEntity +import com.arialyy.aria.orm.entity.UEntity /** * @Author laoyuyu @@ -29,11 +30,16 @@ import com.arialyy.aria.orm.entiry.UEntity **/ @Dao interface UEntityDao { + + @Transaction + @Query("SELECT * FROM DEntity") + suspend fun getUEntityList(): List + @Query("SELECT * FROM DEntity WHERE :uId=uId") - suspend fun queryUEntityById(uId: String): UEntity + suspend fun getUEntityById(uId: String): UEntity @Query("SELECT * FROM UEntity WHERE :filePath=filePath") - suspend fun queryUEntityBySource(filePath: String): UEntity + suspend fun getUEntityBySource(filePath: String): UEntity @Insert suspend fun insert(uEntity: UEntity) diff --git a/PublicComponent/src/main/java/com/arialyy/aria/orm/entity/BlockRecord.kt b/PublicComponent/src/main/java/com/arialyy/aria/orm/entity/BlockRecord.kt new file mode 100644 index 00000000..7e5080db --- /dev/null +++ b/PublicComponent/src/main/java/com/arialyy/aria/orm/entity/BlockRecord.kt @@ -0,0 +1,54 @@ +/* + * Copyright (C) 2016 AriaLyy(https://github.com/AriaLyy/Aria) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.arialyy.aria.orm.entity + +import androidx.room.Entity +import androidx.room.ForeignKey +import androidx.room.ForeignKey.Companion.CASCADE +import androidx.room.PrimaryKey + +/** + * @Author laoyuyu + * @Description + * @Date 10:16 AM 2023/1/19 + **/ +@Entity( + foreignKeys = [ForeignKey( + entity = TaskRecord::class, + parentColumns = ["tId"], + childColumns = ["tId"], + onDelete = CASCADE + )] +) +data class BlockRecord( + @PrimaryKey(autoGenerate = true) val bId: Int = 0, + + val tId: Int, + + /** + * 开始位置 + */ + val startLocation: Long = 0, + + /** + * 结束位置 + */ + val endLocation: Long = 0, + + val blockSize: Long = 0, + + val isComplete: Boolean = false +) \ No newline at end of file diff --git a/PublicComponent/src/main/java/com/arialyy/aria/orm/entiry/DEntity.kt b/PublicComponent/src/main/java/com/arialyy/aria/orm/entity/DEntity.kt similarity index 85% rename from PublicComponent/src/main/java/com/arialyy/aria/orm/entiry/DEntity.kt rename to PublicComponent/src/main/java/com/arialyy/aria/orm/entity/DEntity.kt index eea29349..588a858f 100644 --- a/PublicComponent/src/main/java/com/arialyy/aria/orm/entiry/DEntity.kt +++ b/PublicComponent/src/main/java/com/arialyy/aria/orm/entity/DEntity.kt @@ -13,9 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.arialyy.aria.orm.entiry +package com.arialyy.aria.orm.entity import androidx.room.Entity +import androidx.room.ForeignKey import androidx.room.Index import androidx.room.PrimaryKey @@ -24,7 +25,9 @@ import androidx.room.PrimaryKey */ @Entity(indices = [Index(value = ["sourceUrl", "savePath"])]) data class DEntity( - @PrimaryKey(autoGenerate = true) val dId: Int = 0, + @PrimaryKey(autoGenerate = true) val did: Int = 0, + + val parentId: Int = -1, /** * file source url @@ -39,6 +42,8 @@ data class DEntity( */ var ext: String? = null, + val isSub: Boolean = false, + val createTime: Long, val updateTime: Long diff --git a/PublicComponent/src/main/java/com/arialyy/aria/orm/entiry/DGEntity.kt b/PublicComponent/src/main/java/com/arialyy/aria/orm/entity/DGEntity.kt similarity index 85% rename from PublicComponent/src/main/java/com/arialyy/aria/orm/entiry/DGEntity.kt rename to PublicComponent/src/main/java/com/arialyy/aria/orm/entity/DGEntity.kt index d8760e70..d849af21 100644 --- a/PublicComponent/src/main/java/com/arialyy/aria/orm/entiry/DGEntity.kt +++ b/PublicComponent/src/main/java/com/arialyy/aria/orm/entity/DGEntity.kt @@ -13,9 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.arialyy.aria.orm.entiry +package com.arialyy.aria.orm.entity import androidx.room.Entity +import androidx.room.Ignore +import androidx.room.Index import androidx.room.PrimaryKey import androidx.room.TypeConverters import com.arialyy.aria.orm.DGUrlConverter @@ -25,17 +27,11 @@ import com.arialyy.aria.orm.DGUrlConverter * @Description * @Date 4:32 PM 2023/1/16 **/ -@Entity +@Entity(indices = [Index(value = ["savePath"])]) @TypeConverters(DGUrlConverter::class) data class DGEntity( @PrimaryKey(autoGenerate = true) val dgId: Int = 0, - /** - * 组合任务等hash为: 为子任务地址相加的url的Md5 - * ftpdir为:ftpdir下载地址 - */ - val groupHash: String, - /** * 任务组别名 */ @@ -59,4 +55,7 @@ data class DGEntity( val createTime: Long, val updateTime: Long -) \ No newline at end of file +) { + @Ignore + internal var subList: MutableList = mutableListOf() +} \ No newline at end of file diff --git a/PublicComponent/src/main/java/com/arialyy/aria/orm/entiry/DGSubList.kt b/PublicComponent/src/main/java/com/arialyy/aria/orm/entity/DGSubRelation.kt similarity index 74% rename from PublicComponent/src/main/java/com/arialyy/aria/orm/entiry/DGSubList.kt rename to PublicComponent/src/main/java/com/arialyy/aria/orm/entity/DGSubRelation.kt index b4405a20..d0f964a8 100644 --- a/PublicComponent/src/main/java/com/arialyy/aria/orm/entiry/DGSubList.kt +++ b/PublicComponent/src/main/java/com/arialyy/aria/orm/entity/DGSubRelation.kt @@ -13,16 +13,24 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.arialyy.aria.orm.entiry +package com.arialyy.aria.orm.entity import androidx.room.Embedded import androidx.room.Relation -data class DGSubList( +data class DGSubRelation( @Embedded val dgEntity: DGEntity, +) { @Relation( parentColumn = "dgId", - entityColumn = "dId" + entityColumn = "parentId" ) - val subEntity: List -) + var subList: List = emptyList() + set(value) { + dgEntity.subList.apply { + clear() + addAll(value) + } + field = value + } +} diff --git a/PublicComponent/src/main/java/com/arialyy/aria/orm/entity/MEntity.kt b/PublicComponent/src/main/java/com/arialyy/aria/orm/entity/MEntity.kt new file mode 100644 index 00000000..cf0c18ba --- /dev/null +++ b/PublicComponent/src/main/java/com/arialyy/aria/orm/entity/MEntity.kt @@ -0,0 +1,61 @@ +/* + * Copyright (C) 2016 AriaLyy(https://github.com/AriaLyy/Aria) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.arialyy.aria.orm.entity + +import androidx.room.Entity +import androidx.room.Index +import androidx.room.PrimaryKey + +@Entity(indices = [Index(value = ["sourceUrl", "savePath"])]) +data class MEntity( + @PrimaryKey(autoGenerate = true) val mId: Int = 0, + + val keyId: Int = -1, + + /** + * file source url + */ + val sourceUrl: String, + /** + * file save path + */ + val savePath: String, + /** + * extended Information + */ + var ext: String? = null, + + /** + * 当前peer的位置 + */ + val peerIndex: Int = 0, + + /** + * peer总数 + */ + private var peerNum: Int = 0, + + /** + * 是否是直播,true 直播 + */ + val isLive: Boolean = false, + + /** + * 缓存目录 + */ + val cacheDir: String? = null + +) diff --git a/PublicComponent/src/main/java/com/arialyy/aria/orm/entity/MKeyInfo.kt b/PublicComponent/src/main/java/com/arialyy/aria/orm/entity/MKeyInfo.kt new file mode 100644 index 00000000..481773fa --- /dev/null +++ b/PublicComponent/src/main/java/com/arialyy/aria/orm/entity/MKeyInfo.kt @@ -0,0 +1,40 @@ +package com.arialyy.aria.orm.entity + +import androidx.room.Entity +import androidx.room.PrimaryKey + +@Entity +data class MKeyInfo( + + @PrimaryKey(autoGenerate = true) val kId: Int, + + /** + * 加密key保存地址 + */ + val keyPath: String, + + /** + * 加密key的下载地址 + */ + val keyUrl: String, + + /** + * 加密算法 + */ + val method: String, + + /** + * key的iv值 + */ + val iv: String, + + /** + * key的格式,可能为空 + */ + val keyFormat: String? = null, + + /** + * key的格式版本,默认为1,如果是多个版本,使用"/"分隔,如:"1", "1/2", or "1/2/5" + */ + val keyFormatVersion: String = "1", +) diff --git a/PublicComponent/src/main/java/com/arialyy/aria/orm/entity/RecordRelation.kt b/PublicComponent/src/main/java/com/arialyy/aria/orm/entity/RecordRelation.kt new file mode 100644 index 00000000..d30eea34 --- /dev/null +++ b/PublicComponent/src/main/java/com/arialyy/aria/orm/entity/RecordRelation.kt @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2016 AriaLyy(https://github.com/AriaLyy/Aria) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.arialyy.aria.orm.entity + +import androidx.room.Embedded +import androidx.room.Relation + +/** + * @Author laoyuyu + * @Description + * @Date 10:27 AM 2023/1/19 + **/ +data class RecordRelation( + @Embedded + val taskRecord: TaskRecord +) { + @Relation( + parentColumn = "tId", + entityColumn = "tId" + ) + var blockRecordList: List = emptyList() + set(value) { + taskRecord.blockList.apply { + clear() + addAll(value) + } + field = value + } +} \ No newline at end of file diff --git a/PublicComponent/src/main/java/com/arialyy/aria/orm/entity/TaskRecord.kt b/PublicComponent/src/main/java/com/arialyy/aria/orm/entity/TaskRecord.kt new file mode 100644 index 00000000..cfc3c6e3 --- /dev/null +++ b/PublicComponent/src/main/java/com/arialyy/aria/orm/entity/TaskRecord.kt @@ -0,0 +1,35 @@ +/* + * Copyright (C) 2016 AriaLyy(https://github.com/AriaLyy/Aria) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.arialyy.aria.orm.entity + +import androidx.room.Entity +import androidx.room.Ignore +import androidx.room.Index +import androidx.room.PrimaryKey + +@Entity(indices = [Index(value = ["taskKey"])]) +data class TaskRecord( + @PrimaryKey(autoGenerate = true) val tId: Int = 0, + val taskKey: String, + val filePath: String, + val taskType: Int, + val fileLen: Long, + val blockNum: Int, + val blockSize: Long +) { + @Ignore + internal var blockList: MutableList = mutableListOf() +} diff --git a/PublicComponent/src/main/java/com/arialyy/aria/orm/entiry/UEntity.kt b/PublicComponent/src/main/java/com/arialyy/aria/orm/entity/UEntity.kt similarity index 96% rename from PublicComponent/src/main/java/com/arialyy/aria/orm/entiry/UEntity.kt rename to PublicComponent/src/main/java/com/arialyy/aria/orm/entity/UEntity.kt index f212f403..dc00ed94 100644 --- a/PublicComponent/src/main/java/com/arialyy/aria/orm/entiry/UEntity.kt +++ b/PublicComponent/src/main/java/com/arialyy/aria/orm/entity/UEntity.kt @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.arialyy.aria.orm.entiry +package com.arialyy.aria.orm.entity import androidx.room.Entity import androidx.room.Index