bb49570d5b8532171a9ad13359a42105c9b2c124
[goDBhammer.git] / src / benchcontroller.go
1 // the benchmark controller
2
3 package benchcontroller
4
5 import (
6         //"./dbconnector";
7         "os";
8         "time";
9 )
10
11 type BenchControllerConfig struct {
12         id int;
13         nclients int;
14         dbtype string;
15         dbhost string;
16         dbuser string;
17         dbpass string;
18         dbname string;
19 }
20
21 func CreateController()(contConfig *BenchControllerConfig)
22 {
23         bcConfig := new(BenchControllerConfig);
24         
25         return bcConfig;
26 }
27
28 func MainLoop(conf *BenchControllerConfig, commInChan chan int, commOutChan chan int)
29 {
30         for {
31                 time.Sleep(1000000000);
32                 i := <-commInChan;
33                 os.Stdout.WriteString("got a coms\n");
34                 
35                 switch i {
36                         case 1:
37                                 // this means shutdown
38                                 os.Stdout.WriteString("shutdown\n");
39                                 return;
40                         case 2:
41                                 // get ready to bench - start the clients
42                                 os.Stdout.WriteString("ready clients\n");
43                         case 3:
44                                 // start the clients
45                                 os.Stdout.WriteString("start clients\n");
46                 }
47         }
48 }