Tweak new names

This commit is contained in:
Mike Spreitzer 2020-01-21 20:35:45 -05:00
parent 1c092bf635
commit a65f525aed
4 changed files with 27 additions and 27 deletions

View File

@ -27,16 +27,16 @@ import (
// are separated so that errors from the first phase can be found
// before committing to a concurrency allotment for the second.
type QueueSetFactory interface {
// QualifyQueuingConfig does the first phase of creating a QueueSet
QualifyQueuingConfig(QueuingConfig) (QueueSetCompleter, error)
// BeginConstruction does the first phase of creating a QueueSet
BeginConstruction(QueuingConfig) (QueueSetCompleter, error)
}
// QueueSetCompleter finishes the two-step process of creating or
// reconfiguring a QueueSet
type QueueSetCompleter interface {
// GetQueueSet returns a QueueSet configured by the given
// Complete returns a QueueSet configured by the given
// dispatching configuration.
GetQueueSet(DispatchingConfig) QueueSet
Complete(DispatchingConfig) QueueSet
}
// QueueSet is the abstraction for the queuing and dispatching
@ -47,14 +47,14 @@ type QueueSetCompleter interface {
// . Some day we may have connections between priority levels, but
// today is not that day.
type QueueSet interface {
// QualifyQueuingConfig starts the two-step process of updating
// the configuration. No change is made until GetQueueSet is
// called. If `C := X.QualifyQueuingConfig(q)` then
// `C.GetQueueSet(d)` returns the same value `X`. If the
// BeginConfigChange starts the two-step process of updating
// the configuration. No change is made until Complete is
// called. If `C := X.BeginConstruction(q)` then
// `C.Complete(d)` returns the same value `X`. If the
// QueuingConfig's DesiredNumQueues field is zero then the other
// queuing-specific config parameters are not changed, so that the
// queues continue draining as before.
QualifyQueuingConfig(QueuingConfig) (QueueSetCompleter, error)
BeginConfigChange(QueuingConfig) (QueueSetCompleter, error)
// Quiesce controls whether the QueueSet is operating normally or
// is quiescing. A quiescing QueueSet drains as normal but does

View File

@ -114,7 +114,7 @@ func NewQueueSetFactory(c clock.PassiveClock, counter counter.GoRoutineCounter)
}
}
func (qsf *queueSetFactory) QualifyQueuingConfig(qCfg fq.QueuingConfig) (fq.QueueSetCompleter, error) {
func (qsf *queueSetFactory) BeginConstruction(qCfg fq.QueuingConfig) (fq.QueueSetCompleter, error) {
dealer, err := checkConfig(qCfg)
if err != nil {
return nil, err
@ -139,7 +139,7 @@ func checkConfig(qCfg fq.QueuingConfig) (*shufflesharding.Dealer, error) {
return dealer, err
}
func (qsc *queueSetCompleter) GetQueueSet(dCfg fq.DispatchingConfig) fq.QueueSet {
func (qsc *queueSetCompleter) Complete(dCfg fq.DispatchingConfig) fq.QueueSet {
qs := qsc.theSet
if qs == nil {
qs = &queueSet{
@ -164,7 +164,7 @@ func createQueues(n, baseIndex int) []*queue {
return fqqueues
}
func (qs *queueSet) QualifyQueuingConfig(qCfg fq.QueuingConfig) (fq.QueueSetCompleter, error) {
func (qs *queueSet) BeginConfigChange(qCfg fq.QueuingConfig) (fq.QueueSetCompleter, error) {
dealer, err := checkConfig(qCfg)
if err != nil {
return nil, err

View File

@ -141,11 +141,11 @@ func init() {
func TestNoRestraint(t *testing.T) {
now := time.Now()
clk, counter := clock.NewFakeEventClock(now, 0, nil)
nrc, err := test.NewNoRestraintFactory().QualifyQueuingConfig(fq.QueuingConfig{})
nrc, err := test.NewNoRestraintFactory().BeginConstruction(fq.QueuingConfig{})
if err != nil {
t.Fatal(err)
}
nr := nrc.GetQueueSet(fq.DispatchingConfig{})
nr := nrc.Complete(fq.DispatchingConfig{})
exerciseQueueSetUniformScenario(t, "NoRestraint", nr, []uniformClient{
{1001001001, 5, 10, time.Second, time.Second},
{2002002002, 2, 10, time.Second, time.Second / 2},
@ -164,11 +164,11 @@ func TestUniformFlows(t *testing.T) {
HandSize: 3,
RequestWaitLimit: 10 * time.Minute,
}
qsc, err := qsf.QualifyQueuingConfig(qCfg)
qsc, err := qsf.BeginConstruction(qCfg)
if err != nil {
t.Fatal(err)
}
qs := qsc.GetQueueSet(fq.DispatchingConfig{ConcurrencyLimit: 4})
qs := qsc.Complete(fq.DispatchingConfig{ConcurrencyLimit: 4})
exerciseQueueSetUniformScenario(t, "UniformFlows", qs, []uniformClient{
{1001001001, 5, 10, time.Second, time.Second},
@ -188,11 +188,11 @@ func TestDifferentFlows(t *testing.T) {
HandSize: 3,
RequestWaitLimit: 10 * time.Minute,
}
qsc, err := qsf.QualifyQueuingConfig(qCfg)
qsc, err := qsf.BeginConstruction(qCfg)
if err != nil {
t.Fatal(err)
}
qs := qsc.GetQueueSet(fq.DispatchingConfig{ConcurrencyLimit: 4})
qs := qsc.Complete(fq.DispatchingConfig{ConcurrencyLimit: 4})
exerciseQueueSetUniformScenario(t, "DifferentFlows", qs, []uniformClient{
{1001001001, 6, 10, time.Second, time.Second},
@ -209,11 +209,11 @@ func TestDifferentFlowsWithoutQueuing(t *testing.T) {
Name: "TestDifferentFlowsWithoutQueuing",
DesiredNumQueues: 0,
}
qsc, err := qsf.QualifyQueuingConfig(qCfg)
qsc, err := qsf.BeginConstruction(qCfg)
if err != nil {
t.Fatal(err)
}
qs := qsc.GetQueueSet(fq.DispatchingConfig{ConcurrencyLimit: 4})
qs := qsc.Complete(fq.DispatchingConfig{ConcurrencyLimit: 4})
exerciseQueueSetUniformScenario(t, "DifferentFlowsWithoutQueuing", qs, []uniformClient{
{1001001001, 6, 10, time.Second, 57 * time.Millisecond},
@ -233,11 +233,11 @@ func TestTimeout(t *testing.T) {
HandSize: 1,
RequestWaitLimit: 0,
}
qsc, err := qsf.QualifyQueuingConfig(qCfg)
qsc, err := qsf.BeginConstruction(qCfg)
if err != nil {
t.Fatal(err)
}
qs := qsc.GetQueueSet(fq.DispatchingConfig{ConcurrencyLimit: 1})
qs := qsc.Complete(fq.DispatchingConfig{ConcurrencyLimit: 1})
exerciseQueueSetUniformScenario(t, "Timeout", qs, []uniformClient{
{1001001001, 5, 100, time.Second, time.Second},
@ -255,11 +255,11 @@ func TestContextCancel(t *testing.T) {
HandSize: 1,
RequestWaitLimit: 15 * time.Second,
}
qsc, err := qsf.QualifyQueuingConfig(qCfg)
qsc, err := qsf.BeginConstruction(qCfg)
if err != nil {
t.Fatal(err)
}
qs := qsc.GetQueueSet(fq.DispatchingConfig{ConcurrencyLimit: 1})
qs := qsc.Complete(fq.DispatchingConfig{ConcurrencyLimit: 1})
counter.Add(1) // account for the goroutine running this test
ctx1 := context.Background()
another1, exec1, cleanup1 := qs.Wait(ctx1, 1, "test", "one")

View File

@ -35,15 +35,15 @@ type noRestraintCompeter struct{}
type noRestraint struct{}
func (noRestraintFactory) QualifyQueuingConfig(qCfg fq.QueuingConfig) (fq.QueueSetCompleter, error) {
func (noRestraintFactory) BeginConstruction(qCfg fq.QueuingConfig) (fq.QueueSetCompleter, error) {
return noRestraintCompeter{}, nil
}
func (noRestraintCompeter) GetQueueSet(dCfg fq.DispatchingConfig) fq.QueueSet {
func (noRestraintCompeter) Complete(dCfg fq.DispatchingConfig) fq.QueueSet {
return noRestraint{}
}
func (noRestraint) QualifyQueuingConfig(qCfg fq.QueuingConfig) (fq.QueueSetCompleter, error) {
func (noRestraint) BeginConfigChange(qCfg fq.QueuingConfig) (fq.QueueSetCompleter, error) {
return noRestraintCompeter{}, nil
}