tidwall / summitdb

In-memory NoSQL database with ACID transactions, Raft consensus, and Redis API
Other
1.41k stars 78 forks source link

Q: read the last FENCE token without incrementing? #10

Closed glycerine closed 7 years ago

glycerine commented 7 years ago

To check if I have won an election, I'd like to read the value of the FENCE counter -- without adding to the fence token. Is this possible?

2nd question: is it possible to listen on a FENCE for changes, or does one need to poll?

tidwall commented 7 years ago

To check if I have won an election, I'd like to read the value of the FENCE counter -- without adding to the fence token. Is this possible?

No. Right now it's only possible to increment the token and get the new value back.

I would be trivial to add this feature, perhaps:

FENCE token PEEK

could return the current token value.

2nd question: is it possible to listen on a FENCE for changes, or does one need to poll?

At this time there's no way to listen for changes.