mirror of
				https://github.com/optim-enterprises-bv/kubernetes.git
				synced 2025-11-04 04:08:16 +00:00 
			
		
		
		
	Tweak new names
This commit is contained in:
		@@ -27,16 +27,16 @@ import (
 | 
				
			|||||||
// are separated so that errors from the first phase can be found
 | 
					// are separated so that errors from the first phase can be found
 | 
				
			||||||
// before committing to a concurrency allotment for the second.
 | 
					// before committing to a concurrency allotment for the second.
 | 
				
			||||||
type QueueSetFactory interface {
 | 
					type QueueSetFactory interface {
 | 
				
			||||||
	// QualifyQueuingConfig does the first phase of creating a QueueSet
 | 
						// BeginConstruction does the first phase of creating a QueueSet
 | 
				
			||||||
	QualifyQueuingConfig(QueuingConfig) (QueueSetCompleter, error)
 | 
						BeginConstruction(QueuingConfig) (QueueSetCompleter, error)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// QueueSetCompleter finishes the two-step process of creating or
 | 
					// QueueSetCompleter finishes the two-step process of creating or
 | 
				
			||||||
// reconfiguring a QueueSet
 | 
					// reconfiguring a QueueSet
 | 
				
			||||||
type QueueSetCompleter interface {
 | 
					type QueueSetCompleter interface {
 | 
				
			||||||
	// GetQueueSet returns a QueueSet configured by the given
 | 
						// Complete returns a QueueSet configured by the given
 | 
				
			||||||
	// dispatching configuration.
 | 
						// dispatching configuration.
 | 
				
			||||||
	GetQueueSet(DispatchingConfig) QueueSet
 | 
						Complete(DispatchingConfig) QueueSet
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// QueueSet is the abstraction for the queuing and dispatching
 | 
					// 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
 | 
					// .  Some day we may have connections between priority levels, but
 | 
				
			||||||
// today is not that day.
 | 
					// today is not that day.
 | 
				
			||||||
type QueueSet interface {
 | 
					type QueueSet interface {
 | 
				
			||||||
	// QualifyQueuingConfig starts the two-step process of updating
 | 
						// BeginConfigChange starts the two-step process of updating
 | 
				
			||||||
	// the configuration.  No change is made until GetQueueSet is
 | 
						// the configuration.  No change is made until Complete is
 | 
				
			||||||
	// called.  If `C := X.QualifyQueuingConfig(q)` then
 | 
						// called.  If `C := X.BeginConstruction(q)` then
 | 
				
			||||||
	// `C.GetQueueSet(d)` returns the same value `X`.  If the
 | 
						// `C.Complete(d)` returns the same value `X`.  If the
 | 
				
			||||||
	// QueuingConfig's DesiredNumQueues field is zero then the other
 | 
						// QueuingConfig's DesiredNumQueues field is zero then the other
 | 
				
			||||||
	// queuing-specific config parameters are not changed, so that the
 | 
						// queuing-specific config parameters are not changed, so that the
 | 
				
			||||||
	// queues continue draining as before.
 | 
						// queues continue draining as before.
 | 
				
			||||||
	QualifyQueuingConfig(QueuingConfig) (QueueSetCompleter, error)
 | 
						BeginConfigChange(QueuingConfig) (QueueSetCompleter, error)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// Quiesce controls whether the QueueSet is operating normally or
 | 
						// Quiesce controls whether the QueueSet is operating normally or
 | 
				
			||||||
	// is quiescing.  A quiescing QueueSet drains as normal but does
 | 
						// is quiescing.  A quiescing QueueSet drains as normal but does
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -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)
 | 
						dealer, err := checkConfig(qCfg)
 | 
				
			||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
		return nil, err
 | 
							return nil, err
 | 
				
			||||||
@@ -139,7 +139,7 @@ func checkConfig(qCfg fq.QueuingConfig) (*shufflesharding.Dealer, error) {
 | 
				
			|||||||
	return dealer, err
 | 
						return dealer, err
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (qsc *queueSetCompleter) GetQueueSet(dCfg fq.DispatchingConfig) fq.QueueSet {
 | 
					func (qsc *queueSetCompleter) Complete(dCfg fq.DispatchingConfig) fq.QueueSet {
 | 
				
			||||||
	qs := qsc.theSet
 | 
						qs := qsc.theSet
 | 
				
			||||||
	if qs == nil {
 | 
						if qs == nil {
 | 
				
			||||||
		qs = &queueSet{
 | 
							qs = &queueSet{
 | 
				
			||||||
@@ -164,7 +164,7 @@ func createQueues(n, baseIndex int) []*queue {
 | 
				
			|||||||
	return fqqueues
 | 
						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)
 | 
						dealer, err := checkConfig(qCfg)
 | 
				
			||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
		return nil, err
 | 
							return nil, err
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -141,11 +141,11 @@ func init() {
 | 
				
			|||||||
func TestNoRestraint(t *testing.T) {
 | 
					func TestNoRestraint(t *testing.T) {
 | 
				
			||||||
	now := time.Now()
 | 
						now := time.Now()
 | 
				
			||||||
	clk, counter := clock.NewFakeEventClock(now, 0, nil)
 | 
						clk, counter := clock.NewFakeEventClock(now, 0, nil)
 | 
				
			||||||
	nrc, err := test.NewNoRestraintFactory().QualifyQueuingConfig(fq.QueuingConfig{})
 | 
						nrc, err := test.NewNoRestraintFactory().BeginConstruction(fq.QueuingConfig{})
 | 
				
			||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
		t.Fatal(err)
 | 
							t.Fatal(err)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	nr := nrc.GetQueueSet(fq.DispatchingConfig{})
 | 
						nr := nrc.Complete(fq.DispatchingConfig{})
 | 
				
			||||||
	exerciseQueueSetUniformScenario(t, "NoRestraint", nr, []uniformClient{
 | 
						exerciseQueueSetUniformScenario(t, "NoRestraint", nr, []uniformClient{
 | 
				
			||||||
		{1001001001, 5, 10, time.Second, time.Second},
 | 
							{1001001001, 5, 10, time.Second, time.Second},
 | 
				
			||||||
		{2002002002, 2, 10, time.Second, time.Second / 2},
 | 
							{2002002002, 2, 10, time.Second, time.Second / 2},
 | 
				
			||||||
@@ -164,11 +164,11 @@ func TestUniformFlows(t *testing.T) {
 | 
				
			|||||||
		HandSize:         3,
 | 
							HandSize:         3,
 | 
				
			||||||
		RequestWaitLimit: 10 * time.Minute,
 | 
							RequestWaitLimit: 10 * time.Minute,
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	qsc, err := qsf.QualifyQueuingConfig(qCfg)
 | 
						qsc, err := qsf.BeginConstruction(qCfg)
 | 
				
			||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
		t.Fatal(err)
 | 
							t.Fatal(err)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	qs := qsc.GetQueueSet(fq.DispatchingConfig{ConcurrencyLimit: 4})
 | 
						qs := qsc.Complete(fq.DispatchingConfig{ConcurrencyLimit: 4})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	exerciseQueueSetUniformScenario(t, "UniformFlows", qs, []uniformClient{
 | 
						exerciseQueueSetUniformScenario(t, "UniformFlows", qs, []uniformClient{
 | 
				
			||||||
		{1001001001, 5, 10, time.Second, time.Second},
 | 
							{1001001001, 5, 10, time.Second, time.Second},
 | 
				
			||||||
@@ -188,11 +188,11 @@ func TestDifferentFlows(t *testing.T) {
 | 
				
			|||||||
		HandSize:         3,
 | 
							HandSize:         3,
 | 
				
			||||||
		RequestWaitLimit: 10 * time.Minute,
 | 
							RequestWaitLimit: 10 * time.Minute,
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	qsc, err := qsf.QualifyQueuingConfig(qCfg)
 | 
						qsc, err := qsf.BeginConstruction(qCfg)
 | 
				
			||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
		t.Fatal(err)
 | 
							t.Fatal(err)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	qs := qsc.GetQueueSet(fq.DispatchingConfig{ConcurrencyLimit: 4})
 | 
						qs := qsc.Complete(fq.DispatchingConfig{ConcurrencyLimit: 4})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	exerciseQueueSetUniformScenario(t, "DifferentFlows", qs, []uniformClient{
 | 
						exerciseQueueSetUniformScenario(t, "DifferentFlows", qs, []uniformClient{
 | 
				
			||||||
		{1001001001, 6, 10, time.Second, time.Second},
 | 
							{1001001001, 6, 10, time.Second, time.Second},
 | 
				
			||||||
@@ -209,11 +209,11 @@ func TestDifferentFlowsWithoutQueuing(t *testing.T) {
 | 
				
			|||||||
		Name:             "TestDifferentFlowsWithoutQueuing",
 | 
							Name:             "TestDifferentFlowsWithoutQueuing",
 | 
				
			||||||
		DesiredNumQueues: 0,
 | 
							DesiredNumQueues: 0,
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	qsc, err := qsf.QualifyQueuingConfig(qCfg)
 | 
						qsc, err := qsf.BeginConstruction(qCfg)
 | 
				
			||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
		t.Fatal(err)
 | 
							t.Fatal(err)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	qs := qsc.GetQueueSet(fq.DispatchingConfig{ConcurrencyLimit: 4})
 | 
						qs := qsc.Complete(fq.DispatchingConfig{ConcurrencyLimit: 4})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	exerciseQueueSetUniformScenario(t, "DifferentFlowsWithoutQueuing", qs, []uniformClient{
 | 
						exerciseQueueSetUniformScenario(t, "DifferentFlowsWithoutQueuing", qs, []uniformClient{
 | 
				
			||||||
		{1001001001, 6, 10, time.Second, 57 * time.Millisecond},
 | 
							{1001001001, 6, 10, time.Second, 57 * time.Millisecond},
 | 
				
			||||||
@@ -233,11 +233,11 @@ func TestTimeout(t *testing.T) {
 | 
				
			|||||||
		HandSize:         1,
 | 
							HandSize:         1,
 | 
				
			||||||
		RequestWaitLimit: 0,
 | 
							RequestWaitLimit: 0,
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	qsc, err := qsf.QualifyQueuingConfig(qCfg)
 | 
						qsc, err := qsf.BeginConstruction(qCfg)
 | 
				
			||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
		t.Fatal(err)
 | 
							t.Fatal(err)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	qs := qsc.GetQueueSet(fq.DispatchingConfig{ConcurrencyLimit: 1})
 | 
						qs := qsc.Complete(fq.DispatchingConfig{ConcurrencyLimit: 1})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	exerciseQueueSetUniformScenario(t, "Timeout", qs, []uniformClient{
 | 
						exerciseQueueSetUniformScenario(t, "Timeout", qs, []uniformClient{
 | 
				
			||||||
		{1001001001, 5, 100, time.Second, time.Second},
 | 
							{1001001001, 5, 100, time.Second, time.Second},
 | 
				
			||||||
@@ -255,11 +255,11 @@ func TestContextCancel(t *testing.T) {
 | 
				
			|||||||
		HandSize:         1,
 | 
							HandSize:         1,
 | 
				
			||||||
		RequestWaitLimit: 15 * time.Second,
 | 
							RequestWaitLimit: 15 * time.Second,
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	qsc, err := qsf.QualifyQueuingConfig(qCfg)
 | 
						qsc, err := qsf.BeginConstruction(qCfg)
 | 
				
			||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
		t.Fatal(err)
 | 
							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
 | 
						counter.Add(1) // account for the goroutine running this test
 | 
				
			||||||
	ctx1 := context.Background()
 | 
						ctx1 := context.Background()
 | 
				
			||||||
	another1, exec1, cleanup1 := qs.Wait(ctx1, 1, "test", "one")
 | 
						another1, exec1, cleanup1 := qs.Wait(ctx1, 1, "test", "one")
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -35,15 +35,15 @@ type noRestraintCompeter struct{}
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
type noRestraint 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
 | 
						return noRestraintCompeter{}, nil
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (noRestraintCompeter) GetQueueSet(dCfg fq.DispatchingConfig) fq.QueueSet {
 | 
					func (noRestraintCompeter) Complete(dCfg fq.DispatchingConfig) fq.QueueSet {
 | 
				
			||||||
	return noRestraint{}
 | 
						return noRestraint{}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (noRestraint) QualifyQueuingConfig(qCfg fq.QueuingConfig) (fq.QueueSetCompleter, error) {
 | 
					func (noRestraint) BeginConfigChange(qCfg fq.QueuingConfig) (fq.QueueSetCompleter, error) {
 | 
				
			||||||
	return noRestraintCompeter{}, nil
 | 
						return noRestraintCompeter{}, nil
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user