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
42a1deef
Commit
42a1deef
authored
Jul 21, 2016
by
k8s-merge-robot
Committed by
GitHub
Jul 21, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #26861 from xiang90/embed
Automatic merge from submit-queue cacher.go: embed storage.Interface into cacher Continuous effort to simplify cacher implementation.
parents
e3fa011d
44c0a119
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
48 deletions
+3
-48
cacher.go
pkg/storage/cacher.go
+3
-48
No files found.
pkg/storage/cacher.go
View file @
42a1deef
...
...
@@ -136,7 +136,7 @@ type Cacher struct {
ready
*
ready
// Underlying storage.Interface.
storage
Interface
Interface
// "sliding window" of recent changes of objects and the current state.
watchCache
*
watchCache
...
...
@@ -180,7 +180,7 @@ func NewCacherFromConfig(config CacherConfig) *Cacher {
cacher
:=
&
Cacher
{
ready
:
newReady
(),
storage
:
config
.
Storage
,
Interface
:
config
.
Storage
,
watchCache
:
watchCache
,
reflector
:
cache
.
NewReflector
(
listerWatcher
,
config
.
Type
,
watchCache
,
0
),
versioner
:
config
.
Versioner
,
...
...
@@ -244,26 +244,6 @@ func (c *Cacher) startCaching(stopChannel <-chan struct{}) {
}
// Implements storage.Interface.
func
(
c
*
Cacher
)
Backends
(
ctx
context
.
Context
)
[]
string
{
return
c
.
storage
.
Backends
(
ctx
)
}
// Implements storage.Interface.
func
(
c
*
Cacher
)
Versioner
()
Versioner
{
return
c
.
storage
.
Versioner
()
}
// Implements storage.Interface.
func
(
c
*
Cacher
)
Create
(
ctx
context
.
Context
,
key
string
,
obj
,
out
runtime
.
Object
,
ttl
uint64
)
error
{
return
c
.
storage
.
Create
(
ctx
,
key
,
obj
,
out
,
ttl
)
}
// Implements storage.Interface.
func
(
c
*
Cacher
)
Delete
(
ctx
context
.
Context
,
key
string
,
out
runtime
.
Object
,
preconditions
*
Preconditions
)
error
{
return
c
.
storage
.
Delete
(
ctx
,
key
,
out
,
preconditions
)
}
// Implements storage.Interface.
func
(
c
*
Cacher
)
Watch
(
ctx
context
.
Context
,
key
string
,
resourceVersion
string
,
filter
Filter
)
(
watch
.
Interface
,
error
)
{
watchRV
,
err
:=
ParseWatchResourceVersion
(
resourceVersion
)
if
err
!=
nil
{
...
...
@@ -306,26 +286,11 @@ func (c *Cacher) Watch(ctx context.Context, key string, resourceVersion string,
}
// Implements storage.Interface.
func
(
c
*
Cacher
)
WatchList
(
ctx
context
.
Context
,
key
string
,
resourceVersion
string
,
filter
Filter
)
(
watch
.
Interface
,
error
)
{
return
c
.
Watch
(
ctx
,
key
,
resourceVersion
,
filter
)
}
// Implements storage.Interface.
func
(
c
*
Cacher
)
Get
(
ctx
context
.
Context
,
key
string
,
objPtr
runtime
.
Object
,
ignoreNotFound
bool
)
error
{
return
c
.
storage
.
Get
(
ctx
,
key
,
objPtr
,
ignoreNotFound
)
}
// Implements storage.Interface.
func
(
c
*
Cacher
)
GetToList
(
ctx
context
.
Context
,
key
string
,
filter
Filter
,
listObj
runtime
.
Object
)
error
{
return
c
.
storage
.
GetToList
(
ctx
,
key
,
filter
,
listObj
)
}
// Implements storage.Interface.
func
(
c
*
Cacher
)
List
(
ctx
context
.
Context
,
key
string
,
resourceVersion
string
,
filter
Filter
,
listObj
runtime
.
Object
)
error
{
if
resourceVersion
==
""
{
// If resourceVersion is not specified, serve it from underlying
// storage (for backward compatibility).
return
c
.
storag
e
.
List
(
ctx
,
key
,
resourceVersion
,
filter
,
listObj
)
return
c
.
Interfac
e
.
List
(
ctx
,
key
,
resourceVersion
,
filter
,
listObj
)
}
// If resourceVersion is specified, serve it from cache.
...
...
@@ -371,16 +336,6 @@ func (c *Cacher) List(ctx context.Context, key string, resourceVersion string, f
return
nil
}
// Implements storage.Interface.
func
(
c
*
Cacher
)
GuaranteedUpdate
(
ctx
context
.
Context
,
key
string
,
ptrToType
runtime
.
Object
,
ignoreNotFound
bool
,
preconditions
*
Preconditions
,
tryUpdate
UpdateFunc
)
error
{
return
c
.
storage
.
GuaranteedUpdate
(
ctx
,
key
,
ptrToType
,
ignoreNotFound
,
preconditions
,
tryUpdate
)
}
// Implements storage.Interface.
func
(
c
*
Cacher
)
Codec
()
runtime
.
Codec
{
return
c
.
storage
.
Codec
()
}
func
(
c
*
Cacher
)
triggerValues
(
event
*
watchCacheEvent
)
([]
string
,
bool
)
{
// TODO: Currently we assume that in a given Cacher object, its <c.triggerFunc>
// is aware of exactly the same trigger (at most one). Thus calling:
...
...
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