{"action":"closed","issue":{"url":"https://api.github.com/repos/peterbourgon/diskv/issues/25","labels_url":"https://api.github.com/repos/peterbourgon/diskv/issues/25/labels{/name}","comments_url":"https://api.github.com/repos/peterbourgon/diskv/issues/25/comments","events_url":"https://api.github.com/repos/peterbourgon/diskv/issues/25/events","html_url":"https://github.com/peterbourgon/diskv/issues/25","id":104977019,"number":25,"title":"Diskv concurrent access for read-modify-write cycle","user":{"login":"zserge","id":1911760,"avatar_url":"https://avatars.githubusercontent.com/u/1911760?v=3","gravatar_id":"","url":"https://api.github.com/users/zserge","html_url":"https://github.com/zserge","followers_url":"https://api.github.com/users/zserge/followers","following_url":"https://api.github.com/users/zserge/following{/other_user}","gists_url":"https://api.github.com/users/zserge/gists{/gist_id}","starred_url":"https://api.github.com/users/zserge/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zserge/subscriptions","organizations_url":"https://api.github.com/users/zserge/orgs","repos_url":"https://api.github.com/users/zserge/repos","events_url":"https://api.github.com/users/zserge/events{/privacy}","received_events_url":"https://api.github.com/users/zserge/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-09-04T21:57:08Z","updated_at":"2015-11-13T11:51:32Z","closed_at":"2015-11-13T11:51:32Z","body":"Diskv looks like a nice storage with good performance and simple API, thanks for writing it!\r\n\r\nI'm looking for a simple+fast way to update a value in the store. Say, I want to read my object from the store, modify some of its properties and write it back. I want this whole sequence to be goroutine-safe so only one thread could modify the object at a time. And ideally I'd prefer not to use a single global lock. What would you recommend?\r\n\r\nAs for the global lock - I may use multiple diskv instances (like a pool) and for each key find a suitable instance first, then lock/unlock it. I see that Diskv structure already has a mutex (which is public) and that mutex is used internally to synchronize reads and writes. Since Go mutex is not reentrant - I think it's somewhat unsafe to expose this mutex. Am I right, that despite of being public - I should not use that mutex to lock/unlock Diskv instance?\r\n"}}