Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
97cb1fa2
Commit
97cb1fa2
authored
Nov 11, 2014
by
Daniel Smith
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2290 from pmorie/rename
Rename client/cache Store.Contains to ContainedIDs
parents
9fb58029
e2be1564
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
11 additions
and
11 deletions
+11
-11
fifo.go
pkg/client/cache/fifo.go
+2
-2
poller.go
pkg/client/cache/poller.go
+1
-1
poller_test.go
pkg/client/cache/poller_test.go
+2
-2
store.go
pkg/client/cache/store.go
+3
-3
store_test.go
pkg/client/cache/store_test.go
+2
-2
factory.go
plugin/pkg/scheduler/factory/factory.go
+1
-1
No files found.
pkg/client/cache/fifo.go
View file @
97cb1fa2
...
@@ -72,10 +72,10 @@ func (f *FIFO) List() []interface{} {
...
@@ -72,10 +72,10 @@ func (f *FIFO) List() []interface{} {
return
list
return
list
}
}
// Contains returns a util.StringSet containing all IDs of stored the items.
// Contain
edID
s returns a util.StringSet containing all IDs of stored the items.
// This is a snapshot of a moment in time, and one should keep in mind that
// This is a snapshot of a moment in time, and one should keep in mind that
// other go routines can add or remove items after you call this.
// other go routines can add or remove items after you call this.
func
(
c
*
FIFO
)
Contains
()
util
.
StringSet
{
func
(
c
*
FIFO
)
Contain
edID
s
()
util
.
StringSet
{
c
.
lock
.
RLock
()
c
.
lock
.
RLock
()
defer
c
.
lock
.
RUnlock
()
defer
c
.
lock
.
RUnlock
()
set
:=
util
.
StringSet
{}
set
:=
util
.
StringSet
{}
...
...
pkg/client/cache/poller.go
View file @
97cb1fa2
...
@@ -68,7 +68,7 @@ func (p *Poller) Run() {
...
@@ -68,7 +68,7 @@ func (p *Poller) Run() {
}
}
func
(
p
*
Poller
)
sync
(
e
Enumerator
)
{
func
(
p
*
Poller
)
sync
(
e
Enumerator
)
{
current
:=
p
.
store
.
Contains
()
current
:=
p
.
store
.
Contain
edID
s
()
for
i
:=
0
;
i
<
e
.
Len
();
i
++
{
for
i
:=
0
;
i
<
e
.
Len
();
i
++
{
id
,
object
:=
e
.
Get
(
i
)
id
,
object
:=
e
.
Get
(
i
)
p
.
store
.
Update
(
id
,
object
)
p
.
store
.
Update
(
id
,
object
)
...
...
pkg/client/cache/poller_test.go
View file @
97cb1fa2
...
@@ -70,7 +70,7 @@ func TestPoller_sync(t *testing.T) {
...
@@ -70,7 +70,7 @@ func TestPoller_sync(t *testing.T) {
for
line
,
pairs
:=
range
item
.
steps
{
for
line
,
pairs
:=
range
item
.
steps
{
p
.
sync
(
testEnumerator
(
pairs
))
p
.
sync
(
testEnumerator
(
pairs
))
ids
:=
s
.
Contains
()
ids
:=
s
.
Contain
edID
s
()
for
_
,
pair
:=
range
pairs
{
for
_
,
pair
:=
range
pairs
{
if
!
ids
.
Has
(
pair
.
id
)
{
if
!
ids
.
Has
(
pair
.
id
)
{
t
.
Errorf
(
"%v, %v: expected to find entry for %v, but did not."
,
testCase
,
line
,
pair
.
id
)
t
.
Errorf
(
"%v, %v: expected to find entry for %v, but did not."
,
testCase
,
line
,
pair
.
id
)
...
@@ -113,7 +113,7 @@ func TestPoller_Run(t *testing.T) {
...
@@ -113,7 +113,7 @@ func TestPoller_Run(t *testing.T) {
<-
done
<-
done
// We never added anything, verify that.
// We never added anything, verify that.
if
e
,
a
:=
0
,
len
(
s
.
Contains
());
e
!=
a
{
if
e
,
a
:=
0
,
len
(
s
.
Contain
edID
s
());
e
!=
a
{
t
.
Errorf
(
"expected %v, got %v"
,
e
,
a
)
t
.
Errorf
(
"expected %v, got %v"
,
e
,
a
)
}
}
}
}
pkg/client/cache/store.go
View file @
97cb1fa2
...
@@ -31,7 +31,7 @@ type Store interface {
...
@@ -31,7 +31,7 @@ type Store interface {
Update
(
id
string
,
obj
interface
{})
Update
(
id
string
,
obj
interface
{})
Delete
(
id
string
)
Delete
(
id
string
)
List
()
[]
interface
{}
List
()
[]
interface
{}
Contains
()
util
.
StringSet
Contain
edID
s
()
util
.
StringSet
Get
(
id
string
)
(
item
interface
{},
exists
bool
)
Get
(
id
string
)
(
item
interface
{},
exists
bool
)
// Replace will delete the contents of the store, using instead the
// Replace will delete the contents of the store, using instead the
...
@@ -78,10 +78,10 @@ func (c *cache) List() []interface{} {
...
@@ -78,10 +78,10 @@ func (c *cache) List() []interface{} {
return
list
return
list
}
}
// Contains returns a util.StringSet containing all IDs of stored the items.
// Contain
edID
s returns a util.StringSet containing all IDs of stored the items.
// This is a snapshot of a moment in time, and one should keep in mind that
// This is a snapshot of a moment in time, and one should keep in mind that
// other go routines can add or remove items after you call this.
// other go routines can add or remove items after you call this.
func
(
c
*
cache
)
Contains
()
util
.
StringSet
{
func
(
c
*
cache
)
Contain
edID
s
()
util
.
StringSet
{
c
.
lock
.
RLock
()
c
.
lock
.
RLock
()
defer
c
.
lock
.
RUnlock
()
defer
c
.
lock
.
RUnlock
()
set
:=
util
.
StringSet
{}
set
:=
util
.
StringSet
{}
...
...
pkg/client/cache/store_test.go
View file @
97cb1fa2
...
@@ -62,7 +62,7 @@ func doTestStore(t *testing.T, store Store) {
...
@@ -62,7 +62,7 @@ func doTestStore(t *testing.T, store Store) {
}
}
// Check that ID list is correct.
// Check that ID list is correct.
ids
:=
store
.
Contains
()
ids
:=
store
.
Contain
edID
s
()
if
!
ids
.
HasAll
(
"a"
,
"c"
,
"e"
)
{
if
!
ids
.
HasAll
(
"a"
,
"c"
,
"e"
)
{
t
.
Errorf
(
"missing items"
)
t
.
Errorf
(
"missing items"
)
}
}
...
@@ -90,7 +90,7 @@ func doTestStore(t *testing.T, store Store) {
...
@@ -90,7 +90,7 @@ func doTestStore(t *testing.T, store Store) {
}
}
// Check that ID list is correct.
// Check that ID list is correct.
ids
:=
store
.
Contains
()
ids
:=
store
.
Contain
edID
s
()
if
!
ids
.
HasAll
(
"foo"
,
"bar"
)
{
if
!
ids
.
HasAll
(
"foo"
,
"bar"
)
{
t
.
Errorf
(
"missing items"
)
t
.
Errorf
(
"missing items"
)
}
}
...
...
plugin/pkg/scheduler/factory/factory.go
View file @
97cb1fa2
...
@@ -95,7 +95,7 @@ func (factory *ConfigFactory) Create() *scheduler.Config {
...
@@ -95,7 +95,7 @@ func (factory *ConfigFactory) Create() *scheduler.Config {
glog
.
V
(
2
)
.
Infof
(
"About to try and schedule pod %v
\n
"
+
glog
.
V
(
2
)
.
Infof
(
"About to try and schedule pod %v
\n
"
+
"
\t
known minions: %v
\n
"
+
"
\t
known minions: %v
\n
"
+
"
\t
known scheduled pods: %v
\n
"
,
"
\t
known scheduled pods: %v
\n
"
,
pod
.
Name
,
minionCache
.
Contain
s
(),
podCache
.
Contain
s
())
pod
.
Name
,
minionCache
.
Contain
edIDs
(),
podCache
.
ContainedID
s
())
return
pod
return
pod
},
},
Error
:
factory
.
makeDefaultErrorFunc
(
&
podBackoff
,
podQueue
),
Error
:
factory
.
makeDefaultErrorFunc
(
&
podBackoff
,
podQueue
),
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment