From: Michael Haggerty Date: Tue, 13 Oct 2015 07:56:09 GMT Subject: Re: [PATCH v3 19/44] refs-be-files.c: add a backend method structure with transaction functions Message-ID: <561CB919.8000801@alum.mit.edu> In-Reply-To: <1444686725-27660-21-git-send-email-dturner@twopensource.com> On 10/12/2015 11:51 PM, David Turner wrote: > From: Ronnie Sahlberg > > Add a ref structure for backend methods. Start by adding a method pointer > for the transaction commit function. > > Add a function set_refs_backend to switch between backends. The files > based backend is the default. > > Signed-off-by: Ronnie Sahlberg > Signed-off-by: David Turner > --- > refs-be-files.c | 10 ++++++++-- > refs.c | 30 ++++++++++++++++++++++++++++++ > refs.h | 15 +++++++++++++++ > 3 files changed, 53 insertions(+), 2 deletions(-) > > [...] > diff --git a/refs.h b/refs.h > index 4940ae9..419abf4 100644 > --- a/refs.h > +++ b/refs.h > @@ -619,4 +619,19 @@ extern int reflog_expire(const char *refname, const unsigned char *sha1, > reflog_expiry_cleanup_fn cleanup_fn, > void *policy_cb_data); > > +/* refs backends */ > +typedef int ref_transaction_commit_fn(struct ref_transaction *transaction, > + struct strbuf *err); > +typedef void ref_transaction_free_fn(struct ref_transaction *transaction); The ref_transaction_free_fn typedef isn't used anywhere. > +struct ref_be { > + struct ref_be *next; > + const char *name; > + ref_transaction_commit_fn *transaction_commit; > +}; > + > + > +extern struct ref_be refs_be_files; I don't think that refs_be_files is needed in the public interface. > +int set_refs_backend(const char *name); > + > #endif /* REFS_H */ Michael -- Michael Haggerty mhagger@alum.mit.edu