From: Tony Asleson <tasleson@redhat.com>
To: lvm-devel@redhat.com
Subject: [PATCH 1/2] lvm2app: Add thin and thin pool lv creation
Date: Thu, 28 Feb 2013 14:33:22 -0600 [thread overview]
Message-ID: <512FBF12.30803@redhat.com> (raw)
In-Reply-To: <512F7928.80209@redhat.com>
On 02/28/2013 09:35 AM, Zdenek Kabelac wrote:
> As you could see yourself - it's getting to be a lvm2api user's problem
> to figure out, how to actually create a specific LV - API user would
> need to scan number of 'lvcreate' function and try to figure out which
> function to call, instead of having single call with 'lvcreate_params'
> - so IMHO I'd prefer to avoid creating this 'array' of 'simple'
> interfaces even though all those functions could be possible later
> turned into wrappers calling one universal function - but why not start
> directly with the proper way.
Obviously there are pros and cons to either approach. In my opinion
having a single function call that takes 20 parameters is no easier to
use than a 20 separate function calls. The complexity is present in both.
In my opinion it would be useful to have a simple function that
satisfies 90% of what most users use and then have one or two addition
functions that satisfy the other corner cases.
To date I believe the following options have been proposed (please correct):
1. Separate functions with varying amounts of increased functionality
2. One function that does everything
a. Expose large structure for parameters
b. Expose string with one or parameters embedded in it
c. Set/get functions on an opaque data structure which en-composes all
the options (eg. getsockopt/setsockopt)
I believe that whatever we choose needs to be able to accommodate future
change as new things will be added over time.
For each of these options I see the following concerns:
1. No one seems particularly interested in this option, but it would
work. Downside is big name space and complexity of figuring out which
one you want.
2a. Exposing a large structure has the problem of how you extend it over
time. Do you create a new structure and create a new function that
takes that new structure or do you pass a void type with a size and
select the structure based on size etc. Once you expose it, it can
never change.
2b. Using a string for parameters introduces a different set of issues.
The client needs to be able to correctly create the string. The
library needs to parse the string. You lose type safety and you don't
know until run-time that the parameters are correct/incorrect.
2c. This option requires more code, but allows you to change the
implementation of the API and allows you to extend the API easily.
Obviously it is easy to see that I favor option 2c. This is also the
suggested way by others as well (https://github.com/shepjeng/libabc).
Comments?
Regards,
Tony
next prev parent reply other threads:[~2013-02-28 20:33 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-02-12 17:24 [PATCH V3 0/2] Add thin lv and thin pool creation support M. Mohan Kumar
2013-02-12 17:24 ` [PATCH 1/2] lvm2app: Add thin and thin pool lv creation M. Mohan Kumar
2013-02-25 19:45 ` Zdenek Kabelac
2013-02-28 11:22 ` M. Mohan Kumar
2013-02-28 15:35 ` Zdenek Kabelac
2013-02-28 20:33 ` Tony Asleson [this message]
2013-02-28 21:57 ` Zdenek Kabelac
2013-04-25 23:14 ` Tony Asleson
2013-04-26 0:11 ` Andy Grover
2013-02-12 17:24 ` [PATCH 2/2] master - thin: Add low water mark parameter to pool creation M. Mohan Kumar
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=512FBF12.30803@redhat.com \
--to=tasleson@redhat.com \
--cc=lvm-devel@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.