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
d348e51f
Commit
d348e51f
authored
Jun 01, 2020
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
97acef76
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
10 deletions
+11
-10
wcfs/δbtail.go
wcfs/δbtail.go
+6
-5
wcfs/δftail.go
wcfs/δftail.go
+5
-5
No files found.
wcfs/δbtail.go
View file @
d348e51f
...
@@ -40,6 +40,7 @@ type Key = int64
...
@@ -40,6 +40,7 @@ type Key = int64
type
Value
=
zodb
.
Oid
// assumes key points to IPersistent
type
Value
=
zodb
.
Oid
// assumes key points to IPersistent
// deletion is represented as InvalidOid
// deletion is represented as InvalidOid
type
SetKey
=
SetI64
type
SetKey
=
SetI64
// XXX SetOID
// ΔBtail represents tail of revisional changes to BTrees.
// ΔBtail represents tail of revisional changes to BTrees.
...
@@ -97,7 +98,7 @@ type ΔBtail struct {
...
@@ -97,7 +98,7 @@ type ΔBtail struct {
db
*
zodb
.
DB
// to open connections to load new/old tree|buckets
db
*
zodb
.
DB
// to open connections to load new/old tree|buckets
// tracked index: BTree|Bucket -> top tree element.
// tracked index: BTree|Bucket -> top tree element.
trackIdx
map
[
zodb
.
Oid
]
SetTree
// oid -> {} roots
XXX root -> oid?
trackIdx
map
[
zodb
.
Oid
]
SetTree
// oid -> {} roots
XXX root -> oid
// tracked objects that are not yet taken into account in current δBtail
// tracked objects that are not yet taken into account in current δBtail
trackNew
map
[
zodb
.
Oid
]
struct
{}
// XXX SetOid
trackNew
map
[
zodb
.
Oid
]
struct
{}
// XXX SetOid
...
@@ -106,7 +107,7 @@ type ΔBtail struct {
...
@@ -106,7 +107,7 @@ type ΔBtail struct {
// ΔB represents a change in BTrees space.
// ΔB represents a change in BTrees space.
type
ΔB
struct
{
type
ΔB
struct
{
Rev
zodb
.
Tid
Rev
zodb
.
Tid
ByRoot
map
[
*
Tree
]
map
[
Key
]
Value
// {} root -> {}(key, value)
ByRoot
map
[
zodb
.
Oid
]
map
[
Key
]
Value
// {} root -> {}(key, value)
}
}
// ΔRoots describes which BTrees were change in one revision.
// ΔRoots describes which BTrees were change in one revision.
...
@@ -211,18 +212,18 @@ func (δBtail *ΔBtail) Update(δZ *zodb.EventCommit) ΔB {
...
@@ -211,18 +212,18 @@ func (δBtail *ΔBtail) Update(δZ *zodb.EventCommit) ΔB {
δBtail
.
δZtail
.
Append
(
δZ
.
Tid
,
δZ
.
Changev
)
δBtail
.
δZtail
.
Append
(
δZ
.
Tid
,
δZ
.
Changev
)
// {} root -> []oid changed under that root in tracked set
// {} root -> []oid changed under that root in tracked set
δZByRoot
:=
map
[
*
Tree
][]
zodb
.
Oid
{}
// XXX -> map[*Tree]SetOid ?
δZByRoot
:=
map
[
zodb
.
Oid
][]
zodb
.
Oid
{}
// XXX -> map[*Tree]SetOid ?
for
_
,
oid
:=
range
δZ
.
Changev
{
for
_
,
oid
:=
range
δZ
.
Changev
{
roots
,
ok
:=
δBtail
.
trackIdx
[
oid
]
roots
,
ok
:=
δBtail
.
trackIdx
[
oid
]
if
!
ok
{
if
!
ok
{
continue
continue
}
}
for
root
:=
range
roots
{
for
root
:=
range
roots
{
δZByRoot
[
root
]
=
append
(
δZByRoot
[
root
],
oid
)
δZByRoot
[
root
.
POid
()]
=
append
(
δZByRoot
[
root
.
POid
()
],
oid
)
}
}
}
}
δB
:=
ΔB
{
Rev
:
δZ
.
Tid
,
ByRoot
:
make
(
map
[
*
Tree
]
map
[
Key
]
Value
)}
δB
:=
ΔB
{
Rev
:
δZ
.
Tid
,
ByRoot
:
make
(
map
[
zodb
.
Oid
]
map
[
Key
]
Value
)}
for
root
:=
range
δZByRoot
{
for
root
:=
range
δZByRoot
{
δt
,
ok
:=
δB
.
ByRoot
[
root
]
δt
,
ok
:=
δB
.
ByRoot
[
root
]
...
...
wcfs/δftail.go
View file @
d348e51f
...
@@ -68,7 +68,7 @@ import (
...
@@ -68,7 +68,7 @@ import (
type
ΔFtail
struct
{
type
ΔFtail
struct
{
// ΔFtail merges btree.ΔTail with history of ZBlk
// ΔFtail merges btree.ΔTail with history of ZBlk
δBtail
*
ΔBtail
δBtail
*
ΔBtail
fileIdx
map
[
*
btree
.
LOBTree
]
SetBigFile
// root -> {} BigFile XXX root -> oid?
XXX as of @head?
fileIdx
map
[
zodb
.
Oid
]
SetBigFile
// tree-root -> {} BigFile
XXX as of @head?
// data with δF changes. Actual for part of tracked set that was taken
// data with δF changes. Actual for part of tracked set that was taken
// into account.
// into account.
...
@@ -113,7 +113,7 @@ func (z *zblkInΔFtail) inΔFtail() *zblkInΔFtail { return z }
...
@@ -113,7 +113,7 @@ func (z *zblkInΔFtail) inΔFtail() *zblkInΔFtail { return z }
func
NewΔFtail
(
at0
zodb
.
Tid
)
*
ΔFtail
{
func
NewΔFtail
(
at0
zodb
.
Tid
)
*
ΔFtail
{
return
&
ΔFtail
{
return
&
ΔFtail
{
δBtail
:
NewΔBtail
(
at0
),
δBtail
:
NewΔBtail
(
at0
),
fileIdx
:
make
(
map
[
*
btree
.
LOBTree
]
SetBigFile
),
fileIdx
:
make
(
map
[
zodb
.
Oid
]
SetBigFile
),
trackNew
:
make
(
map
[
*
BigFile
]
map
[
zodb
.
Oid
]
*
zblkInΔFtail
),
trackNew
:
make
(
map
[
*
BigFile
]
map
[
zodb
.
Oid
]
*
zblkInΔFtail
),
}
}
}
}
...
@@ -136,10 +136,10 @@ func (δFtail *ΔFtail) Tail() zodb.Tid { return δFtail.δBtail.Tail() }
...
@@ -136,10 +136,10 @@ func (δFtail *ΔFtail) Tail() zodb.Tid { return δFtail.δBtail.Tail() }
func
(
δFtail
*
ΔFtail
)
Track
(
file
*
BigFile
,
blk
int64
,
path
[]
btree
.
LONode
,
zblk
zBlk
)
{
func
(
δFtail
*
ΔFtail
)
Track
(
file
*
BigFile
,
blk
int64
,
path
[]
btree
.
LONode
,
zblk
zBlk
)
{
δFtail
.
δBtail
.
Track
(
path
)
δFtail
.
δBtail
.
Track
(
path
)
root
:=
path
[
0
]
.
(
*
btree
.
LOBTree
)
root
:=
path
[
0
]
.
(
*
btree
.
LOBTree
)
files
,
ok
:=
δFtail
.
fileIdx
[
root
]
files
,
ok
:=
δFtail
.
fileIdx
[
root
.
POid
()
]
if
!
ok
{
if
!
ok
{
files
=
SetBigFile
{}
files
=
SetBigFile
{}
δFtail
.
fileIdx
[
root
]
=
files
δFtail
.
fileIdx
[
root
.
POid
()
]
=
files
}
}
files
.
Add
(
file
)
files
.
Add
(
file
)
...
@@ -200,7 +200,7 @@ func (δFtail *ΔFtail) Update(δZ *zodb.EventCommit, zhead *ZConn) ΔF {
...
@@ -200,7 +200,7 @@ func (δFtail *ΔFtail) Update(δZ *zodb.EventCommit, zhead *ZConn) ΔF {
for
root
,
δt
:=
range
δB
.
ByRoot
{
for
root
,
δt
:=
range
δB
.
ByRoot
{
files
:=
δFtail
.
fileIdx
[
root
]
files
:=
δFtail
.
fileIdx
[
root
]
if
len
(
files
)
==
0
{
if
len
(
files
)
==
0
{
panicf
(
"ΔFtail: root<%s> -> ø file"
,
root
.
POid
()
)
panicf
(
"ΔFtail: root<%s> -> ø file"
,
root
)
}
}
for
file
:=
range
files
{
for
file
:=
range
files
{
δfile
,
ok
:=
δF
.
ByFile
[
file
]
δfile
,
ok
:=
δF
.
ByFile
[
file
]
...
...
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