Closed uncleDecart closed 2 months ago
@deitch PR is ready for review, I'll do rest of todo in separate PR(s)
Edit: I tried to make it easier to review commit-by-commit, i.e. each commit serves one purpose
I put some comments inline. One other important thing that I didn't address is the "keyspace". What is our keyspace? I see a few options:
*
, etc.)put(namespace, key, value)
or implicit, like NATS, via .
separated, as in put(namespace1.key1, value)
which might be stored and thus searched differently. Both of these imply some ability to do get("namespace1.*")
or getAll("namespace1")
, similar for delete and subscribe (doesn't make sense for put()
Regarding "key space" I believe our best option would be to have it implicit like NATS, via separated dot. Because technically it won't change the way we store things and the only thing that would be added is to get all by a regex as a special case, we can then update documentation
Are you sure that implicit doesn't change storage? There can be significant performance differences between get("foo.*")
when it's all in a single table and you need to check each key, vs separate tables.
Are you sure that implicit doesn't change storage? There can be significant performance differences between get("foo.*") when it's all in a single table and you need to check each key, vs separate tables.
True, performance will be different, but depends on how many keys will we have? Say we are talking about 20 services which are namespaces of first order, then there are subscriptions/publications of 25 in each which are namespaces of 2nd order and each of them would contain say N values for each Edge App (say 25 as well). So it's ~12500 entries in total. How much it would increase our performance to iterate over 625 entries say instead of 12500 for each request? Well, I need to add benchmarks so that we could see it in microseconds :D
You're thinking eve. I'm thinking, you're building a generic high performance low footprint kv store.
You're thinking eve. I'm thinking, you're building a generic high performance low footprint kv store.
Question is then, how many layers of nested namespaces should we allow in such generic store?
Truth is, it doesn't matter. Define the API day one, you always can optimize the back end later. You just need to think about what the API would constrain later.
Then making it implicit makes sense, we can change implementation later, so client can do wild masks on dot patterns, wdyt?
Sure. Start with that, use regex for linear search. Split it in the future.
Put description in #6 will address it in separate PR, it'll need some love
Actually got too into it so I finished all the todo list, @deitch I see one unresolved discussion about documentation, once it's done I think we're safe to merge this and proceed with other issues
This commit removes NatsClient and also introduces proper subscribe mechanism, which you can actually use to receive new values.
There's a bunch of things to do till version v0.itworks , we can slowly continue moving with multiple PRs or I'll just create commit for each point in TODO list
TODO: