Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
W
wendelin.core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Joshua
wendelin.core
Commits
cb6b33a9
Commit
cb6b33a9
authored
Dec 25, 2018
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
4495707b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
10 deletions
+25
-10
wcfs/wcfs.go
wcfs/wcfs.go
+7
-5
wcfs/zblk.go
wcfs/zblk.go
+18
-5
No files found.
wcfs/wcfs.go
View file @
cb6b33a9
...
...
@@ -546,8 +546,7 @@ func (r *Root) zhandle1(zevent zodb.WatchEvent) {
defer
r
.
head
.
zconnMu
.
Unlock
()
zhead
:=
r
.
head
.
zconn
//toinvalidate := map[*ZBigFile]SetI64{} // {} zfile -> set(#blk)
toinvalidate
:=
map
[
*
BigFile
]
SetI64
{}
// {} zfile -> set(#blk)
toinvalidate
:=
map
[
*
BigFile
]
SetI64
{}
// {} file -> set(#blk)
// zevent = (tid^, []oid)
for
_
,
oid
:=
range
zevent
.
Changev
{
...
...
@@ -567,14 +566,17 @@ func (r *Root) zhandle1(zevent zodb.WatchEvent) {
// XXX -> δBTree
case
zBlk
:
// ZBlk*
// XXX locking ?
for
zfile
,
objWhere
:=
range
obj
.
inzfile
{
// blkBoundTo locking: no other bindZFile are running,
// since we write-locked head.zconnMu and bindZFile is
// run when loading objects - thus when head.zconnMu is
// read-locked.
for
zfile
,
objBlk
:=
range
obj
.
blkBoundTo
()
{
blkmap
,
ok
:=
toinvalidate
[
zfile
]
if
!
ok
{
blkmap
=
SetI64
{}
toinvalidate
[
zfile
]
=
blkmap
}
blkmap
.
Update
(
obj
Where
)
blkmap
.
Update
(
obj
Blk
)
}
case
*
ZBigFile
:
...
...
wcfs/zblk.go
View file @
cb6b33a9
...
...
@@ -69,16 +69,24 @@ type zBlk interface {
// A ZBlk may be bound to several blocks inside one file, and to
// several files.
//
//
XXX t
he information is preserved even when ZBlk comes to ghost
//
T
he information is preserved even when ZBlk comes to ghost
// state, but is lost if ZBlk is garbage collected.
//
// bindZFile is safe for concurrent access.
// it is safe to call multiple bindZFile simultaneously.
// it is not safe to call bindZFile and boundTo simultaneously.
//
// XXX link to overview.
bindZFile
(
zfile
*
ZBigFile
,
blk
int64
)
// XXX unbindZFile
// XXX zfile -> bind map for it
// blkBoundTo returns ZBlk association with zfile(s)/#blk(s).
//
// The association returned is that was previously set by bindZFile.
//
// blkBoundTo must not be called simultaneously wrt bindZFile.
blkBoundTo
()
map
[
*
ZBigFile
]
SetI64
}
// module of Wendelin ZODB py objects
...
...
@@ -91,14 +99,14 @@ const zwendelin = "wendelin.bigfile.file_zodb"
// The data stored by zBlkBase is transient - it is _not_ included into
// persistent state.
type
zBlkBase
struct
{
mu
sync
.
Mutex
bindMu
sync
.
Mutex
// used only for binding to support multiple loaders
inzfile
map
[
*
ZBigFile
]
SetI64
// {} zfile -> set(#blk)
}
// bindZFile implements zBlk.
func
(
zb
*
zBlkBase
)
bindZFile
(
zfile
*
ZBigFile
,
blk
int64
)
{
zb
.
m
u
.
Lock
()
defer
zb
.
m
u
.
Unlock
()
zb
.
bindM
u
.
Lock
()
defer
zb
.
bindM
u
.
Unlock
()
blkmap
,
ok
:=
zb
.
inzfile
[
zfile
]
if
!
ok
{
...
...
@@ -111,6 +119,11 @@ func (zb *zBlkBase) bindZFile(zfile *ZBigFile, blk int64) {
blkmap
.
Add
(
blk
)
}
// blkBoundTo implementss zBlk.
func
(
zb
*
zBlkBase
)
blkBoundTo
()
map
[
*
ZBigFile
]
SetI64
{
return
zb
.
inzfile
}
// ---- ZBlk0 ----
// ZBlk0 mimics ZBlk0 from python.
...
...
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