Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
J
jacobsa-fuse
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
Kirill Smelkov
jacobsa-fuse
Commits
ea5acc6f
Commit
ea5acc6f
authored
May 05, 2015
by
Aaron Jacobs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
commonOp.init
parent
ccde3b5c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
9 deletions
+18
-9
fuseops/common_op.go
fuseops/common_op.go
+18
-9
No files found.
fuseops/common_op.go
View file @
ea5acc6f
...
...
@@ -38,6 +38,9 @@ var fTraceByPID = flag.Bool(
// A helper for embedding common behavior.
type
commonOp
struct
{
// The context exposed to the user.
ctx
context
.
Context
// The op in which this struct is embedded.
op
Op
...
...
@@ -48,9 +51,6 @@ type commonOp struct {
// argument is a call depth.
log
func
(
int
,
string
,
...
interface
{})
// The context exposed to the user.
ctx
context
.
Context
// A function that is invoked with the error given to Respond, for use in
// closing off traces and reporting back to the connection.
finish
func
(
error
)
...
...
@@ -156,18 +156,27 @@ func (o *commonOp) init(
op
Op
,
bazilReq
bazilfuse
.
Request
,
log
func
(
int
,
string
,
...
interface
{}),
opsInFlight
*
sync
.
WaitGroup
)
{
// Set up a context that reflects per-PID tracing if appropriate.
ctx
=
o
.
maybeTraceByPID
(
ctx
,
int
(
bazilReq
.
Hdr
()
.
Pid
))
finish
func
(
error
))
{
// Initialize basic fields.
o
.
ctx
=
ctx
o
.
op
=
op
o
.
bazilReq
=
bazilReq
o
.
log
=
log
o
.
opsInFlight
=
opsInFlight
o
.
finish
=
finish
// Set up a context that reflects per-PID tracing if appropriate.
o
.
ctx
=
o
.
maybeTraceByPID
(
o
.
ctx
,
int
(
bazilReq
.
Hdr
()
.
Pid
))
// Set up a trace span for this op.
o
.
ctx
,
o
.
report
=
reqtrace
.
StartSpan
(
ctx
,
o
.
op
.
ShortDesc
())
var
reportForTrace
reqtrace
.
ReportFunc
o
.
ctx
,
reportForTrace
=
reqtrace
.
StartSpan
(
ctx
,
o
.
op
.
ShortDesc
())
// When the op is finished, report to both reqtrace and the connection.
prevFinish
:=
o
.
finish
o
.
finish
=
func
(
err
error
)
{
reportForTrace
(
err
)
prevFinish
(
err
)
}
}
func
(
o
*
commonOp
)
Header
()
OpHeader
{
...
...
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