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

Initial skeleton for Tr1d1um (WIP) #1

Merged
merged 10 commits into from
Sep 15, 2017
111 changes: 111 additions & 0 deletions src/glide.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion src/glide.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,3 @@ homepage: https://github.com/Comcast/tr1d1um
import:
- package: github.com/Comcast/webpa-common
version: cb246362b61aaf042a936fa615a48554d111f9b4

70 changes: 70 additions & 0 deletions src/tr1d1um/WDMP_Type.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
package main

const(
COMMAND_GET = "GET"
COMMAND_GET_ATTRS = "GET_ATTRIBUTES"
COMMAND_SET = "SET"
COMMAND_SET_ATTRS = "SET_ATTRIBUTES"
COMMAND_TEST_SET = "TEST_AND_SET"
COMMAND_ADD_ROW = "ADD_ROW"
COMMAND_DELETE_ROW = "DELETE_ROW"
COMMAND_REPLACE_ROWS = "REPLACE_ROWS"

HEADER_WPA_SYNC_OLD_CID = "X-Webpa-Sync-Old-Cid"
HEADER_WPA_SYNC_NEW_CID = "X-Webpa-Sync-New-Cid"
HEADER_WPA_SYNC_CMC = "X-Webpa-Sync-Cmc"

ERR_UNSUCCESSFUL_DATA_PARSE = "Unsuccessful Data Parse"
)
/*
GET-Flavored structs
*/

type GetWDMP struct {
Command string `json:"command"`
Names []string `json:"names,omitempty"`
Attribute string `json:"attributes,omitempty"`
}

/*
SET-Flavored structs
*/

type Attr map[string]interface{}

type SetParam struct {
Name* string `json:"name"`
DataType* int32 `json:"dataType,omitempty"`
Value interface{} `json:"value,omitempty"`
Attributes Attr `json:"attributes,omitempty"`
}

type SetWDMP struct {
Command string `json:"command"`
OldCid string `json:"old-cid,omitempty"`
NewCid string `json:"new-cid,omitempty"`
SyncCmc string `json:"sync-cmc,omitempty"`
Parameters []SetParam `json:"parameters,omitempty"`
}

/*
Row-related command structs
*/

type AddRowWDMP struct {
Command string `json:"command"`
Table string `json:"table"`
Row map[string]string `json:"row"`
}

type ReplaceRowsWDMP struct {
Command string `json:"command"`
Table string `json:"table"`
Rows map[string]map[string]string `json:"rows"`
}

type DeleteRowWDMP struct {
Command string `json:"command"`
Row string `json:"row"`
}

Loading