Lock() of Locker interface should probably take a receive-only channel

Open
#175 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
35/100
Issue type
Refactor
Clarity
Mostly clear
Activity status
Stale
Tech stack
go

Research direction

Start at store/store.go around the Locker interface and inspect the Lock signature and its implementations or callers. Check how stopChan is used, especially whether callers pass a context's Done channel. Done means the interface and affected uses consistently accept a receive-only channel without changing Lock's behavior.

Written by the indexing model from the issue text.

Description

Lock() of Locker interface should probably take a receive-only channel for stopChan, that is, instead of

Lock(stopChan chan struct{}) (<-chan struct{}, error)

have

Lock(<-stopChan chan struct{}) (<-chan struct{}, error)

Lock would not be writing to stopChan, the user of the Lock will - and this signature will allow using things like Context's Done channel directly (without mediating it with another select).

Dominant language
Go
Stars
847
Forks
204
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from docker/libkv

All issues in docker/libkv

Similar issues

More Go issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.