Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
neo
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
Kirill Smelkov
neo
Commits
ddbdcbc3
Commit
ddbdcbc3
authored
Mar 12, 2019
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
4cc99c49
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
8 deletions
+9
-8
go/zodb/connection.go
go/zodb/connection.go
+8
-8
go/zodb/persistent_test.go
go/zodb/persistent_test.go
+1
-0
No files found.
go/zodb/connection.go
View file @
ddbdcbc3
...
@@ -235,20 +235,20 @@ func (cache *LiveCache) Get(oid Oid) IPersistent {
...
@@ -235,20 +235,20 @@ func (cache *LiveCache) Get(oid Oid) IPersistent {
return
obj
return
obj
}
}
// set sets objects corresponding to oid.
// setNew sets objects corresponding to oid.
// XXX -> setNew?
//
func
(
cache
*
LiveCache
)
set
(
oid
Oid
,
obj
IPersistent
)
{
// The cache must not have previous entry for oid before setNew is called.
func
(
cache
*
LiveCache
)
setNew
(
oid
Oid
,
obj
IPersistent
)
{
var
cp
PCachePolicy
var
cp
PCachePolicy
if
cc
:=
cache
.
control
;
cc
!=
nil
{
if
cc
:=
cache
.
control
;
cc
!=
nil
{
cp
=
cache
.
control
.
PCacheClassify
(
obj
)
cp
=
cache
.
control
.
PCacheClassify
(
obj
)
}
}
// XXX remember cp in obj .pcachePolicy?
// XXX del .objtab[oid] ?
// XXX del .pinned[oid] ?
if
cp
&
PCachePinObject
!=
0
{
if
cp
&
PCachePinObject
!=
0
{
cache
.
pinned
[
oid
]
=
obj
cache
.
pinned
[
oid
]
=
obj
// XXX assert .objtab[oid] == nil ?
}
else
{
}
else
{
cache
.
objtab
[
oid
]
=
weak
.
NewRef
(
obj
)
cache
.
objtab
[
oid
]
=
weak
.
NewRef
(
obj
)
// XXX asseer .pinned[oid] == nil ?
}
}
}
}
...
@@ -278,7 +278,7 @@ func (cache *LiveCache) SetControl(c LiveCacheControl) {
...
@@ -278,7 +278,7 @@ func (cache *LiveCache) SetControl(c LiveCacheControl) {
cache
.
objtab
=
make
(
map
[
Oid
]
*
weak
.
Ref
)
cache
.
objtab
=
make
(
map
[
Oid
]
*
weak
.
Ref
)
cache
.
pinned
=
make
(
map
[
Oid
]
IPersistent
)
cache
.
pinned
=
make
(
map
[
Oid
]
IPersistent
)
c2
.
forEach
(
func
(
obj
IPersistent
)
{
c2
.
forEach
(
func
(
obj
IPersistent
)
{
cache
.
set
(
obj
.
POid
(),
obj
)
cache
.
set
New
(
obj
.
POid
(),
obj
)
})
})
}
}
...
@@ -292,7 +292,7 @@ func (conn *Connection) get(class string, oid Oid) (IPersistent, error) {
...
@@ -292,7 +292,7 @@ func (conn *Connection) get(class string, oid Oid) (IPersistent, error) {
obj
:=
conn
.
cache
.
Get
(
oid
)
obj
:=
conn
.
cache
.
Get
(
oid
)
if
obj
==
nil
{
if
obj
==
nil
{
obj
=
newGhost
(
class
,
oid
,
conn
)
obj
=
newGhost
(
class
,
oid
,
conn
)
conn
.
cache
.
set
(
oid
,
obj
)
conn
.
cache
.
set
New
(
oid
,
obj
)
checkClass
=
false
checkClass
=
false
}
}
conn
.
cache
.
Unlock
()
conn
.
cache
.
Unlock
()
...
...
go/zodb/persistent_test.go
View file @
ddbdcbc3
...
@@ -741,6 +741,7 @@ func TestLiveCache(t0 *testing.T) {
...
@@ -741,6 +741,7 @@ func TestLiveCache(t0 *testing.T) {
103
:
PCachePinObject
|
PCacheDropState
,
103
:
PCachePinObject
|
PCacheDropState
,
// objDD - drop object and state
// objDD - drop object and state
104
:
PCacheDropObject
|
PCacheDropState
,
104
:
PCacheDropObject
|
PCacheDropState
,
// XXX objDK ?
}}
}}
t
:=
tdb
.
Open
(
&
ConnOptions
{})
t
:=
tdb
.
Open
(
&
ConnOptions
{})
...
...
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