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
57489834
Commit
57489834
authored
Dec 09, 2019
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
ae23c2c3
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
156 additions
and
118 deletions
+156
-118
wcfs/__init__.py
wcfs/__init__.py
+2
-0
wcfs/internal/wcfs.h
wcfs/internal/wcfs.h
+83
-10
wcfs/internal/wcfs_virtmem.cpp
wcfs/internal/wcfs_virtmem.cpp
+71
-108
No files found.
wcfs/__init__.py
View file @
57489834
...
...
@@ -74,6 +74,8 @@ from .internal._wcfs import \
# Raw files on wcfs can be accessed with ._path/._read/._stat/._open .
#
# WCFS logically mirrors ZODB.DB .
#
# XXX kill doc instead of C++.
class
WCFS
(
_WCFS
):
# .mountpoint path to wcfs mountpoint
# ._fwcfs /.wcfs/zurl opened to keep the server from going away (at least cleanly)
...
...
wcfs/internal/wcfs.h
View file @
57489834
...
...
@@ -40,18 +40,33 @@ using std::pair;
#include "wcfs_misc.h"
// from wendelin/bigfile/virtmem.h
extern
"C"
{
struct
BigFileH
;
}
// wcfs::
namespace
wcfs
{
struct
_File
;
struct
_Mapping
;
typedef
refptr
<
struct
_Conn
>
Conn
;
typedef
refptr
<
struct
_Mapping
>
Mapping
;
typedef
refptr
<
struct
_FileH
>
FileH
;
typedef
refptr
<
struct
_WatchLink
>
WatchLink
;
struct
PinReq
;
typedef
refptr
<
class
_Conn
>
Conn
;
typedef
refptr
<
class
_WatchLink
>
WatchLink
;
// WCFS represents filesystem-level connection to wcfs server.
// XXX doc
//
// XXX 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 .connect and Conn for details.
//
// XXX raw files?
//
// WCFS logically mirrors ZODB.DB .
struct
WCFS
{
string
mountpoint
;
...
...
@@ -69,7 +84,7 @@ struct WCFS {
// cache in OS pagecache of /head/bigfile/*.
//
// Use WCFS.connect(at) to create Conn.
// Use .
mmap to create new Mappings
.
// Use .
open to create new FileH
.
// Use .resync to resync Conn onto different database view.
//
// Conn logically mirrors ZODB.Connection .
...
...
@@ -79,8 +94,8 @@ struct _Conn : object {
zodb
::
Tid
at
;
WatchLink
_wlink
;
// watch/receive pins for created mappings
sync
::
Mutex
_file
mu
;
dict
<
zodb
::
Oid
,
_File
*>
_filetab
;
// {} foid -> _file
sync
::
Mutex
_fileh
mu
;
dict
<
zodb
::
Oid
,
FileH
>
_filehtab
;
// {} foid -> fileh
sync
::
WorkGroup
_pinWG
;
func
<
void
()
>
_pinCancel
;
...
...
@@ -95,8 +110,8 @@ public:
public:
error
close
();
// XXX move mmap ->
_FileH ?
pair
<
_Mapping
*
,
error
>
mmap
(
zodb
::
Oid
foid
,
int64_t
blk_start
,
int64_t
blk_len
);
// XXX move mmap ->
FileH
pair
<
Mapping
,
error
>
mmap
(
zodb
::
Oid
foid
,
int64_t
blk_start
,
int64_t
blk_len
);
error
resync
(
zodb
::
Tid
at
);
private:
...
...
@@ -104,6 +119,64 @@ private:
void
_pin1
(
PinReq
*
req
);
};
// FileH represent isolated file view under Conn.
//
// The file view is maintained to be as of @Conn.at database state.
// The file view uses /head/<file>/data primarilty and @revX/<file>/data pin overrides.
//
// Use .mmap to map file view into memory.
typedef
refptr
<
struct
_FileH
>
FileH
;
struct
_FileH
:
object
{
Conn
wconn
;
zodb
::
Oid
_foid
;
// ZBigFile root object ID
size_t
_blksize
;
// block size of this file XXX -> off_t ?
os
::
File
_headf
;
// file object of head/file
off_t
_headfsize
;
// head/file size is known to be at least headfsize (size ↑=)
dict
<
int64_t
,
zodb
::
Tid
>
_pinned
;
// {} blk -> rev that wcfs already sent us for this file
vector
<
Mapping
>
_mmaps
;
// []Mapping ↑blk_start mappings of this file
// don't new - create via Conn.open
private:
_FileH
();
~
_FileH
();
// XXX -> friend Conn::open
friend
pair
<
Mapping
,
error
>
_Conn
::
mmap
(
zodb
::
Oid
foid
,
int64_t
blk_start
,
int64_t
blk_len
);
public:
void
decref
();
};
// Mapping represents one mapping of FileH.
typedef
refptr
<
struct
_Mapping
>
Mapping
;
struct
_Mapping
:
object
{
FileH
fileh
;
int64_t
blk_start
;
// offset of this mapping in file
BigFileH
*
virt_fileh
;
// mmapped under this virtmem file handle XXX -> VMA XXX can be nil
uint8_t
*
mem_start
;
// mmapped memory [mem_start, mem_stop)
uint8_t
*
mem_stop
;
int64_t
blk_stop
()
const
{
//XXX reenable
//ASSERT((mem_stop - mem_start) % file->blksize == 0);
return
blk_start
+
(
mem_stop
-
mem_start
)
/
fileh
->
_blksize
;
}
error
_remmapblk
(
int64_t
blk
,
zodb
::
Tid
at
);
void
remmap_blk
(
int64_t
blk
);
void
unmap
();
// don't new - create via FileH.mmap
private:
_Mapping
();
~
_Mapping
();
// XXX -> friend FileH.mmap
friend
pair
<
Mapping
,
error
>
_Conn
::
mmap
(
zodb
::
Oid
foid
,
int64_t
blk_start
,
int64_t
blk_len
);
public:
void
decref
();
};
}
// wcfs::
...
...
wcfs/internal/wcfs_virtmem.cpp
View file @
57489834
This diff is collapsed.
Click to expand it.
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