Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
number571 committed Nov 25, 2024
1 parent ac8f964 commit 32de419
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 16 deletions.
11 changes: 6 additions & 5 deletions build/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,9 @@ type SSettings struct {
FService uint32 `yaml:"service"`
} `yaml:"proto_mask"`
FQueueCapacity struct {
FMain uint64 `yaml:"main"`
FRand uint64 `yaml:"rand"`
FCons uint64 `yaml:"cons"`
FMainPool uint64 `yaml:"main_pool"`
FRandPool uint64 `yaml:"rand_pool"`
FConsumers uint64 `yaml:"consumers"`
} `yaml:"queue_capacity"`
FNetworkManager struct {
FConnectsLimiter uint64 `yaml:"connects_limiter"`
Expand All @@ -104,8 +104,9 @@ type SSettings struct {
func (p SSettings) validate() error {
switch {
case
p.FQueueCapacity.FMain == 0,
p.FQueueCapacity.FRand == 0:
p.FQueueCapacity.FMainPool == 0,
p.FQueueCapacity.FRandPool == 0,
p.FQueueCapacity.FConsumers == 0:
return errors.New("queue_capacity is invalid")
case
p.FNetworkManager.FConnectsLimiter == 0,
Expand Down
9 changes: 5 additions & 4 deletions build/build_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,9 @@ func TestHiddenLakeSettings(t *testing.T) {
return
}

settings.FQueueCapacity.FMain = 64
settings.FQueueCapacity.FRand = 64
settings.FQueueCapacity.FMainPool = 64
settings.FQueueCapacity.FRandPool = 64
settings.FQueueCapacity.FConsumers = 1
if err := settings.validate(); err == nil {
t.Error("success validate with invalid network manager")
return
Expand Down Expand Up @@ -84,11 +85,11 @@ func TestHiddenLakeSettings(t *testing.T) {
t.Error(`GGSettings.ProtoMask.Service != 0x5f686c5f`)
return
}
if GSettings.FQueueCapacity.FMain != 256 {
if GSettings.FQueueCapacity.FMainPool != 256 {
t.Error(`GSettings.QueueCapacity.Main != 256`)
return
}
if GSettings.FQueueCapacity.FRand != 32 {
if GSettings.FQueueCapacity.FRandPool != 32 {
t.Error(`GSettings.QueueCapacity.Rand != 32`)
return
}
Expand Down
6 changes: 3 additions & 3 deletions build/settings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ proto_mask:
network: 0x5f67705f
service: 0x5f686c5f
queue_capacity:
main: 256
rand: 32
cons: 1
main_pool: 256
rand_pool: 32
consumers: 1
network_manager:
cache_hashes_cap: 2048
connects_limiter: 256
Expand Down
6 changes: 3 additions & 3 deletions pkg/network/network.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,10 @@ func NewHiddenLakeNode(
}),
FQueuePeriod: pSettings.GetQueuePeriod(),
FNetworkMask: build.GSettings.FProtoMask.FNetwork,
FConsumersCap: build.GSettings.FQueueCapacity.FCons,
FConsumersCap: build.GSettings.FQueueCapacity.FConsumers,
FQueuePoolCap: [2]uint64{
build.GSettings.FQueueCapacity.FMain,
build.GSettings.FQueueCapacity.FRand,
build.GSettings.FQueueCapacity.FMainPool,
build.GSettings.FQueueCapacity.FRandPool,
},
}),
func() client.IClient {
Expand Down
2 changes: 1 addition & 1 deletion test/result/badge_codelines.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 32de419

Please sign in to comment.