-
Notifications
You must be signed in to change notification settings - Fork 17
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
Add a brain #7
Comments
I can't personally see a reason to use a flatfile, but I could see using another nosql db style like Mongo being useful. I've not much knowledge on Redis, but i'm looking at possibly creating a "smart" ai, and have no clue of the data structure required to do so; My point is that creating a solid interface/trait for db access is more important than a flatfile; which would allow implementations for whatever backend we might want. |
The initial trait I had in mind was something like: trait Brain {
fn set(key: &str, value: Json);
fn get(key: &str) -> Json
} Since that would support all of the adapter/handler usage I have conceived so far. |
I'm torn between having a generic persistence trait like above and just offering a namespaced Redis wrapper to the handlers. The trade is as follows. Generic
Redis
Hubot went the route of having a brain which is just a JSON keystore thing. Lita went the latter route and offered the full redis API. One of hubot's more popular plugins is a redis-brain, but it's really just a JSON key store backed by redis. I'm inclined to go the Redis route because it's definitely more flexible from the handler perspective. |
Do both! :-D Seriously though, I'd say go the Redis route. There's really no compelling reason to use something other than Redis for a keystore. It does it very well after all. |
Thanks for the feedback! I have been thinking similarly. In addition to the value of the keystore, several of the handlers I want to build would benefit from the set functions. Sadly I haven't made time to work on this for a while... but there is a long weekend coming up! 🎈 😁 |
Make it so the bot can remember things. Create a brain that the handlers and adapters can use.
Brain
traitRedisBrain
implementationIs there any value in the text file version? It might be nice for debugging. I would worry about losing data.
The text was updated successfully, but these errors were encountered: