@@ -69,6 +69,7 @@ type offeringChordDiscBackend struct {
69
69
MaxRefreshesFailed int `json:"MaxRefreshesFailed"` // Maximum amount of refreshes that a supplier failed to reply
70
70
MaxRefreshesMissed int `json:"MaxRefreshesMissed"` // Maximum amount of refreshes a trader failed to send to the supplier
71
71
PartitionsStateBufferSize int `json:"PartitionsStateBufferSize"`
72
+ MaxPartitionsSearch int `json:"MaxPartitionsSearch"`
72
73
// Debug performance flags
73
74
SpreadOffers bool `json:"SpreadOffers"` // Used to tell if the spread offers mechanism is used or not.
74
75
SpreadPartitionsState bool `json:"SpreadPartitionsState"` // Used to tell if the spread partitions state is used or not.
@@ -136,6 +137,7 @@ func Default(hostIP string) *Configuration {
136
137
MaxRefreshesFailed : 2 ,
137
138
MaxRefreshesMissed : 2 ,
138
139
PartitionsStateBufferSize : 15 ,
140
+ MaxPartitionsSearch : 3 ,
139
141
// Debug performance flags
140
142
SpreadOffers : true ,
141
143
SpreadPartitionsState : true ,
@@ -283,6 +285,10 @@ func (c *Configuration) validate() error {
283
285
return fmt .Errorf ("the partitions state buffer size must be > 0" )
284
286
}
285
287
288
+ if c .MaxPartitionsSearch () <= 0 {
289
+ return fmt .Errorf ("the max partitions search must be > 0" )
290
+ }
291
+
286
292
if c .GUIDEstimatedNetworkSize () <= 0 {
287
293
return fmt .Errorf ("estimated network size must a positive integer" )
288
294
}
@@ -362,6 +368,7 @@ func (c *Configuration) Print() {
362
368
log .Printf (" Max num of refreshes failed: %d" , c .MaxRefreshesFailed ())
363
369
log .Printf (" Max num of refreshes missed: %d" , c .MaxRefreshesMissed ())
364
370
log .Printf (" Partitions State Buffer Size: %d" , c .PartitionsStateBufferSize ())
371
+ log .Printf (" Max Partitions Search: %d" , c .MaxPartitionsSearch ())
365
372
// Debug performance flags.
366
373
log .Printf (" Spread Offers: %t" , c .SpreadOffers ())
367
374
log .Printf (" Spread Partitions State: %t" , c .SpreadPartitionsState ())
@@ -485,6 +492,10 @@ func (c *Configuration) PartitionsStateBufferSize() int {
485
492
return c .Caravela .DiscoveryBackend .OfferingChordBackend .PartitionsStateBufferSize
486
493
}
487
494
495
+ func (c * Configuration ) MaxPartitionsSearch () int {
496
+ return c .Caravela .DiscoveryBackend .OfferingChordBackend .MaxPartitionsSearch
497
+ }
498
+
488
499
// Debug performance flag.
489
500
func (c * Configuration ) SpreadOffers () bool {
490
501
return c .Caravela .DiscoveryBackend .OfferingChordBackend .SpreadOffers
0 commit comments