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
18af108b
Commit
18af108b
authored
May 01, 2015
by
Aaron Jacobs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added reqtrace spans for fuse ops.
parent
cf9ed934
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
1 deletion
+12
-1
fuseops/common_op.go
fuseops/common_op.go
+12
-1
No files found.
fuseops/common_op.go
View file @
18af108b
...
...
@@ -19,16 +19,18 @@ import (
"sync"
"github.com/jacobsa/bazilfuse"
"github.com/jacobsa/reqtrace"
"golang.org/x/net/context"
)
// A helper for embedding common behavior.
type
commonOp
struct
{
opType
string
ctx
context
.
Context
opType
string
r
bazilfuse
.
Request
log
func
(
int
,
string
,
...
interface
{})
opsInFlight
*
sync
.
WaitGroup
report
reqtrace
.
ReportFunc
}
func
describeOpType
(
t
reflect
.
Type
)
(
desc
string
)
{
...
...
@@ -42,11 +44,15 @@ func (o *commonOp) init(
r
bazilfuse
.
Request
,
log
func
(
int
,
string
,
...
interface
{}),
opsInFlight
*
sync
.
WaitGroup
)
{
// Initialize basic fields.
o
.
opType
=
describeOpType
(
opType
)
o
.
ctx
=
context
.
Background
()
o
.
r
=
r
o
.
log
=
log
o
.
opsInFlight
=
opsInFlight
// Set up a trace span for this op.
o
.
ctx
,
o
.
report
=
reqtrace
.
StartSpan
(
o
.
ctx
,
o
.
opType
)
}
func
(
o
*
commonOp
)
Header
()
OpHeader
{
...
...
@@ -71,6 +77,8 @@ func (o *commonOp) respondErr(err error) {
panic
(
"Expect non-nil here."
)
}
o
.
report
(
err
)
o
.
Logf
(
"-> (%s) error: %v"
,
o
.
opType
,
...
...
@@ -84,6 +92,9 @@ func (o *commonOp) respondErr(err error) {
//
// Special case: nil means o.r.Respond accepts no parameters.
func
(
o
*
commonOp
)
respond
(
resp
interface
{})
{
// We were successful.
o
.
report
(
nil
)
// Find the Respond method.
v
:=
reflect
.
ValueOf
(
o
.
r
)
respond
:=
v
.
MethodByName
(
"Respond"
)
...
...
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