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) {
...
@@ -330,9 +330,10 @@ func (δFtail *ΔFtail) Update(δZ *zodb.EventCommit) (_ ΔF, err error) {
δfile
.
Blocks
=
nil
δfile
.
Blocks
=
nil
δfile
.
Size
=
false
δfile
.
Size
=
false
// XXX + rebuild XXX not here - in track(new file)
_
=
δ
_
=
δ
//fmt.Printf("δZBigFile: %v\n", δ)
//fmt.Printf("δZBigFile: %v\n", δ)
//return ΔF{}, fmt.Errorf("ZBigFile<%s> changed @%s", oid, δZ.Tid)
}
}
// fmt.Printf("-> δF: %v\n", δF)
// fmt.Printf("-> δF: %v\n", δF)
...
@@ -538,7 +539,7 @@ func (δFtail *ΔFtail) LastBlkRev(ctx context.Context, zf *ZBigFile, blk int64,
...
@@ -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
{
type
_ΔZBigFile
struct
{
blksizeOld
,
blksizeNew
int64
blksizeOld
,
blksizeNew
int64
blktabOld
,
blktabNew
zodb
.
Oid
blktabOld
,
blktabNew
zodb
.
Oid
...
@@ -565,7 +566,7 @@ func zfilediff(db *zodb.DB, foid zodb.Oid, old, new zodb.Tid) (δ *_ΔZBigFile,
...
@@ -565,7 +566,7 @@ func zfilediff(db *zodb.DB, foid zodb.Oid, old, new zodb.Tid) (δ *_ΔZBigFile,
return
diffF
(
ctx
,
a
,
b
)
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
)
{
func
diffF
(
ctx
context
.
Context
,
a
,
b
*
ZBigFile
)
(
δ
*
_ΔZBigFile
,
err
error
)
{
defer
xerr
.
Contextf
(
&
err
,
"diffF %s %s"
,
xzodb
.
XidOf
(
a
),
xzodb
.
XidOf
(
b
))
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) {
...
@@ -256,49 +256,49 @@ func testΔFtail(t_ *testing.T, testq chan ΔFTestEntry) {
if
epoch
{
if
epoch
{
blkTab
=
map
[
int64
]
string
{}
blkTab
=
map
[
int64
]
string
{}
Zinblk
=
map
[
string
]
setI64
{}
Zinblk
=
map
[
string
]
setI64
{}
}
δblk
=
nil
}
else
{
// XXX else?
// rebuild blkTab/Zinblk
// rebuild blkTab/Zinblk
for
blk
,
zblk
:=
range
test
.
δblkTab
{
for
blk
,
zblk
:=
range
test
.
δblkTab
{
zprev
,
ok
:=
blkTab
[
blk
]
zprev
,
ok
:=
blkTab
[
blk
]
if
ok
{
if
ok
{
delete
(
Zinblk
[
zprev
],
blk
)
delete
(
Zinblk
[
zprev
],
blk
)
}
else
{
}
else
{
zprev
=
ø
zprev
=
ø
}
}
if
zblk
!=
ø
{
if
zblk
!=
ø
{
blkTab
[
blk
]
=
zblk
blkTab
[
blk
]
=
zblk
inblk
,
ok
:=
Zinblk
[
zblk
]
inblk
,
ok
:=
Zinblk
[
zblk
]
if
!
ok
{
if
!
ok
{
inblk
=
setI64
{}
inblk
=
setI64
{}
Zinblk
[
zblk
]
=
inblk
Zinblk
[
zblk
]
=
inblk
}
inblk
.
Add
(
blk
)
}
else
{
delete
(
blkTab
,
blk
)
}
}
inblk
.
Add
(
blk
)
}
else
{
delete
(
blkTab
,
blk
)
}
// update δblk due to change in blkTab
// update δblk due to change in blkTab
if
zblk
!=
zprev
{
if
zblk
!=
zprev
{
δblk
.
Add
(
blk
)
δblk
.
Add
(
blk
)
δtree
=
true
δtree
=
true
}
}
}
}
// rebuild dataTab
// rebuild dataTab
for
zblk
:=
range
test
.
δdataTab
{
for
zblk
:=
range
test
.
δdataTab
{
data
,
ok
:=
dataTab
[
zblk
]
// e.g. a -> a2
data
,
ok
:=
dataTab
[
zblk
]
// e.g. a -> a2
if
!
ok
{
if
!
ok
{
t
.
Fatalf
(
"BUG: blk %s not in dataTab
\n
dataTab: %v"
,
zblk
,
dataTab
)
t
.
Fatalf
(
"BUG: blk %s not in dataTab
\n
dataTab: %v"
,
zblk
,
dataTab
)
}
}
data
=
fmt
.
Sprintf
(
"%s%d"
,
data
[
:
1
],
i
)
// e.g. a4
data
=
fmt
.
Sprintf
(
"%s%d"
,
data
[
:
1
],
i
)
// e.g. a4
dataTab
[
zblk
]
=
data
dataTab
[
zblk
]
=
data
// update δblk due to change in ZBlk data
// update δblk due to change in ZBlk data
for
blk
:=
range
Zinblk
[
zblk
]
{
for
blk
:=
range
Zinblk
[
zblk
]
{
δblk
.
Add
(
blk
)
δblk
.
Add
(
blk
)
}
}
}
}
}
...
@@ -337,10 +337,10 @@ func testΔFtail(t_ *testing.T, testq chan ΔFTestEntry) {
...
@@ -337,10 +337,10 @@ func testΔFtail(t_ *testing.T, testq chan ΔFTestEntry) {
err
=
zconn
.
Resync
(
ctx
,
commit
.
At
);
X
(
err
)
err
=
zconn
.
Resync
(
ctx
,
commit
.
At
);
X
(
err
)
var
δfok
*
ΔFile
var
δfok
*
ΔFile
if
len
(
δblk
)
!=
0
{
if
epoch
||
len
(
δblk
)
!=
0
{
δfok
=
&
ΔFile
{
δfok
=
&
ΔFile
{
Rev
:
commit
.
At
,
Rev
:
commit
.
At
,
Epoch
:
epoch
,
// XXX epoch -> blocks/size = nil ?
Epoch
:
epoch
,
Blocks
:
δblk
,
Blocks
:
δblk
,
Size
:
δtree
,
// not strictly ok, but matches current ΔFtail code
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