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

Is there any way to use Easegress etcd cluster storage api in my own custom business filter? #511

Closed
jthann opened this issue Feb 16, 2022 · 4 comments

Comments

@jthann
Copy link
Collaborator

jthann commented Feb 16, 2022

I am developing new filter using Easegress,in other api gateway sometime I need to use cluster cache like redis to cache expired token,but in Easegress it already has etcd embedded and I don't want to introduce new outer cache component, so is it possible to use Easegress own cluster storage api do something like this, or is it a proper way?

@localvar
Copy link
Collaborator

Please check if the CustomData feature meets your requirement (the PR has been merged, but the feature has not been released yet, please get the latest code from the main branch).
Or, you can use the APIs in the cluster package directly for data storage.

@jthann
Copy link
Collaborator Author

jthann commented Feb 17, 2022

Thanks, CustomData cannot support expired data store. I investigate the source code,currently the only way to to initialize cluster storage api for client user is to get command opt params and call cluster.New(opt) like the way in cmd/server/main.go. We should support something like factory pattern in pkg/cluster/cluster_interface.go so client user can get cluster instance conveniently.

@samutamm
Copy link
Contributor

@jthann You don't have to initialize new cluster instance, because Easegress creates one instance at startup and it's reused everywhere. Here's example how you access to the global cluster instance from Filter.Init function.

@jthann
Copy link
Collaborator Author

jthann commented Feb 18, 2022

Thanks, I get it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants