-
Notifications
You must be signed in to change notification settings - Fork 34
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
feat: add http routes and handlers to get/patch the memstore config #293
Merged
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
055b938
feat: add http routes and handlers to get/patch the memstore config
samlaf 5ce2dbc
test(memstore_handlers): fix GET tests
samlaf 75cf365
style: make format
samlaf c2bc549
style(memconfig): remove unneeded tags from struct in MarshalJSON
samlaf 2101c7a
chore: add marshalJSON function to memstore safeconfig (it wasnt gett…
samlaf cf912ea
style(verifier): better startup logs
samlaf 129babd
chore: fix golangci.yml errors/warnings
samlaf 8b8a114
chore(makefile): clean up irrelevant run-memstore-server flags
samlaf 4216b01
test: fix fuzz test (CreateTestSuite was not registering the route af…
samlaf 0a9e2ad
Update store/generated_key/memstore/README.md
samlaf 90112cb
docs(memstore): add command to print memstore flags
samlaf 45be4b8
Merge branch 'main' into feat--memstore-config-http-api
samlaf 796fe54
Merge branch 'main' into feat--memstore-config-http-api
samlaf File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 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,49 @@ | ||
# Memstore Backend | ||
|
||
The Memstore backend is a simple in-memory key-value store that is meant to replace a real EigenDA backend (talking to the disperser) for testing and development purposes. It is **never** recommended for production use. | ||
|
||
## Usage | ||
|
||
```bash | ||
./bin/eigenda-proxy --memstore.enabled | ||
``` | ||
|
||
## Configuration | ||
|
||
See [memconfig/config.go](./memconfig/config.go) for the configuration options. | ||
These can all be set via their respective flags or environment variables. Run `./bin/eigenda-proxy --help | grep memstore` to see these. | ||
|
||
## Config REST API | ||
|
||
The Memstore backend also provides a REST API for changing the configuration at runtime. This is useful for testing different configurations without restarting the proxy. | ||
|
||
The API consists of GET and PATCH methods on the `/memstore/config` resource. | ||
|
||
### Get the current configuration | ||
|
||
```bash | ||
$ curl http://localhost:3100/memstore/config | jq | ||
{ | ||
"MaxBlobSizeBytes": 16777216, | ||
"BlobExpiration": "25m0s", | ||
"PutLatency": "0s", | ||
"GetLatency": "0s", | ||
"PutReturnsFailoverError": false | ||
} | ||
``` | ||
|
||
### Set a configuration option | ||
|
||
The PATCH request allows to patch the configuration. This allows only sending a subset of the configuration options. The other fields will be left intact. | ||
|
||
```bash | ||
$ curl -X PATCH http://localhost:3100/memstore/config -d '{"PutReturnsFailoverError": true}' | ||
{"MaxBlobSizeBytes":16777216,"BlobExpiration":"25m0s","PutLatency":"0s","GetLatency":"0s","PutReturnsFailoverError":true} | ||
``` | ||
|
||
One can of course still build a jq pipe to produce the same result (although still using PATCH instead of PUT since that is the only method available): | ||
```bash | ||
$ curl http://localhost:3100/memstore/config | \ | ||
jq '.PutLatency = "5s" | .GetLatency = "2s"' | \ | ||
curl -X PATCH http://localhost:3100/memstore/config -d @- | ||
``` | ||
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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we add a todo to codify a client for this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#294