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
3a755a42
Commit
3a755a42
authored
Dec 03, 2019
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
c11843b4
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
64 additions
and
49 deletions
+64
-49
wcfs/internal/_wcfs.pyx
wcfs/internal/_wcfs.pyx
+8
-0
wcfs/internal/wcfs.h
wcfs/internal/wcfs.h
+56
-6
wcfs/internal/wcfs_virtmem.cpp
wcfs/internal/wcfs_virtmem.cpp
+0
-43
No files found.
wcfs/internal/_wcfs.pyx
View file @
3a755a42
...
...
@@ -91,6 +91,14 @@ cdef extern from "wcfs.h" nogil:
pair
[
WatchLink
,
error
]
_openwatch
()
# XXX pair instead of tuple
cppclass
_Conn
:
# XXX
pass
cppclass
Conn
(
refptr
[
_Conn
]):
# XXX
pass
cdef
class
PyWCFS
:
cdef
WCFS
wc
...
...
wcfs/internal/wcfs.h
View file @
3a755a42
...
...
@@ -22,6 +22,13 @@
#ifndef _NXD_WCFS_H_
#define _NXD_WCFS_H_
#include <golang/libgolang.h>
#include <golang/cxx.h>
#include <golang/sync.h>
using
namespace
golang
;
using
cxx
::
dict
;
using
cxx
::
set
;
#include <string>
using
std
::
string
;
...
...
@@ -33,8 +40,10 @@ using std::pair;
#include "wcfs_misc.h"
struct
_Conn
;
class
_WatchLink
;
struct
_File
;
struct
PinReq
;
typedef
refptr
<
class
_Conn
>
Conn
;
typedef
refptr
<
class
_WatchLink
>
WatchLink
;
// WCFS represents filesystem-level connection to wcfs server.
...
...
@@ -42,10 +51,51 @@ class _WatchLink;
struct
WCFS
{
string
mountpoint
;
tuple
<
refptr
<
_Conn
>
,
error
>
connect
(
zodb
::
Tid
at
);
string
_path
(
const
string
&
obj
);
tuple
<
os
::
File
,
error
>
_open
(
const
string
&
path
,
int
flags
=
O_RDONLY
);
pair
<
refptr
<
_WatchLink
>
,
error
>
_openwatch
();
tuple
<
Conn
,
error
>
connect
(
zodb
::
Tid
at
);
string
_path
(
const
string
&
obj
);
tuple
<
os
::
File
,
error
>
_open
(
const
string
&
path
,
int
flags
=
O_RDONLY
);
pair
<
WatchLink
,
error
>
_openwatch
();
};
// Conn represents logical connection that provides view of data on wcfs
// filesystem as of particular database state.
//
// It uses /head/bigfile/* and notifications received from /head/watch to
// maintain isolated database view while at the same time sharing most of data
// cache in OS pagecache of /head/bigfile/*.
//
// Use WCFS.connect(at) to create Conn.
// Use .mmap to create new Mappings.
// Use .resync to resync Conn onto different database view.
//
// Conn logically mirrors ZODB.Connection .
typedef
refptr
<
struct
_Conn
>
Conn
;
struct
_Conn
:
object
{
WCFS
*
_wc
;
zodb
::
Tid
at
;
WatchLink
_wlink
;
// watch/receive pins for created mappings
sync
::
Mutex
_filemu
;
dict
<
zodb
::
Oid
,
_File
*>
_filetab
;
// {} foid -> _file
sync
::
WorkGroup
_pinWG
;
func
<
void
()
>
_pinCancel
;
// don't new - create via WCFS.connect
private:
_Conn
();
~
_Conn
();
friend
tuple
<
Conn
,
error
>
WCFS
::
connect
(
zodb
::
Tid
at
);
public:
void
decref
();
public:
error
close
();
error
resync
(
zodb
::
Tid
at
);
private:
error
_pinner
(
context
::
Context
ctx
);
void
_pin1
(
PinReq
*
req
);
};
...
...
wcfs/internal/wcfs_virtmem.cpp
View file @
3a755a42
...
...
@@ -50,50 +50,7 @@ static string h(uint64_t v); // v -> 016x hex representation
static
error
mmap_zero_into_ro
(
void
*
addr
,
size_t
size
);
static
error
mmap_into_ro
(
void
*
addr
,
size_t
size
,
const
os
::
File
&
f
,
off_t
offset
);
struct
_File
;
struct
_Mapping
;
struct
PinReq
;
// Conn represents logical connection that provides view of data on wcfs
// filesystem as of particular database state.
//
// It uses /head/bigfile/* and notifications received from /head/watch to
// maintain isolated database view while at the same time sharing most of data
// cache in OS pagecache of /head/bigfile/*.
//
// Use WCFS.connect(at) to create Conn.
// Use .mmap to create new Mappings.
// Use .resync to resync Conn onto different database view.
//
// Conn logically mirrors ZODB.Connection .
typedef
refptr
<
struct
_Conn
>
Conn
;
struct
_Conn
:
object
{
WCFS
*
_wc
;
zodb
::
Tid
at
;
WatchLink
_wlink
;
// watch/receive pins for created mappings
sync
::
Mutex
_filemu
;
dict
<
zodb
::
Oid
,
_File
*>
_filetab
;
// {} foid -> _file
sync
::
WorkGroup
_pinWG
;
func
<
void
()
>
_pinCancel
;
// don't new - create via WCFS.connect
private:
_Conn
();
~
_Conn
();
friend
tuple
<
Conn
,
error
>
WCFS
::
connect
(
zodb
::
Tid
at
);
public:
void
decref
();
public:
error
close
();
error
resync
(
zodb
::
Tid
at
);
private:
error
_pinner
(
context
::
Context
ctx
);
void
_pin1
(
PinReq
*
req
);
};
// _File represent isolated file view under Conn.
//
...
...
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