diff --git a/backend/backend.go b/backend/backend.go index e6f0ea5..f2e5792 100644 --- a/backend/backend.go +++ b/backend/backend.go @@ -20,7 +20,7 @@ const ( TableCENReport = "CENReport" // Default Conn String - DefaultConnString = "[change this to your server]" + DefaultConnString = "root:2Nemesis234@/conn" ) // Backend holds a client to connect to the BigTable backend @@ -120,7 +120,6 @@ func (backend *Backend) ProcessCENReport(cenReport *CENReport) (err error) { return err } - curTS := uint64(time.Now().Unix()) reportID := fmt.Sprintf("%x", Computehash(reportData)) cenKeys := strings.Split(cenReport.CENKeys, ",") // store the cenreportID in cenkeys table, one row per key @@ -209,7 +208,7 @@ func Computehash(data ...[]byte) []byte { } func makeCENKeyString() string { - key := make([]byte, 16) + key := make([]byte, 32) rand.Read(key) encoded := fmt.Sprintf("%x", key) return encoded diff --git a/backend/cen2.sql b/backend/cen2.sql new file mode 100644 index 0000000..257bf6e --- /dev/null +++ b/backend/cen2.sql @@ -0,0 +1,23 @@ +DROP TABLE IF EXISTS CENKeys; +DROP TABLE IF EXISTS CENReport; + +CREATE TABLE `CENKeys` ( + `cenKey` varchar(64) DEFAULT "", + `reportID` varchar(64) DEFAULT "", + `reportTS` int, + PRIMARY KEY (`cenKey`, `reportID`), + KEY (`reportID`), + KEY (`reportTS`), + KEY (`cenKey`) +); + +CREATE TABLE `CENReport` ( + `reportID` varchar(64) DEFAULT "", + `report` varchar(4000) DEFAULT "", + `reportMimeType` varchar(64) DEFAULT "", + `reportTS` int, + PRIMARY KEY (`reportID`), + KEY (`reportTS`) +); + +