From 365f21970402f5e557824ec8c98e313bc3f75335 Mon Sep 17 00:00:00 2001 From: Aaron Jacobs Date: Tue, 5 May 2015 10:14:54 +1000 Subject: [PATCH] New begin/finish interface. Not yet wired. --- connection.go | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/connection.go b/connection.go index 637c2fe..f0f77ba 100644 --- a/connection.go +++ b/connection.go @@ -85,13 +85,21 @@ func (c *Connection) log( c.logger.Println(msg) } -// Set up state for an op that is about to be returned to the user. -func (c *Connection) beginOp() { +// Set up state for an op that is about to be returned to the user, given its +// bazilfuse request ID. +// +// Return a context that should be used for the op. +func (c *Connection) beginOp(reqID bazilfuse.RequestID) (ctx context.Context) { c.opsInFlight.Add(1) + + // TODO(jacobsa): Use WithCancel and stash a cancellation function. + ctx = c.parentCtx + + return } // Clean up all state associated with an op to which the user has responded. -func (c *Connection) finishOp() { +func (c *Connection) finishOp(reqID bazilfuse.RequestID) { c.opsInFlight.Done() }