完成Tracker.java接口开发,update path
Change-Id: I8b1096af3aa3c7ebdf623905c5d47cfe72b86da2
diff --git a/src/main/java/entity/SeedDownload.java b/src/main/java/entity/SeedDownload.java
new file mode 100644
index 0000000..caafda8
--- /dev/null
+++ b/src/main/java/entity/SeedDownload.java
@@ -0,0 +1,119 @@
+package entity;
+
+import java.time.LocalDateTime;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+@Entity
+@Table(name = "SeedDownload")
+public class SeedDownload {
+
+ @Id
+ @Column(name = "task_id", length = 64, nullable = false)
+ public String taskId;
+
+ @Column(name = "user_id", length = 36, nullable = false)
+ public String userId;
+
+ @Column(name = "seed_id", length = 64, nullable = false)
+ public String seedId;
+
+ @Column(name = "download_start", nullable = false)
+ public LocalDateTime downloadStart;
+
+ @Column(name = "download_end")
+ public LocalDateTime downloadEnd;
+
+ @Column(name = "is_dedicated", nullable = false)
+ public boolean isDedicated;
+
+ @Column(name = "client_ip", length = 45)
+ public String clientIp;
+
+ // Constructors
+ public SeedDownload() {}
+
+ public SeedDownload(String taskId, String userId, String seedId, LocalDateTime downloadStart, LocalDateTime downloadEnd, boolean isDedicated, String clientIp) {
+ this.taskId = taskId;
+ this.userId = userId;
+ this.seedId = seedId;
+ this.downloadStart = downloadStart;
+ this.downloadEnd = downloadEnd;
+ this.isDedicated = isDedicated;
+ this.clientIp = clientIp;
+ }
+
+ // Getters and Setters
+ public String getTaskId() {
+ return taskId;
+ }
+
+ public void setTaskId(String taskId) {
+ this.taskId = taskId;
+ }
+
+ public String getUserId() {
+ return userId;
+ }
+
+ public void setUserId(String userId) {
+ this.userId = userId;
+ }
+
+ public String getSeedId() {
+ return seedId;
+ }
+
+ public void setSeedId(String seedId) {
+ this.seedId = seedId;
+ }
+
+ public LocalDateTime getDownloadStart() {
+ return downloadStart;
+ }
+
+ public void setDownloadStart(LocalDateTime downloadStart) {
+ this.downloadStart = downloadStart;
+ }
+
+ public LocalDateTime getDownloadEnd() {
+ return downloadEnd;
+ }
+
+ public void setDownloadEnd(LocalDateTime downloadEnd) {
+ this.downloadEnd = downloadEnd;
+ }
+
+ public boolean isDedicated() {
+ return isDedicated;
+ }
+
+ public void setDedicated(boolean dedicated) {
+ isDedicated = dedicated;
+ }
+
+ public String getClientIp() {
+ return clientIp;
+ }
+
+ public void setClientIp(String clientIp) {
+ this.clientIp = clientIp;
+ }
+
+ // equals and hashCode based on taskId
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (!(o instanceof SeedDownload)) return false;
+ SeedDownload that = (SeedDownload) o;
+ return taskId != null && taskId.equals(that.taskId);
+ }
+
+ @Override
+ public int hashCode() {
+ return 31 + (taskId != null ? taskId.hashCode() : 0);
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/entity/config.java b/src/main/java/entity/config.java
index 0cf39c1..71f3b4f 100644
--- a/src/main/java/entity/config.java
+++ b/src/main/java/entity/config.java
@@ -1,14 +1,15 @@
package entity;
public class config {
- public String TrackerURL;
- public int FarmNumber;
- public int FakeTime;
- public int BegVote;
+ public static final String TrackerURL="";
+ public static final int FarmNumber=3;
+ public static final int FakeTime=3;
+ public static final int BegVote=3;
// 请根据实际环境修改为可达的地址
- public String SqlURL = "192.168.5.9:3306";
- public String Database = "pt_database";
- public String TestDatabase = "pt_database_test";
- public String SqlPassword = "123456";
- public String SqlUsername = "root";
+ public static final String SqlURL = "192.168.5.9:3306";
+ public static final String Database = "pt_database";
+ public static final String TestDatabase = "pt_database_test";
+ public static final String SqlPassword = "123456";
+ public static final String SqlUsername = "root";
+ public static final String TORRENT_STORAGE_DIR = "torrents";
}