-
Notifications
You must be signed in to change notification settings - Fork 0
/
server.go
76 lines (66 loc) · 2.09 KB
/
server.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
package main
////////////////// TO-DOs
//////////////////
////////////////// - Password reset for AuthTable:
////////////////// - Setting server name/address, subject & body message for password reset emails
////////////////// - Send configurable emails for password resets
//////////////////
////////////////// - Database server
////////////////// - Connection authentication
////////////////// - Connection privillages
//////////////////
////////////////// - Rate & connection limiting
//////////////////
////////////////// - Clustering
////////////////// - Connect to cluster nodes & agree upon master node
////////////////// - Master assigns nodes key numbers and creates a keyspace unless valid ones have been created already
////////////////// - Master ensures all nodes contain the same table schemas
////////////////// - ...
////////////////// - Global unique values
//////////////////
////////////////// - Ordered tables
//////////////////
////////////////// MAYBEs
//////////////////
////////////////// - Repair-in-place after schema changes (repair table entries as they're accessed)
import (
"github.com/hewiefreeman/GopherDB/helpers"
"fmt"
//"html"
"net/http"
"sync"
)
var (
statusMux sync.Mutex
masterPass []byte
dbStatus int
replica bool
readOnly bool
replicasMux sync.Mutex
replicas []string = []string{}
balancersMux sync.Mutex
balancers []string = []string{}
)
const (
configFile string = "db.conf"
defaultConfigFile string = "{\"masterPass\":\"\",\"dbs\":[],\"replica\":false,\"readOnly\":false,\"replicas\":[],\"routers\":[],\"AuthTables\":[],\"Leaderboards\":[]}"
)
// Database statuses
const (
statusSettingUp = iota
statusHealthy
statusRecovering
statusReplicationFailure
statusOffline
)
func main() {
// initialize and start database server
/*http.HandleFunc("/", queryHandler)
fmt.Println("starting server...")
if err := http.ListenAndServe("localhost:8082", nil); err != nil {
fmt.Println(err)
}*/
}
func queryHandler(w http.ResponseWriter, r *http.Request) {
//
}