Skip to content

Commit 70f7d63

Browse files
committed
remove naive batch from core
Signed-off-by: Hagar Meir <[email protected]>
1 parent 96134d8 commit 70f7d63

File tree

3 files changed

+3
-44
lines changed

3 files changed

+3
-44
lines changed

core/abc_test.go

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -79,11 +79,7 @@ type shardCommitter struct {
7979
}
8080

8181
func (s *shardCommitter) Append(partyID arma_types.PartyID, batchSeq arma_types.BatchSequence, batchedRequests arma_types.BatchedRequests) {
82-
nb := &naiveBatch{
83-
requests: batchedRequests,
84-
node: partyID,
85-
}
86-
82+
nb := arma_types.NewSimpleBatch(batchSeq, arma_types.ShardID(s.shardID), partyID, batchedRequests)
8783
s.sr.subscribers[s.shardID] <- nb
8884
}
8985

core/assembler_test.go

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -193,12 +193,7 @@ func TestAssembler(t *testing.T) {
193193
buff := make([]byte, 1024)
194194
binary.BigEndian.PutUint16(buff, uint16(shardID))
195195
binary.BigEndian.PutUint16(buff[100:], uint16(seq))
196-
batch := &naiveBatch{
197-
shardID: shardID,
198-
node: 1,
199-
seq: seq,
200-
requests: [][]byte{buff},
201-
}
196+
batch := types.NewSimpleBatch(seq, shardID, 1, [][]byte{buff})
202197
digests[string(batch.Digest())] = struct{}{}
203198
batchesForShard = append(batchesForShard, batch)
204199
}

core/batcher_old_test.go

Lines changed: 1 addition & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,7 @@ func (r *naiveReplication) Stop() {
6666

6767
func (r *naiveReplication) Append(partyID arma_types.PartyID, batchSeq arma_types.BatchSequence, batchedRequests arma_types.BatchedRequests) {
6868
for _, s := range r.subscribers {
69-
s <- &naiveBatch{
70-
node: partyID,
71-
seq: arma_types.BatchSequence(batchSeq),
72-
requests: batchedRequests,
73-
}
69+
s <- arma_types.NewSimpleBatch(batchSeq, 0, partyID, batchedRequests)
7470
}
7571
}
7672

@@ -84,34 +80,6 @@ func (r *naiveReplication) RetrieveBatchByNumber(partyID arma_types.PartyID, seq
8480
return nil
8581
}
8682

87-
type naiveBatch struct {
88-
shardID arma_types.ShardID
89-
node arma_types.PartyID
90-
seq arma_types.BatchSequence
91-
requests [][]byte
92-
}
93-
94-
func (nb *naiveBatch) Primary() arma_types.PartyID {
95-
return nb.node
96-
}
97-
98-
func (nb *naiveBatch) Digest() []byte {
99-
br := arma_types.BatchedRequests(nb.requests)
100-
return br.Digest()
101-
}
102-
103-
func (nb *naiveBatch) Shard() arma_types.ShardID {
104-
return nb.shardID
105-
}
106-
107-
func (nb *naiveBatch) Seq() arma_types.BatchSequence {
108-
return nb.seq
109-
}
110-
111-
func (nb *naiveBatch) Requests() arma_types.BatchedRequests {
112-
return nb.requests
113-
}
114-
11583
type acker struct {
11684
from arma_types.PartyID
11785
batchers []*core.Batcher

0 commit comments

Comments
 (0)