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
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Joshua
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.
# FIXME ^^^ doc is horrible - add top-level up->down overview.
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.zodb
import
deactivate_btree
...
...
wcfs/__init__.py
View file @
02fa982f
...
...
@@ -96,6 +96,7 @@ class Conn(object):
class
_File
(
object
):
# .wconn Conn
# .foid hex of ZBigFile root object ID
# .blksize block size of this file
# .headf file object of head/file
# .pinned {} blk -> rev that wcfs already sent us for this file
# .mmaps []_Mapping ↑blk_start mappings of this file
...
...
@@ -169,7 +170,7 @@ def _pinner(wconn, ctx):
# mmap creates file mapping representing file data as of wconn.at database state.
@
func
(
Conn
)
def
mmap
(
wconn
,
foid
,
offset
,
size
):
# -> Mapping XXX offset, size -> blkoff, blksize ?
def
mmap
(
wconn
,
foid
,
blk
,
blklen
):
# -> Mapping
with
wconn
.
_filemu
:
f
=
wconn
.
_filetab
.
get
(
foid
)
if
f
is
None
:
...
...
@@ -177,6 +178,7 @@ def mmap(wconn, foid, offset, size): # -> Mapping XXX offset, size -> blko
f
.
wconn
=
wconn
f
.
foid
=
foid
f
.
headf
=
wconn
.
_wc
.
_open
(
"head/bigfile/%s"
%
(
ashex
(
foid
),),
"rb"
)
f
.
blksize
=
os
.
fstat
(
f
.
headf
.
fileno
()).
st_blksize
f
.
pinned
=
{}
f
.
mmaps
=
[]
wconn
.
_filetab
[
foid
]
=
f
...
...
@@ -184,7 +186,7 @@ def mmap(wconn, foid, offset, size): # -> Mapping XXX offset, size -> blko
# XXX relock wconn -> f ?
# 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
)
for
blk
,
rev
in
f
.
pinned
.
items
():
# XXX keep f.pinned ↑blk and use binary search?
if
not
(
blk_start
<=
blk
<
blk_stop
):
...
...
@@ -210,6 +212,7 @@ def _remmapblk(mmap, blk, at):
# TODO share @rev fd until wconn is resynced?
fsfile
=
f
.
wconn
.
_wc
.
_open
(
"@%s/bigfile/%s"
%
(
ashex
(
at
),
ashex
(
f
.
foid
)),
"rb"
)
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
)
...
...
wcfs/wcfs.go
View file @
02fa982f
...
...
@@ -2190,8 +2190,8 @@ func (f *BigFile) GetAttr(out *fuse.Attr, _ nodefs.File, _ *fuse.Context) fuse.S
func
(
f
*
BigFile
)
getattr
(
out
*
fuse
.
Attr
)
{
out
.
Mode
=
fuse
.
S_IFREG
|
0444
out
.
Size
=
uint64
(
f
.
size
)
out
.
Blksize
=
uint32
(
f
.
blksize
)
// XXX 64 -> 32
// .Blocks
// .Blksize
mtime
:=
f
.
rev
.
Time
()
.
Time
out
.
SetTimes
(
/*atime=*/
nil
,
/*mtime=*/
&
mtime
,
/*ctime=*/
&
mtime
)
...
...
wcfs/wcfs_test.py
View file @
02fa982f
...
...
@@ -1074,6 +1074,10 @@ def test_wcfs_basic():
t
.
wc
.
_stat
(
"head/bigfile/%s"
%
h
(
t
.
nonzfile
.
_p_oid
))
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
f
=
t
.
open
(
zf
)
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