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
e4125185
Commit
e4125185
authored
Oct 01, 2018
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
968a761e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
10 deletions
+30
-10
wcfs/wcfs.go
wcfs/wcfs.go
+30
-10
No files found.
wcfs/wcfs.go
View file @
e4125185
...
...
@@ -255,6 +255,9 @@ import (
"sync"
"syscall"
"lab.nexedi.com/kirr/go123/xcontext"
"lab.nexedi.com/kirr/neo/go/transaction"
"lab.nexedi.com/kirr/neo/go/zodb"
"lab.nexedi.com/kirr/neo/go/zodb/btree"
_
"lab.nexedi.com/kirr/neo/go/zodb/wks"
...
...
@@ -301,7 +304,13 @@ type BigFileData struct {
nodefs
.
Node
//parent *BigFileHead
zconn
*
zodb
.
Connection
// ZODB connection via whcih .zbf is accessed
// current read-only transaction under which we access ZODB data
txnCtx
context
.
Context
// XXX -> directly store txn
// connection via which ZODB object for this bigfile are accessed
// XXX do we need to keep it here explicitly?
zconn
*
zodb
.
Connection
zbf
*
ZBigFile
// TODO
...
...
@@ -312,7 +321,7 @@ type BigFileData struct {
// /bigfile -> Mkdir receives client request to create /bigfile/<bigfileX>.
//
// It creates <bigfileX>/head/data along the way.
func
(
bfroot
*
BigFileRoot
)
Mkdir
(
name
string
,
mode
uint32
,
fctx
*
fuse
.
Context
)
(
*
nodefs
.
Inode
,
fuse
.
Status
)
{
func
(
bfroot
*
BigFileRoot
)
Mkdir
(
name
string
,
mode
uint32
,
fctx
*
fuse
.
Context
)
(
_
*
nodefs
.
Inode
,
status
fuse
.
Status
)
{
oid
,
err
:=
zodb
.
ParseOid
(
name
)
if
err
!=
nil
{
log
.
Printf
(
"/bigfile: mkdir %q: not-oid"
,
name
)
...
...
@@ -330,11 +339,23 @@ func (bfroot *BigFileRoot) Mkdir(name string, mode uint32, fctx *fuse.Context) (
return
nil
,
fuse
.
Status
(
syscall
.
EEXIST
)
}
// no - without bfroot lock proceed to load corresponding objects from ZODB
ctx
:=
asctx
(
fctx
)
// not there - without bfroot lock proceed to load corresponding objects from ZODB:
// create new read-only transaction for this bigfile
txn
,
txnCtx
:=
transaction
.
New
(
context
.
Background
())
defer
func
()
{
if
status
!=
fuse
.
OK
{
txn
.
Abort
()
}
}()
// XXX create txn
// create new DB/Connection for this bigfile
// XXX better ctx = transaction.PutIntoContext(ctx, txn)
ctx
,
cancel
:=
xcontext
.
Merge
(
asctx
(
fctx
),
txnCtx
)
defer
cancel
()
zdb
:=
zodb
.
NewDB
(
bfroot
.
zstor
)
zconn
,
err
:=
zdb
.
Open
(
ctx
,
&
zodb
.
ConnOptions
{})
// XXX .NoSync=true ?
if
err
!=
nil
{
...
...
@@ -342,8 +363,6 @@ func (bfroot *BigFileRoot) Mkdir(name string, mode uint32, fctx *fuse.Context) (
return
nil
,
fuse
.
EIO
}
// XXX txn.Abort(), put conn back on error
xzbf
,
err
:=
zconn
.
Get
(
ctx
,
oid
)
if
err
!=
nil
{
switch
errors
.
Cause
(
err
)
.
(
type
)
{
...
...
@@ -383,9 +402,10 @@ func (bfroot *BigFileRoot) Mkdir(name string, mode uint32, fctx *fuse.Context) (
}
bfdata
:=
&
BigFileData
{
Node
:
nodefs
.
NewDefaultNode
(),
zconn
:
zconn
,
zbf
:
zbf
,
Node
:
nodefs
.
NewDefaultNode
(),
txnCtx
:
txnCtx
,
zconn
:
zconn
,
zbf
:
zbf
,
}
bfhead
.
data
=
bfdata
...
...
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