From f35c257697984aa96d37f394f4c04f8bb2b72e3e Mon Sep 17 00:00:00 2001 From: CaiHQ Date: Sun, 28 Nov 2021 14:52:10 +0800 Subject: [PATCH] refactor: move pbft classes --- .../sc/{sequencing => consistency}/CommitAlgorithm.java | 2 +- .../bdware/sc/{sequencing => consistency}/Committer.java | 2 +- .../org/bdware/sc/{sequencing => consistency}/Pair.java | 2 +- .../{sequencing => consistency/pbft}/PBFTAlgorithm.java | 5 ++++- .../sc/{sequencing => consistency/pbft}/PBFTMember.java | 2 +- .../sc/{sequencing => consistency/pbft}/PBFTMessage.java | 2 +- .../sc/{sequencing => consistency/pbft}/PBFTType.java | 2 +- .../{sequencing => consistency/pbft}/ViewAlgorithm.java | 8 ++++++-- .../java/org/bdware/sc/units/ContractUnitController.java | 2 +- .../org/bdware/sc/units/SequencingAlgorithmFactory.java | 2 +- 10 files changed, 18 insertions(+), 11 deletions(-) rename src/main/java/org/bdware/sc/{sequencing => consistency}/CommitAlgorithm.java (88%) rename src/main/java/org/bdware/sc/{sequencing => consistency}/Committer.java (76%) rename src/main/java/org/bdware/sc/{sequencing => consistency}/Pair.java (78%) rename src/main/java/org/bdware/sc/{sequencing => consistency/pbft}/PBFTAlgorithm.java (98%) rename src/main/java/org/bdware/sc/{sequencing => consistency/pbft}/PBFTMember.java (96%) rename src/main/java/org/bdware/sc/{sequencing => consistency/pbft}/PBFTMessage.java (98%) rename src/main/java/org/bdware/sc/{sequencing => consistency/pbft}/PBFTType.java (92%) rename src/main/java/org/bdware/sc/{sequencing => consistency/pbft}/ViewAlgorithm.java (77%) diff --git a/src/main/java/org/bdware/sc/sequencing/CommitAlgorithm.java b/src/main/java/org/bdware/sc/consistency/CommitAlgorithm.java similarity index 88% rename from src/main/java/org/bdware/sc/sequencing/CommitAlgorithm.java rename to src/main/java/org/bdware/sc/consistency/CommitAlgorithm.java index 8e2049b..f02f95f 100644 --- a/src/main/java/org/bdware/sc/sequencing/CommitAlgorithm.java +++ b/src/main/java/org/bdware/sc/consistency/CommitAlgorithm.java @@ -1,4 +1,4 @@ -package org.bdware.sc.sequencing; +package org.bdware.sc.consistency; import org.bdware.sc.conn.Node; import org.bdware.sc.units.TrustfulExecutorConnection; diff --git a/src/main/java/org/bdware/sc/sequencing/Committer.java b/src/main/java/org/bdware/sc/consistency/Committer.java similarity index 76% rename from src/main/java/org/bdware/sc/sequencing/Committer.java rename to src/main/java/org/bdware/sc/consistency/Committer.java index a8394ec..2a3abe4 100644 --- a/src/main/java/org/bdware/sc/sequencing/Committer.java +++ b/src/main/java/org/bdware/sc/consistency/Committer.java @@ -1,4 +1,4 @@ -package org.bdware.sc.sequencing; +package org.bdware.sc.consistency; import org.bdware.sc.bean.ContractRequest; diff --git a/src/main/java/org/bdware/sc/sequencing/Pair.java b/src/main/java/org/bdware/sc/consistency/Pair.java similarity index 78% rename from src/main/java/org/bdware/sc/sequencing/Pair.java rename to src/main/java/org/bdware/sc/consistency/Pair.java index 8bcb761..df14ed9 100644 --- a/src/main/java/org/bdware/sc/sequencing/Pair.java +++ b/src/main/java/org/bdware/sc/consistency/Pair.java @@ -1,4 +1,4 @@ -package org.bdware.sc.sequencing; +package org.bdware.sc.consistency; public class Pair { public T1 first; diff --git a/src/main/java/org/bdware/sc/sequencing/PBFTAlgorithm.java b/src/main/java/org/bdware/sc/consistency/pbft/PBFTAlgorithm.java similarity index 98% rename from src/main/java/org/bdware/sc/sequencing/PBFTAlgorithm.java rename to src/main/java/org/bdware/sc/consistency/pbft/PBFTAlgorithm.java index fdc0f68..a798732 100644 --- a/src/main/java/org/bdware/sc/sequencing/PBFTAlgorithm.java +++ b/src/main/java/org/bdware/sc/consistency/pbft/PBFTAlgorithm.java @@ -1,10 +1,13 @@ -package org.bdware.sc.sequencing; +package org.bdware.sc.consistency.pbft; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.bdware.sc.ContractManager; import org.bdware.sc.bean.ContractRequest; import org.bdware.sc.conn.Node; +import org.bdware.sc.consistency.CommitAlgorithm; +import org.bdware.sc.consistency.Committer; +import org.bdware.sc.consistency.Pair; import org.bdware.sc.units.TrustfulExecutorConnection; import org.bdware.sc.util.JsonUtil; import org.zz.gmhelper.SM2KeyPair; diff --git a/src/main/java/org/bdware/sc/sequencing/PBFTMember.java b/src/main/java/org/bdware/sc/consistency/pbft/PBFTMember.java similarity index 96% rename from src/main/java/org/bdware/sc/sequencing/PBFTMember.java rename to src/main/java/org/bdware/sc/consistency/pbft/PBFTMember.java index 7ab0b44..56bc77d 100644 --- a/src/main/java/org/bdware/sc/sequencing/PBFTMember.java +++ b/src/main/java/org/bdware/sc/consistency/pbft/PBFTMember.java @@ -1,4 +1,4 @@ -package org.bdware.sc.sequencing; +package org.bdware.sc.consistency.pbft; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; diff --git a/src/main/java/org/bdware/sc/sequencing/PBFTMessage.java b/src/main/java/org/bdware/sc/consistency/pbft/PBFTMessage.java similarity index 98% rename from src/main/java/org/bdware/sc/sequencing/PBFTMessage.java rename to src/main/java/org/bdware/sc/consistency/pbft/PBFTMessage.java index 5ae6fcf..731b186 100644 --- a/src/main/java/org/bdware/sc/sequencing/PBFTMessage.java +++ b/src/main/java/org/bdware/sc/consistency/pbft/PBFTMessage.java @@ -1,4 +1,4 @@ -package org.bdware.sc.sequencing; +package org.bdware.sc.consistency.pbft; import org.bdware.sc.conn.ByteUtil; diff --git a/src/main/java/org/bdware/sc/sequencing/PBFTType.java b/src/main/java/org/bdware/sc/consistency/pbft/PBFTType.java similarity index 92% rename from src/main/java/org/bdware/sc/sequencing/PBFTType.java rename to src/main/java/org/bdware/sc/consistency/pbft/PBFTType.java index b863b47..f4f1999 100644 --- a/src/main/java/org/bdware/sc/sequencing/PBFTType.java +++ b/src/main/java/org/bdware/sc/consistency/pbft/PBFTType.java @@ -1,4 +1,4 @@ -package org.bdware.sc.sequencing; +package org.bdware.sc.consistency.pbft; public enum PBFTType { Request(0), PrePrepare(1), Prepare(2), Commit(3), Reply(4), Unknown(5), ReSend(6), AddMember(7); diff --git a/src/main/java/org/bdware/sc/sequencing/ViewAlgorithm.java b/src/main/java/org/bdware/sc/consistency/pbft/ViewAlgorithm.java similarity index 77% rename from src/main/java/org/bdware/sc/sequencing/ViewAlgorithm.java rename to src/main/java/org/bdware/sc/consistency/pbft/ViewAlgorithm.java index b00fbdd..d946cc9 100644 --- a/src/main/java/org/bdware/sc/sequencing/ViewAlgorithm.java +++ b/src/main/java/org/bdware/sc/consistency/pbft/ViewAlgorithm.java @@ -1,7 +1,11 @@ -package org.bdware.sc.sequencing; +package org.bdware.sc.consistency.pbft; import org.bdware.sc.bean.ContractRequest; import org.bdware.sc.conn.Node; +import org.bdware.sc.consistency.CommitAlgorithm; +import org.bdware.sc.consistency.Committer; +import org.bdware.sc.consistency.pbft.PBFTMessage; +import org.bdware.sc.consistency.pbft.PBFTType; import org.bdware.sc.units.TrustfulExecutorConnection; public class ViewAlgorithm implements CommitAlgorithm { @@ -28,4 +32,4 @@ public class ViewAlgorithm implements CommitAlgorithm { committer.onCommit(cr); } } -} +} \ No newline at end of file diff --git a/src/main/java/org/bdware/sc/units/ContractUnitController.java b/src/main/java/org/bdware/sc/units/ContractUnitController.java index 4d96b2e..d4d68e8 100644 --- a/src/main/java/org/bdware/sc/units/ContractUnitController.java +++ b/src/main/java/org/bdware/sc/units/ContractUnitController.java @@ -4,7 +4,7 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.bdware.sc.ContractManager; import org.bdware.sc.conn.Node; -import org.bdware.sc.sequencing.CommitAlgorithm; +import org.bdware.sc.consistency.CommitAlgorithm; import java.io.Serializable; import java.util.*; diff --git a/src/main/java/org/bdware/sc/units/SequencingAlgorithmFactory.java b/src/main/java/org/bdware/sc/units/SequencingAlgorithmFactory.java index 71d7022..c88b9aa 100644 --- a/src/main/java/org/bdware/sc/units/SequencingAlgorithmFactory.java +++ b/src/main/java/org/bdware/sc/units/SequencingAlgorithmFactory.java @@ -1,6 +1,6 @@ package org.bdware.sc.units; -import org.bdware.sc.sequencing.CommitAlgorithm; +import org.bdware.sc.consistency.CommitAlgorithm; import org.bdware.sc.units.ContractUnitController.ContractUnit; public interface SequencingAlgorithmFactory {