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
8b0816bc
Commit
8b0816bc
authored
Mar 08, 2019
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
424beee4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
22 deletions
+22
-22
wcfs/wcfs.go
wcfs/wcfs.go
+22
-22
No files found.
wcfs/wcfs.go
View file @
8b0816bc
...
...
@@ -495,12 +495,12 @@ type BigFile struct {
head
*
Head
// ZBigFile top-level object
z
bf
*
ZBigFile
z
file
*
ZBigFile
// things read/computed from .z
bf
; constant during lifetime of current transaction.
blksize
int64
// z
bf
.blksize
size
int64
// z
bf
.Size()
rev
zodb
.
Tid
// last revision that modified z
bf
data
// things read/computed from .z
file
; constant during lifetime of current transaction.
blksize
int64
// z
file
.blksize
size
int64
// z
file
.Size()
rev
zodb
.
Tid
// last revision that modified z
file
data
// tail change history of this file.
δFtail
*
ΔTailI64
// [](rev↑, []#blk)
...
...
@@ -750,7 +750,7 @@ retry:
fmt
.
Printf
(
"
\n\n
zδhandle: toinvalidate (#%d):
\n
"
,
len
(
toinvalidate
))
for
file
:=
range
toinvalidate
{
fmt
.
Printf
(
"
\t
- %s
\n
"
,
file
.
z
bf
.
POid
())
fmt
.
Printf
(
"
\t
- %s
\n
"
,
file
.
z
file
.
POid
())
}
wg
,
ctx
:=
errgroup
.
WithContext
(
context
.
TODO
())
...
...
@@ -802,7 +802,7 @@ retry:
// XXX -> parallel?
// XXX locking
for
file
:=
range
toinvalidate
{
size
,
treePath
,
err
:=
file
.
z
bf
.
Size
(
ctx
)
size
,
treePath
,
err
:=
file
.
z
file
.
Size
(
ctx
)
if
err
!=
nil
{
panic
(
err
)
// XXX
}
...
...
@@ -870,7 +870,7 @@ func (f *BigFile) invalidateBlk(ctx context.Context, blk int64) (err error) {
func
()
{
// store retrieved data back to OS cache for file @<rev>/file[blk]
blkrev
,
_
:=
f
.
δFtail
.
LastRevOf
(
blk
,
f
.
head
.
zconn
.
At
())
frev
,
frelease
,
err
:=
groot
.
mkrevfile
(
blkrev
,
f
.
z
bf
.
POid
())
frev
,
frelease
,
err
:=
groot
.
mkrevfile
(
blkrev
,
f
.
z
file
.
POid
())
if
err
!=
nil
{
log
.
Errorf
(
"BUG: %s: invalidate blk #%d: %s (ignoring, but reading @revX/bigfile will be slow)"
,
f
.
path
(),
blk
,
err
)
}
...
...
@@ -1110,7 +1110,7 @@ func (head *Head) bigopen(ctx context.Context, oid zodb.Oid) (_ *BigFile, err er
ctx
,
cancel
:=
xcontext
.
Merge
(
ctx
,
zconn
.
txnCtx
)
defer
cancel
()
xz
bf
,
err
:=
zconn
.
Get
(
ctx
,
oid
)
xz
file
,
err
:=
zconn
.
Get
(
ctx
,
oid
)
if
err
!=
nil
{
switch
errors
.
Cause
(
err
)
.
(
type
)
{
case
*
zodb
.
NoObjectError
:
...
...
@@ -1122,26 +1122,26 @@ func (head *Head) bigopen(ctx context.Context, oid zodb.Oid) (_ *BigFile, err er
}
}
z
bf
,
ok
:=
xzbf
.
(
*
ZBigFile
)
z
file
,
ok
:=
xzfile
.
(
*
ZBigFile
)
if
!
ok
{
return
nil
,
eINVALf
(
"%s is not a ZBigFile"
,
typeOf
(
xz
bf
))
return
nil
,
eINVALf
(
"%s is not a ZBigFile"
,
typeOf
(
xz
file
))
}
// extract blksize, size and initial approximation for file revision
err
=
z
bf
.
PActivate
(
ctx
)
err
=
z
file
.
PActivate
(
ctx
)
if
err
!=
nil
{
return
nil
,
err
}
blksize
:=
z
bf
.
blksize
blksize
:=
z
file
.
blksize
// XXX it should be revision of both ZBigFile and its data. But we
// cannot get data revision without expensive scan of all ZBigFile's objects.
// -> approximate mtime initially with ZBigFile object mtime.
//
// XXX for @rev/... we can know initial mtime more exactly?
rev
:=
z
bf
.
PSerial
()
z
bf
.
PDeactivate
()
rev
:=
z
file
.
PSerial
()
z
file
.
PDeactivate
()
size
,
treePath
,
err
:=
z
bf
.
Size
(
ctx
)
size
,
treePath
,
err
:=
z
file
.
Size
(
ctx
)
if
err
!=
nil
{
return
nil
,
err
}
...
...
@@ -1150,7 +1150,7 @@ func (head *Head) bigopen(ctx context.Context, oid zodb.Oid) (_ *BigFile, err er
f
:=
&
BigFile
{
fsNode
:
newFSNode
(
&
fsOptions
{
Sticky
:
false
}),
// XXX + BigFile.OnForget -> del .head.bfdir.fileTab[]
head
:
head
,
z
bf
:
zbf
,
z
file
:
zfile
,
blksize
:
blksize
,
size
:
size
,
rev
:
rev
,
...
...
@@ -1173,7 +1173,7 @@ func (head *Head) bigopen(ctx context.Context, oid zodb.Oid) (_ *BigFile, err er
// Close release all resources of BigFile.
func
(
f
*
BigFile
)
Close
()
error
{
// XXX locking?
f
.
z
bf
=
nil
f
.
z
file
=
nil
// f.zconn.Release()
// f.zconn = nil
...
...
@@ -1303,8 +1303,8 @@ func (f *BigFile) readBlk(ctx context.Context, blk int64, dest []byte) error {
// noone was loading - we became responsible to load this block
z
bf
:=
f
.
zbf
blkdata
,
treepath
,
pathRevMax
,
err
:=
z
bf
.
LoadBlk
(
ctx
,
blk
)
z
file
:=
f
.
zfile
blkdata
,
treepath
,
pathRevMax
,
err
:=
z
file
.
LoadBlk
(
ctx
,
blk
)
loading
.
blkdata
=
blkdata
loading
.
err
=
err
close
(
loading
.
ready
)
...
...
@@ -1318,7 +1318,7 @@ func (f *BigFile) readBlk(ctx context.Context, blk int64, dest []byte) error {
}
// XXX before loading.ready?
blkrevmax
,
_
:=
f
.
δFtail
.
LastRevOf
(
blk
,
z
bf
.
PJar
()
.
At
())
blkrevmax
,
_
:=
f
.
δFtail
.
LastRevOf
(
blk
,
z
file
.
PJar
()
.
At
())
blkrevmax
=
tidmin
(
blkrevmax
,
pathRevMax
)
/*
...
...
@@ -1411,7 +1411,7 @@ retry:
return
}
oid
:=
f
.
z
bf
.
POid
()
oid
:=
f
.
z
file
.
POid
()
// signal to zwatcher not to run while we are performing the upload.
// upload with released zconnMu so that zwatcher can lock it even if to
...
...
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