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
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
Kirill Smelkov
wendelin.core
Commits
5db40e09
Commit
5db40e09
authored
Apr 22, 2019
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
c4532d1a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
65 additions
and
2 deletions
+65
-2
wcfs/δftail.go
wcfs/δftail.go
+65
-2
No files found.
wcfs/δftail.go
View file @
5db40e09
...
...
@@ -70,6 +70,10 @@ type ΔFtail struct {
// data with δF changes. Actual for part of tracked set that was taken
// into account.
vδF
[]
ΔF
// tracked ZBlk that are not yet taken into account in current vδF.
// grows on new track requests; flushes on queries and update.
trackNew
map
[
*
BigFile
]
map
[
zodb
.
Oid
]
*
zblkInΔFtail
// {} file -> {} oid -> zblk
}
// ΔF represents a change in files space.
...
...
@@ -105,8 +109,9 @@ func (z *zblkInΔFtail) inΔFtail() *zblkInΔFtail { return z }
// Initial coverage of created ΔFtail is (at₀, at₀].
func
NewΔFtail
(
at0
zodb
.
Tid
)
*
ΔFtail
{
return
&
ΔFtail
{
δBtail
:
NewΔBtail
(
at0
),
fileIdx
:
make
(
map
[
*
btree
.
LOBTree
]
SetBigFile
),
δBtail
:
NewΔBtail
(
at0
),
fileIdx
:
make
(
map
[
*
btree
.
LOBTree
]
SetBigFile
),
trackNew
:
make
(
map
[
*
BigFile
]
map
[
zodb
.
Oid
]
*
zblkInΔFtail
),
}
}
...
...
@@ -149,6 +154,17 @@ func (δFtail *ΔFtail) Track(file *BigFile, blk int64, path []btree.LONode, zbl
}
blocks
.
Add
(
blk
)
z
.
mu
.
Unlock
()
// XXX locking
if
!
ok
{
// zblk was not associated with this file
zt
:=
δFtail
.
trackNew
[
file
]
if
zt
==
nil
{
zt
=
make
(
map
[
zodb
.
Oid
]
*
zblkInΔFtail
,
1
)
δFtail
.
trackNew
[
file
]
=
zt
}
zt
[
zblk
.
POid
()]
=
z
}
}
// XXX mark something dirty so that LastBlkRev and Slice* know what to rebuild?
...
...
@@ -246,6 +262,50 @@ func (δFtail *ΔFtail) Update(δZ *zodb.EventCommit, zhead *ZConn) ΔF {
return
δF
}
// update processes new track requests and updates vδF.
//
// If file != nil only track requests related to file are processed.
// Otherwise all track requests are processed.
func
(
δFtail
*
ΔFtail
)
update
(
file
*
BigFile
)
{
if
file
==
nil
{
panic
(
"TODO"
)
}
// let's see if we need to rebuild .vδF due to not-yet processed track requests
// XXX locking
// XXX dumb
zt
,
dirty
:=
δFtail
.
trackNew
[
file
]
if
!
dirty
{
return
}
delete
(
δFtail
.
trackNew
,
file
)
// XXX unlock here
for
i
,
δZ
:=
range
δFtail
.
δBtail
.
δZtail
.
Data
()
{
δF
:=
δFtail
.
vδF
[
i
]
// XXX assert δF.Rev == δZ.Rev
for
_
,
oid
:=
range
δZ
.
Changev
{
z
,
ok
:=
zt
[
oid
]
if
!
ok
{
continue
}
// XXX locking
// XXX -> func δF.δfile(file) ?
δfile
,
ok
:=
δF
.
ByFile
[
file
]
if
!
ok
{
δfile
=
&
ΔFile
{
Rev
:
δF
.
Rev
,
Blocks
:
make
(
SetI64
)}
δF
.
ByFile
[
file
]
=
δfile
}
δfile
.
Blocks
.
Update
(
z
.
infile
[
file
])
}
}
}
// ForgetPast discards all δFtail entries with rev ≤ revCut.
func
(
δFtail
*
ΔFtail
)
ForgetPast
(
revCut
zodb
.
Tid
)
{
panic
(
"TODO"
)
...
...
@@ -270,6 +330,9 @@ func (δFtail *ΔFtail) SliceByRev(lo, hi zodb.Tid) /*readonly*/ []ΔF {
func
(
δFtail
*
ΔFtail
)
SliceByFileRev
(
file
*
BigFile
,
lo
,
hi
zodb
.
Tid
)
/*readonly*/
[]
*
ΔFile
{
δassertSlice
(
δFtail
,
lo
,
hi
)
// XXX locking?
δFtail
.
update
(
file
)
// find vδF range corresponding to (lo, hi]
// XXX linear scan
vδF
:=
δFtail
.
vδF
...
...
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