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
9e3f6bb6
Commit
9e3f6bb6
authored
Feb 06, 2019
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
748b40e8
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
13 deletions
+27
-13
wcfs/internal/δbtree/δbtree.go
wcfs/internal/δbtree/δbtree.go
+3
-0
wcfs/wcfs.go
wcfs/wcfs.go
+12
-5
wcfs/zblk.go
wcfs/zblk.go
+12
-8
No files found.
wcfs/internal/δbtree/δbtree.go
View file @
9e3f6bb6
...
...
@@ -63,6 +63,9 @@ func NewPathSet() *PathSet {
//
// XXX catch cycles on add?
func
(
m
*
PathSet
)
Add
(
master
interface
{},
path
[]
zodb
.
IPersistent
)
{
fmt
.
Printf
(
"
\n\n
PathSet.Add %v %s
\n
"
,
master
,
path
)
panic
(
"aaa"
)
l
:=
len
(
path
)
if
l
==
0
{
panic
(
"empty path"
)
...
...
wcfs/wcfs.go
View file @
9e3f6bb6
...
...
@@ -670,7 +670,7 @@ func (root *Root) zδhandle1(zevent zodb.CommitEvent) {
// find out which files need to be invalidated due to index change
// XXX no indexMu lock needed because head is Locked
// XXX stub -> TODO full δbtree
// XXX stub -> TODO full δbtree
| update indexLooked itself
fmt
.
Printf
(
"
\n
btreeChangev: %v
\n
"
,
btreeChangev
)
xfiles
:=
bfdir
.
indexLooked
.
Invalidates
(
btreeChangev
)
fmt
.
Printf
(
"xfiles: %v
\n
"
,
xfiles
)
...
...
@@ -737,12 +737,13 @@ func (root *Root) zδhandle1(zevent zodb.CommitEvent) {
panic
(
err
)
// XXX
}
zbfSize
,
err
:=
file
.
zbf
.
Size
(
ctx
)
zbfSize
,
treePath
,
err
:=
file
.
zbf
.
Size
(
ctx
)
if
err
!=
nil
{
panic
(
err
)
// XXX
}
file
.
zbfSize
=
zbfSize
bfdir
.
indexLooked
.
Add
(
file
,
treePath
)
}
// notify .wcfs/zhead
...
...
@@ -1041,13 +1042,13 @@ func (head *Head) bigopen(ctx context.Context, oid zodb.Oid) (_ *BigFile, err er
}
}()
zbfSize
,
err
:=
zbf
.
Size
(
ctx
)
zbfSize
,
treePath
,
err
:=
zbf
.
Size
(
ctx
)
if
err
!=
nil
{
return
nil
,
err
}
// zconn.Incref()
return
&
BigFile
{
f
:=
&
BigFile
{
Node
:
newDefaultNode
(),
head
:
head
,
zbf
:
zbf
,
...
...
@@ -1056,7 +1057,13 @@ func (head *Head) bigopen(ctx context.Context, oid zodb.Oid) (_ *BigFile, err er
// XXX this is needed only for head/
δFtail
:
NewΔTailI64
(
zconn
.
At
()),
loading
:
make
(
map
[
int64
]
*
blkLoadState
),
},
nil
}
head
.
bfdir
.
indexMu
.
Lock
()
// XXX locking ok?
head
.
bfdir
.
indexLooked
.
Add
(
f
,
treePath
)
head
.
bfdir
.
indexMu
.
Unlock
()
return
f
,
nil
}
// Close release all resources of BigFile.
...
...
wcfs/zblk.go
View file @
9e3f6bb6
...
...
@@ -458,7 +458,7 @@ func (bf *ZBigFile) LoadBlk(ctx context.Context, blk int64) (_ []byte, treePath
defer
bf
.
PDeactivate
()
pathRevMax
=
0
xzblk
,
ok
,
err
:=
bf
.
blktab
.
GetTo
(
ctx
,
blk
,
func
(
node
zodb
.
IPersistent
)
{
xzblk
,
ok
,
err
:=
bf
.
blktab
.
VGet
(
ctx
,
blk
,
func
(
node
zodb
.
IPersistent
)
{
treePath
=
append
(
treePath
,
node
)
pathRevMax
=
tidmax
(
pathRevMax
,
node
.
PSerial
())
})
...
...
@@ -499,29 +499,33 @@ func (bf *ZBigFile) LoadBlk(ctx context.Context, blk int64) (_ []byte, treePath
}
// Size returns whole file size.
func
(
bf
*
ZBigFile
)
Size
(
ctx
context
.
Context
)
(
_
int64
,
err
error
)
{
//
// it also returns BTree path scaned to obtain size.
func
(
bf
*
ZBigFile
)
Size
(
ctx
context
.
Context
)
(
_
int64
,
treePath
[]
zodb
.
IPersistent
,
err
error
)
{
defer
xerr
.
Contextf
(
&
err
,
"bigfile %s: size"
,
bf
.
POid
())
err
=
bf
.
PActivate
(
ctx
)
if
err
!=
nil
{
return
0
,
err
return
0
,
nil
,
err
}
defer
bf
.
PDeactivate
()
tailblk
,
ok
,
err
:=
bf
.
blktab
.
MaxKey
(
ctx
)
tailblk
,
ok
,
err
:=
bf
.
blktab
.
VMaxKey
(
ctx
,
func
(
node
zodb
.
IPersistent
)
{
treePath
=
append
(
treePath
,
node
)
})
if
err
!=
nil
{
return
0
,
err
return
0
,
nil
,
err
}
if
!
ok
{
return
0
,
nil
return
0
,
nil
,
nil
}
size
:=
(
tailblk
+
1
)
*
bf
.
blksize
if
size
/
bf
.
blksize
!=
tailblk
+
1
{
return
0
,
syscall
.
EFBIG
// overflow
return
0
,
nil
,
syscall
.
EFBIG
// overflow
}
return
size
,
nil
return
size
,
treePath
,
nil
}
...
...
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