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
0e8a1ecb
Commit
0e8a1ecb
authored
Jul 16, 2019
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
51eed733
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
13 deletions
+15
-13
wcfs/__init__.py
wcfs/__init__.py
+15
-13
No files found.
wcfs/__init__.py
View file @
0e8a1ecb
...
...
@@ -53,16 +53,15 @@ from six import reraise
# WCFS represents filesystem-level connection to wcfs server.
#
# It has to be created with join.
# Only 1 connection is maintained for one file server.
# Use join to create it.
#
# The primary way to access wcfs is to open logical connection viewing on-wcfs
# data as of particular database state, and use that logical connection to
# create base-layer mappings. See .
open
and Conn for details.
# create base-layer mappings. See .
connect
and Conn for details.
#
# Raw files on wcfs can be accessed with ._path/._read/._stat/._open .
#
#
XXX WCFS parallel
s ZODB.DB .
#
WCFS logically mirror
s ZODB.DB .
class
WCFS
(
object
):
# .mountpoint path to wcfs mountpoint
# ._fwcfs /.wcfs/zurl opened to keep the server from going away (at least cleanly)
...
...
@@ -79,8 +78,9 @@ class WCFS(object):
# maintain isolated database view while at the same time sharing most of data
# cache in OS pagecache of /head/bigfile/*.
#
# XXX wc conn <-> zconn
# XXX Conn parallels ZODB.Connection .
# Use .mmap to create new Mappings.
#
# Conn logically mirrors ZODB.Connection .
class
Conn
(
object
):
# ._wc WCFS
# .at Tid
...
...
@@ -146,7 +146,7 @@ def _pinner(wconn, ctx):
continue
# FIXME check if virtmem did not mapped RW page into this block already
mmap
.
mmapblk
(
req
.
blk
,
req
.
at
)
mmap
.
_
mmapblk
(
req
.
blk
,
req
.
at
)
# update f.pinned
if
req
.
at
is
None
:
...
...
@@ -155,12 +155,12 @@ def _pinner(wconn, ctx):
f
.
pinned
[
req
.
blk
]
=
req
.
at
#
pin remmaps mapping memory for
[blk] to be viewing database as of @at state.
#
_mmapblk remmaps mapping memory for file
[blk] to be viewing database as of @at state.
#
# at=None means unpin to head/ .
# NOTE this does not check wrt virtmem already mapped blk as RW XXX ok?
@
func
(
_Mapping
)
def
pin
(
mmap
,
blk
,
at
):
def
_mmapblk
(
mmap
,
blk
,
at
):
assert
mmap
.
blk_start
<=
blk
<
mmap
.
blk_stop
f
=
mmap
.
file
if
at
is
None
:
...
...
@@ -188,10 +188,10 @@ def mmap(wconn, foid, offset, size): # -> Mapping XXX offset, size -> blko
# create memory with head/f mapping and applied pins
mem
=
mm
.
mmap_ro
(
f
.
headf
.
fileno
(),
offset
,
size
)
mmap
=
_Mapping
(
f
,
blk_start
,
mem
)
for
blk
,
rev
in
f
.
pin
.
items
():
# XXX keep f.pin
↑blk and use binary search?
for
blk
,
rev
in
f
.
pin
ned
.
items
():
# XXX keep f.pinned
↑blk and use binary search?
if
not
(
blk_start
<=
blk
&&
blk
<
blk_stop
):
continue
# blk out of this mapping
mmap
.
mmapblk
(
blk
,
rev
)
mmap
.
_
mmapblk
(
blk
,
rev
)
f
.
mmaps
.
append
(
mmap
)
# XXX keep f.mmaps ↑blk_start
...
...
@@ -204,7 +204,7 @@ def remmap_blk(mmap, blk):
# XXX locking
assert
(
mmap
.
blk_start
<=
blk
<
mmap
.
blk_stop
)
blkrev
=
mmap
.
pinned
.
get
(
blk
,
None
)
# rev | @head
mmap
.
mmapblk
(
blk
,
blkrev
)
mmap
.
_
mmapblk
(
blk
,
blkrev
)
# unmap is removes mapping memory from address space.
...
...
@@ -580,7 +580,9 @@ def _default_autostart():
#
# If wcfs for that zurl was already started, join connects to it.
# Otherwise it starts wcfs for zurl if autostart is True.
def
join
(
zurl
,
autostart
=
_default_autostart
()):
# -> WCFS
#
# For the same zurl join returns the WCFS object.
def
join
(
zurl
,
autostart
=
_default_autostart
()):
# -> WCFS
mntpt
=
_mntpt_4zurl
(
zurl
)
with
_wcmu
:
# check if we already have connection to wcfs server from this process
...
...
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