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
2a8b0802
Commit
2a8b0802
authored
Jul 12, 2021
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
16571605
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
43 additions
and
42 deletions
+43
-42
wcfs/internal/zdata/δftail.go
wcfs/internal/zdata/δftail.go
+4
-3
wcfs/internal/zdata/δftail_test.go
wcfs/internal/zdata/δftail_test.go
+39
-39
No files found.
wcfs/internal/zdata/δftail.go
View file @
2a8b0802
...
...
@@ -330,9 +330,10 @@ func (δFtail *ΔFtail) Update(δZ *zodb.EventCommit) (_ ΔF, err error) {
δfile
.
Blocks
=
nil
δfile
.
Size
=
false
// XXX + rebuild XXX not here - in track(new file)
_
=
δ
//fmt.Printf("δZBigFile: %v\n", δ)
//return ΔF{}, fmt.Errorf("ZBigFile<%s> changed @%s", oid, δZ.Tid)
}
// fmt.Printf("-> δF: %v\n", δF)
...
...
@@ -538,7 +539,7 @@ func (δFtail *ΔFtail) LastBlkRev(ctx context.Context, zf *ZBigFile, blk int64,
// ----------------------------------------
// zfilediff
... XXX
// zfilediff
returns direct difference for ZBigFile<foid> old..new .
type
_ΔZBigFile
struct
{
blksizeOld
,
blksizeNew
int64
blktabOld
,
blktabNew
zodb
.
Oid
...
...
@@ -565,7 +566,7 @@ func zfilediff(db *zodb.DB, foid zodb.Oid, old, new zodb.Tid) (δ *_ΔZBigFile,
return
diffF
(
ctx
,
a
,
b
)
}
// diffF
compute
s direct difference in between two ZBigFile objects.
// diffF
return
s direct difference in between two ZBigFile objects.
func
diffF
(
ctx
context
.
Context
,
a
,
b
*
ZBigFile
)
(
δ
*
_ΔZBigFile
,
err
error
)
{
defer
xerr
.
Contextf
(
&
err
,
"diffF %s %s"
,
xzodb
.
XidOf
(
a
),
xzodb
.
XidOf
(
b
))
...
...
wcfs/internal/zdata/δftail_test.go
View file @
2a8b0802
...
...
@@ -256,49 +256,49 @@ func testΔFtail(t_ *testing.T, testq chan ΔFTestEntry) {
if
epoch
{
blkTab
=
map
[
int64
]
string
{}
Zinblk
=
map
[
string
]
setI64
{}
}
// XXX else?
// rebuild blkTab/Zinblk
for
blk
,
zblk
:=
range
test
.
δblkTab
{
zprev
,
ok
:=
blkTab
[
blk
]
if
ok
{
delete
(
Zinblk
[
zprev
],
blk
)
}
else
{
zprev
=
ø
}
δblk
=
nil
}
else
{
// rebuild blkTab/Zinblk
for
blk
,
zblk
:=
range
test
.
δblkTab
{
zprev
,
ok
:=
blkTab
[
blk
]
if
ok
{
delete
(
Zinblk
[
zprev
],
blk
)
}
else
{
zprev
=
ø
}
if
zblk
!=
ø
{
blkTab
[
blk
]
=
zblk
inblk
,
ok
:=
Zinblk
[
zblk
]
if
!
ok
{
inblk
=
setI64
{}
Zinblk
[
zblk
]
=
inblk
if
zblk
!=
ø
{
blkTab
[
blk
]
=
zblk
inblk
,
ok
:=
Zinblk
[
zblk
]
if
!
ok
{
inblk
=
setI64
{}
Zinblk
[
zblk
]
=
inblk
}
inblk
.
Add
(
blk
)
}
else
{
delete
(
blkTab
,
blk
)
}
inblk
.
Add
(
blk
)
}
else
{
delete
(
blkTab
,
blk
)
}
// update δblk due to change in blkTab
if
zblk
!=
zprev
{
δblk
.
Add
(
blk
)
δtree
=
true
// update δblk due to change in blkTab
if
zblk
!=
zprev
{
δblk
.
Add
(
blk
)
δtree
=
true
}
}
}
// rebuild dataTab
for
zblk
:=
range
test
.
δdataTab
{
data
,
ok
:=
dataTab
[
zblk
]
// e.g. a -> a2
if
!
ok
{
t
.
Fatalf
(
"BUG: blk %s not in dataTab
\n
dataTab: %v"
,
zblk
,
dataTab
)
}
data
=
fmt
.
Sprintf
(
"%s%d"
,
data
[
:
1
],
i
)
// e.g. a4
dataTab
[
zblk
]
=
data
// rebuild dataTab
for
zblk
:=
range
test
.
δdataTab
{
data
,
ok
:=
dataTab
[
zblk
]
// e.g. a -> a2
if
!
ok
{
t
.
Fatalf
(
"BUG: blk %s not in dataTab
\n
dataTab: %v"
,
zblk
,
dataTab
)
}
data
=
fmt
.
Sprintf
(
"%s%d"
,
data
[
:
1
],
i
)
// e.g. a4
dataTab
[
zblk
]
=
data
// update δblk due to change in ZBlk data
for
blk
:=
range
Zinblk
[
zblk
]
{
δblk
.
Add
(
blk
)
// update δblk due to change in ZBlk data
for
blk
:=
range
Zinblk
[
zblk
]
{
δblk
.
Add
(
blk
)
}
}
}
...
...
@@ -337,10 +337,10 @@ func testΔFtail(t_ *testing.T, testq chan ΔFTestEntry) {
err
=
zconn
.
Resync
(
ctx
,
commit
.
At
);
X
(
err
)
var
δfok
*
ΔFile
if
len
(
δblk
)
!=
0
{
if
epoch
||
len
(
δblk
)
!=
0
{
δfok
=
&
ΔFile
{
Rev
:
commit
.
At
,
Epoch
:
epoch
,
// XXX epoch -> blocks/size = nil ?
Epoch
:
epoch
,
Blocks
:
δblk
,
Size
:
δtree
,
// not strictly ok, but matches current ΔFtail code
}
...
...
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