revid: replace method value approach used for clip sending
The current approach to managing clip sending work is via a method value closure. This makes it difficult to separate clip loading to the worker from clip sending by the worker. This raises a problem for the case where we are sending via HTTP and need to repeatedly copy the ring chunk into a buffer to be thrown away even though it may be used again for a retry.
I would like to change the type of the worker from a func(*ring.Chunk) error
to an interface.
type loadSender interface {
load(*ring.Chunk) error
send() error
}
This has the additional advantage that we can then instead of keeping a loadSender
field in revid
, we can have a []loadSender
with an arbitrary set of destination protocols.
Note that the load is quick (either constant time or linear in the length of the chunk for the case of HTTP), but the send can be slow due to network; the send operations can be wrapped in a goroutine for each protocol so that they can be performed concurrently.
Comments (2)
-
-
reporter - changed status to resolved
- Log in to comment
LGTM.