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
02fa982f
Commit
02fa982f
authored
Jul 16, 2019
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
d5011053
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
11 additions
and
4 deletions
+11
-4
bigfile/file_zodb.py
bigfile/file_zodb.py
+1
-1
wcfs/__init__.py
wcfs/__init__.py
+5
-2
wcfs/wcfs.go
wcfs/wcfs.go
+1
-1
wcfs/wcfs_test.py
wcfs/wcfs_test.py
+4
-0
No files found.
bigfile/file_zodb.py
View file @
02fa982f
...
@@ -81,7 +81,7 @@ natural to also use "2" here.
...
@@ -81,7 +81,7 @@ natural to also use "2" here.
# FIXME ^^^ doc is horrible - add top-level up->down overview.
# FIXME ^^^ doc is horrible - add top-level up->down overview.
from
wendelin.bigfile
import
BigFile
,
WRITEOUT_STORE
,
WRITEOUT_MARKSTORED
from
wendelin.bigfile
import
BigFile
,
WRITEOUT_STORE
,
WRITEOUT_MARKSTORED
from
wendelin
import
wcfs
# XXX -> wendelin.bigfile.wcfs ?
from
wendelin
import
wcfs
from
wendelin.lib.mem
import
bzero
,
memcpy
from
wendelin.lib.mem
import
bzero
,
memcpy
from
wendelin.lib.zodb
import
deactivate_btree
from
wendelin.lib.zodb
import
deactivate_btree
...
...
wcfs/__init__.py
View file @
02fa982f
...
@@ -96,6 +96,7 @@ class Conn(object):
...
@@ -96,6 +96,7 @@ class Conn(object):
class
_File
(
object
):
class
_File
(
object
):
# .wconn Conn
# .wconn Conn
# .foid hex of ZBigFile root object ID
# .foid hex of ZBigFile root object ID
# .blksize block size of this file
# .headf file object of head/file
# .headf file object of head/file
# .pinned {} blk -> rev that wcfs already sent us for this file
# .pinned {} blk -> rev that wcfs already sent us for this file
# .mmaps []_Mapping ↑blk_start mappings of this file
# .mmaps []_Mapping ↑blk_start mappings of this file
...
@@ -169,7 +170,7 @@ def _pinner(wconn, ctx):
...
@@ -169,7 +170,7 @@ def _pinner(wconn, ctx):
# mmap creates file mapping representing file data as of wconn.at database state.
# mmap creates file mapping representing file data as of wconn.at database state.
@
func
(
Conn
)
@
func
(
Conn
)
def
mmap
(
wconn
,
foid
,
offset
,
size
):
# -> Mapping XXX offset, size -> blkoff, blksize ?
def
mmap
(
wconn
,
foid
,
blk
,
blklen
):
# -> Mapping
with
wconn
.
_filemu
:
with
wconn
.
_filemu
:
f
=
wconn
.
_filetab
.
get
(
foid
)
f
=
wconn
.
_filetab
.
get
(
foid
)
if
f
is
None
:
if
f
is
None
:
...
@@ -177,6 +178,7 @@ def mmap(wconn, foid, offset, size): # -> Mapping XXX offset, size -> blko
...
@@ -177,6 +178,7 @@ def mmap(wconn, foid, offset, size): # -> Mapping XXX offset, size -> blko
f
.
wconn
=
wconn
f
.
wconn
=
wconn
f
.
foid
=
foid
f
.
foid
=
foid
f
.
headf
=
wconn
.
_wc
.
_open
(
"head/bigfile/%s"
%
(
ashex
(
foid
),),
"rb"
)
f
.
headf
=
wconn
.
_wc
.
_open
(
"head/bigfile/%s"
%
(
ashex
(
foid
),),
"rb"
)
f
.
blksize
=
os
.
fstat
(
f
.
headf
.
fileno
()).
st_blksize
f
.
pinned
=
{}
f
.
pinned
=
{}
f
.
mmaps
=
[]
f
.
mmaps
=
[]
wconn
.
_filetab
[
foid
]
=
f
wconn
.
_filetab
[
foid
]
=
f
...
@@ -184,7 +186,7 @@ def mmap(wconn, foid, offset, size): # -> Mapping XXX offset, size -> blko
...
@@ -184,7 +186,7 @@ def mmap(wconn, foid, offset, size): # -> Mapping XXX offset, size -> blko
# XXX relock wconn -> f ?
# XXX relock wconn -> f ?
# create memory with head/f mapping and applied pins
# create memory with head/f mapping and applied pins
mem
=
mm
.
map_ro
(
f
.
headf
.
fileno
(),
offset
,
size
)
mem
=
mm
.
map_ro
(
f
.
headf
.
fileno
(),
blk
*
f
.
blksize
,
blklen
*
f
.
blk
size
)
mmap
=
_Mapping
(
f
,
blk_start
,
mem
)
mmap
=
_Mapping
(
f
,
blk_start
,
mem
)
for
blk
,
rev
in
f
.
pinned
.
items
():
# XXX keep f.pinned ↑blk and use binary search?
for
blk
,
rev
in
f
.
pinned
.
items
():
# XXX keep f.pinned ↑blk and use binary search?
if
not
(
blk_start
<=
blk
<
blk_stop
):
if
not
(
blk_start
<=
blk
<
blk_stop
):
...
@@ -210,6 +212,7 @@ def _remmapblk(mmap, blk, at):
...
@@ -210,6 +212,7 @@ def _remmapblk(mmap, blk, at):
# TODO share @rev fd until wconn is resynced?
# TODO share @rev fd until wconn is resynced?
fsfile
=
f
.
wconn
.
_wc
.
_open
(
"@%s/bigfile/%s"
%
(
ashex
(
at
),
ashex
(
f
.
foid
)),
"rb"
)
fsfile
=
f
.
wconn
.
_wc
.
_open
(
"@%s/bigfile/%s"
%
(
ashex
(
at
),
ashex
(
f
.
foid
)),
"rb"
)
defer
(
fsfile
.
close
)
defer
(
fsfile
.
close
)
assert
os
.
fstat
(
fsfile
.
fileno
()).
st_blksize
==
f
.
blksize
# FIXME assert
mm
.
map_into_ro
(
mmap
.
mem
[(
blk
-
mmap
.
blk_start
)
*
blksize
:][:
blksize
],
fsfile
.
fileno
(),
blk
*
blksize
)
mm
.
map_into_ro
(
mmap
.
mem
[(
blk
-
mmap
.
blk_start
)
*
blksize
:][:
blksize
],
fsfile
.
fileno
(),
blk
*
blksize
)
...
...
wcfs/wcfs.go
View file @
02fa982f
...
@@ -2190,8 +2190,8 @@ func (f *BigFile) GetAttr(out *fuse.Attr, _ nodefs.File, _ *fuse.Context) fuse.S
...
@@ -2190,8 +2190,8 @@ func (f *BigFile) GetAttr(out *fuse.Attr, _ nodefs.File, _ *fuse.Context) fuse.S
func
(
f
*
BigFile
)
getattr
(
out
*
fuse
.
Attr
)
{
func
(
f
*
BigFile
)
getattr
(
out
*
fuse
.
Attr
)
{
out
.
Mode
=
fuse
.
S_IFREG
|
0444
out
.
Mode
=
fuse
.
S_IFREG
|
0444
out
.
Size
=
uint64
(
f
.
size
)
out
.
Size
=
uint64
(
f
.
size
)
out
.
Blksize
=
uint32
(
f
.
blksize
)
// XXX 64 -> 32
// .Blocks
// .Blocks
// .Blksize
mtime
:=
f
.
rev
.
Time
()
.
Time
mtime
:=
f
.
rev
.
Time
()
.
Time
out
.
SetTimes
(
/*atime=*/
nil
,
/*mtime=*/
&
mtime
,
/*ctime=*/
&
mtime
)
out
.
SetTimes
(
/*atime=*/
nil
,
/*mtime=*/
&
mtime
,
/*ctime=*/
&
mtime
)
...
...
wcfs/wcfs_test.py
View file @
02fa982f
...
@@ -1074,6 +1074,10 @@ def test_wcfs_basic():
...
@@ -1074,6 +1074,10 @@ def test_wcfs_basic():
t
.
wc
.
_stat
(
"head/bigfile/%s"
%
h
(
t
.
nonzfile
.
_p_oid
))
t
.
wc
.
_stat
(
"head/bigfile/%s"
%
h
(
t
.
nonzfile
.
_p_oid
))
assert
exc
.
value
.
errno
==
EINVAL
assert
exc
.
value
.
errno
==
EINVAL
# make sure that wcfs reports zf.blksize as preffered block size for IO
_
=
t
.
wc
.
_stat
(
zf
)
assert
_
.
st_blksize
==
zf
.
blksize
# >>> file initially empty
# >>> file initially empty
f
=
t
.
open
(
zf
)
f
=
t
.
open
(
zf
)
f
.
assertCache
([])
f
.
assertCache
([])
...
...
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