Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bdickson latest edits - fix issue with generated test data #7

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions backend/backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
23 changes: 23 additions & 0 deletions backend/cen2.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
DROP TABLE IF EXISTS CENKeys;
brian-peter-dickson marked this conversation as resolved.
Show resolved Hide resolved
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`)
);