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
33e612e1
Commit
33e612e1
authored
Jul 22, 2016
by
Wojciech Tyczynski
Committed by
GitHub
Jul 22, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "cacher.go: embed storage.Interface into cacher"
parent
180e6719
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
48 additions
and
3 deletions
+48
-3
cacher.go
pkg/storage/cacher.go
+48
-3
No files found.
pkg/storage/cacher.go
View file @
33e612e1
...
...
@@ -136,7 +136,7 @@ type Cacher struct {
ready
*
ready
// Underlying storage.Interface.
Interface
storage
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
(),
Interface
:
config
.
Storage
,
storage
:
config
.
Storage
,
watchCache
:
watchCache
,
reflector
:
cache
.
NewReflector
(
listerWatcher
,
config
.
Type
,
watchCache
,
0
),
versioner
:
config
.
Versioner
,
...
...
@@ -244,6 +244,26 @@ 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
{
...
...
@@ -286,11 +306,26 @@ 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
.
Interfac
e
.
List
(
ctx
,
key
,
resourceVersion
,
filter
,
listObj
)
return
c
.
storag
e
.
List
(
ctx
,
key
,
resourceVersion
,
filter
,
listObj
)
}
// If resourceVersion is specified, serve it from cache.
...
...
@@ -336,6 +371,16 @@ 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