[pve-devel] [PATCH v7 pve-storage 02/10] Basic FreeNAS API interaction code

Michael Rasmussen mir at datanom.net
Wed Jun 28 22:23:53 CEST 2017


Hi Fabian,

On Wed, 21 Jun 2017 15:58:13 +0200
Fabian Grünbichler <f.gruenbichler at proxmox.com> wrote:

> 
> high level question #1: how do you guarantee that inbetween pagination
> requests, the underlying lists/.. on the freenas side don't change
> because of concurrent actions?
> 
> getting outdated information altogether is probably fine (as in, you
> can't expect not to sometimes get it). but since the result is
> potentially a list, it might contain duplicates unless there is some
> mechanism on the freenas side preventing the following:
> 
> - request for first page, with last element "foo" returned
> - concurrent request adding element "bar", which is sorted before
>   element "foo" according to whatever criteria is used to generate the
>   pagination
> - request for second page, with first element "foo" returned
> 
> end result: we don't know about "bar", but we get "foo" twice
> 

Obviously, I can give no guarantee but I assume that the API behaves
properly. No evidence so far profes me wrong.

> 
> high level question #2: does the FreeNAS API return non-JSON apart from
> error cases? I am not sure whether the mix and match between lists and
> strings below is really necessary..
> 

The API only returns JSON. Error cases are covered by status codes. The
reason for dealing with strings is to be prepared to deal with errors
not coming from the API - eg. nginx (the webserver), bugs etc.

> 
> high level question #3: why not introduce wrappers for get, post, put and
> delete? e.g.,
> 

A good idea. Why did I not think about that ;-)


PS. You keep complaining about using this stile:
do unless something and do if something
and want this stile instead:
if not something do and if something do

In my book your stile is bad Perl which is more C or Java stile instead.
This is something that old Perl programmers will agree to (I consider
myself an old Perl programmer since I have been writing Perl for more
than 25 years). Since you are the gate keeper to the Proxmox code base
I will of course change it - but with objections! ;-)

-- 
Hilsen/Regards
Michael Rasmussen

Get my public GnuPG keys:
michael <at> rasmussen <dot> cc
http://pgp.mit.edu:11371/pks/lookup?op=get&search=0xD3C9A00E
mir <at> datanom <dot> net
http://pgp.mit.edu:11371/pks/lookup?op=get&search=0xE501F51C
mir <at> miras <dot> org
http://pgp.mit.edu:11371/pks/lookup?op=get&search=0xE3E80917
--------------------------------------------------------------
/usr/games/fortune -es says:
The root of all superstition is that men observe when a thing hits,
but not when it misses.
		-- Francis Bacon
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://lists.proxmox.com/pipermail/pve-devel/attachments/20170628/95bf895f/attachment.sig>


More information about the pve-devel mailing list