-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor RedisTimeSeries and RedisGears commands (#202)
* Refactor RedisTimeSeries and RedisGears commands * Add tests
1 parent
8946bed
commit 1a900bb
Showing
17 changed files
with
328 additions
and
234 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
package models | ||
|
||
/** | ||
* RedisGears Commands | ||
*/ | ||
const ( | ||
GearsPyStats = "rg.pystats" | ||
GearsDumpRegistrations = "rg.dumpregistrations" | ||
GearsPyExecute = "rg.pyexecute" | ||
GearsPyDumpReqs = "rg.pydumpreqs" | ||
) | ||
|
||
/** | ||
* RG.PYSTATS Radix marshaling | ||
*/ | ||
type PyStats struct { | ||
TotalAllocated int64 `redis:"TotalAllocated"` | ||
PeakAllocated int64 `redis:"PeakAllocated"` | ||
CurrAllocated int64 `redis:"CurrAllocated"` | ||
} | ||
|
||
/** | ||
* RG.DUMPREGISTRATIONS Radix marshaling | ||
*/ | ||
type DumpRegistrations struct { | ||
ID string `redis:"id"` | ||
Reader string `redis:"reader"` | ||
Desc string `redis:"desc"` | ||
RegistrationData RegistrationData `redis:"RegistrationData"` | ||
PD string `redis:"PD"` | ||
} | ||
|
||
/** | ||
* Registration data for RG.DUMPREGISTRATIONS Radix marshaling | ||
*/ | ||
type RegistrationData struct { | ||
Mode string `redis:"mode"` | ||
NumTriggered int64 `redis:"numTriggered"` | ||
NumSuccess int64 `redis:"numSuccess"` | ||
NumFailures int64 `redis:"numFailures"` | ||
NumAborted int64 `redis:"numAborted"` | ||
LastError string `redis:"lastError"` | ||
Args map[string]interface{} `redis:"args"` | ||
Status string `redis:"status"` | ||
} | ||
|
||
/** | ||
* RG.PYDUMPREQS Radix marshaling | ||
*/ | ||
type PyDumpReq struct { | ||
GearReqVersion int64 `redis:"GearReqVersion"` | ||
Name string `redis:"Name"` | ||
IsDownloaded string `redis:"IsDownloaded"` | ||
IsInstalled string `redis:"IsInstalled"` | ||
CompiledOs string `redis:"CompiledOs"` | ||
Wheels []string `redis:"Wheels"` | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package models | ||
|
||
/** | ||
* RedisTimeSeries Commands | ||
*/ | ||
const ( | ||
TimeSeriesGet = "ts.get" | ||
TimeSeriesInfo = "ts.info" | ||
TimeSeriesQueryIndex = "ts.queryindex" | ||
TimeSeriesRange = "ts.range" | ||
TimeSeriesMRange = "ts.mrange" | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/** | ||
* Supported Commands | ||
*/ | ||
export enum RedisGears { | ||
DUMPREGISTRATIONS = 'rg.dumpregistrations', | ||
PYSTATS = 'rg.pystats', | ||
PYDUMPREQS = 'rg.pydumpreqs', | ||
PYEXECUTE = 'rg.pyexecute', | ||
} | ||
|
||
/** | ||
* Commands List | ||
*/ | ||
export const RedisGearsCommands = [ | ||
{ | ||
label: RedisGears.DUMPREGISTRATIONS.toUpperCase(), | ||
description: 'Outputs the list of function registrations', | ||
value: RedisGears.DUMPREGISTRATIONS, | ||
}, | ||
{ | ||
label: RedisGears.PYSTATS.toUpperCase(), | ||
description: 'Returns memory usage statistics from the Python interpreter', | ||
value: RedisGears.PYSTATS, | ||
}, | ||
{ | ||
label: RedisGears.PYDUMPREQS.toUpperCase(), | ||
description: 'Returns a list of all the python requirements available', | ||
value: RedisGears.PYDUMPREQS, | ||
}, | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters