File tree Expand file tree Collapse file tree 2 files changed +10
-11
lines changed
Expand file tree Collapse file tree 2 files changed +10
-11
lines changed Original file line number Diff line number Diff line change @@ -70,31 +70,31 @@ pub struct Config {
7070
7171 /// the number of organizations.
7272 #[ argh( option, default = "1000" ) ]
73- pub number_of_orgs : u64 ,
73+ pub orgs : u64 ,
7474
7575 /// the number of projects per organization.
7676 #[ argh( option, default = "10" ) ]
77- pub number_of_projects : u64 ,
77+ pub projects : u64 ,
7878}
7979
8080impl Config {
8181 pub fn validate ( & mut self ) -> Result < ( ) > {
82- if self . number_of_orgs == 0 {
82+ if self . orgs == 0 {
8383 log:: error!( "invalid number of orgs, using default value of 1" ) ;
84- self . number_of_orgs = 1 ;
84+ self . orgs = 1 ;
8585 }
8686
87- if self . number_of_projects == 0 {
87+ if self . projects == 0 {
8888 log:: error!( "invalid number of projects, using default value of 1" ) ;
89- self . number_of_projects = 1 ;
89+ self . projects = 1 ;
9090 }
9191
92- if self . number_of_projects >= MAX_PROJECTS {
92+ if self . projects >= MAX_PROJECTS {
9393 log:: error!(
9494 "number of projects too high, using maximum value of {}" ,
9595 MAX_PROJECTS - 1
9696 ) ;
97- self . number_of_projects = MAX_PROJECTS - 1 ;
97+ self . projects = MAX_PROJECTS - 1 ;
9898 }
9999
100100 if self . tree_depth == 0 {
Original file line number Diff line number Diff line change @@ -57,12 +57,11 @@ impl<'a> RandomGenerator<'a> {
5757 }
5858
5959 pub fn organization_id ( & mut self ) -> u64 {
60- self . rng . random_range ( 1 ..self . config . number_of_orgs + 1 )
60+ self . rng . random_range ( 1 ..self . config . orgs + 1 )
6161 }
6262
6363 pub fn project_id ( & mut self , organization_id : u64 ) -> u64 {
64- self . rng . random_range ( 1 ..self . config . number_of_projects + 1 )
65- + organization_id * MAX_PROJECTS
64+ self . rng . random_range ( 1 ..self . config . projects + 1 ) + ( organization_id - 1 ) * MAX_PROJECTS
6665 }
6766
6867 pub fn segment_count ( & mut self ) -> usize {
You can’t perform that action at this time.
0 commit comments