-
Notifications
You must be signed in to change notification settings - Fork 247
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #14 from radu-matei/toolkit
- Loading branch information
Showing
12 changed files
with
74 additions
and
36 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
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 was deleted.
Oops, something went wrong.
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,4 @@ | ||
use * from http-types | ||
|
||
// The entrypoint for an HTTP handler. | ||
handler: function(req: request) -> response |
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,4 @@ | ||
use * from types | ||
|
||
// The entrypoint for a Redis handler. | ||
handler: function(payload: payload) -> expected<_, error> |
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,7 @@ | ||
// General purpose error. | ||
enum error { | ||
success, | ||
error, | ||
} | ||
|
||
type payload = list<u8> |
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,15 @@ | ||
// A simple cache interface. | ||
|
||
use * from types | ||
|
||
// Set the payload for the given key. | ||
// Implementations may choose to ignore the time-to-live (in seconds) argument. | ||
// TODO (@radu-matei): perhaps return the number of bytes written? | ||
set: function(key: string, value: payload, ttl: option<u32>) -> expected<_, error> | ||
|
||
// Get the payload stored in the cache for the given key. | ||
// If not found, return a success result with an empty payload. | ||
get: function(key: string) -> expected<payload, error> | ||
|
||
// Delete the cache entry for the given key. | ||
delete: function(key: string) -> expected<_, error> |
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,20 @@ | ||
// Log levels. | ||
enum level { | ||
trace, | ||
debug, | ||
info, | ||
warn, | ||
error, | ||
fatal | ||
} | ||
|
||
// General log function. | ||
log: function(msg: string, lvl: level) | ||
|
||
// Specialized log functions. | ||
trace: function(msg: string) | ||
debug: function(msg: string) | ||
info: function(msg: string) | ||
warn: function(msg: string) | ||
error: function(msg: string) | ||
fatal: function(msg: string) |
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,4 @@ | ||
use * from http-types | ||
|
||
// Send an HTTP request and return a response or a potential error. | ||
request: function(req: request) -> expected<response, http-error> |