js-libp2p
js-libp2p copied to clipboard
Atomic and transactional read/write
I want to implement a global lock in Libp2p. Is it possible? any way to atomically read/write DHT records?
Could you expand a little more on your use case? Presumably you'd need to handle failures, rollback, prevent deadlocks, etc.
This isn't something we have planned currently.
Could you expand a little more on your use case? Presumably you'd need to handle failures, rollback, prevent deadlocks, etc.
This isn't something we have planned currently.
Something like this: https://redis.io/commands/setnx/
There is a network with N nodes. One node can acquire a lock for T seconds to run an operation. While the lock is not expired, other nodes can't acquire the lock.
Deadlocks and rollback could be handled by the application. I just want to know that this use case is feasible or not?
If you're talking about an application-level lock, it sounds like you'd need to implement a custom protocol that does the lock operations which is totally feasible.
If this is something that would meet your needs, you could look at the fetch protocol for an example - it's a very simple request/response protocol that sends and receives messages between peers - you'd design your locking protocol to operate in a similar way.
Oops, seems like we needed more information for this issue, please comment with more details or this issue will be closed in 7 days.
This issue was closed because it is missing author input.