Commit Graph

6 Commits

Author SHA1 Message Date
Taylor Blau
e947838aae lfs/batcher: remove Lot type for []Transferable
@rubyist brings up a good point that the Lot type, being sent down to clients of
the `Batcher` type, introduces some complexity in that clients must know how
`Lot`s work. I don't think the `Lot` type gives a clear enough advantage to
warrant the added complexity for clients.

This commit drops the `Lot` type for operations directly on `[]Transferable`,
but keeps some of the refactors from earlier in PR #615.
2015-08-28 11:34:33 -04:00
Taylor Blau
79f939c99e lfs/batcher: remove ambiguity in argument to IsFull func
This commit removes an ambiguity in the signature of the IsFull function on the
Lot type. Since the IsFull method has to do with checking the length of the
underlying slice, it seemed more appropriate to call the argument something to
do with length, rather than capacity.
2015-08-28 01:06:32 -04:00
Taylor Blau
37a82cb630 lfs/batcher: refactor run goroutine, introduce type Lot
This commit introduces several refactorings to the `run` method (now called
`acceptInput`) on the Batcher type, and introduces the type `Lot`.

- A call to `acceptInput` directly does not spawn a goroutine. The recommended
  way to initialize is to spawn it as a goroutine, which is how the constructor
  method handles initialization of the Batcher type.

- The responsibility of creating new batches is pushed down into the `newBatch`
  func, which allocates a slice of `Transferable`s and sets its capacity at the
  maximum batch size by calling into the NewLot constructor func.

- The Lot type lets us make use of several convenience methods by wrapping the
  []Transferable type. Pushed out the responsibility of checking whether a given
  "batch" (now Lot) is full. Also delegates the responsibility of Lot allocation
  et. al. further down.
2015-08-28 00:58:49 -04:00
rubyist
4539fcfc7e Remove some stale code from batcher 2015-07-27 14:54:54 -04:00
rubyist
c20272c16c Remove batcher timeout 2015-07-15 14:32:59 -07:00
rubyist
b9c4b3abfa Introduce a batcher that batches things into groups of n 2015-07-09 13:21:07 -04:00