[asterisk-dev] [Code Review] 2715: Bucket: A generic file and directory API

Mark Michelson reviewboard at asterisk.org
Mon Aug 19 12:45:10 CDT 2013


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviewboard.asterisk.org/r/2715/#review9434
-----------------------------------------------------------


I am not a fan of having to include the uriparser as a dependency. The biggest reason is that this introduces a prerequisite for a core feature that is not actually used anywhere in Asterisk.

I also just don't think it's necessary. The only URI parsing that really should be necessary is to separate the scheme from the rest of the URI. Right now, when allocating a bucket or bucket file, you grab the last element of the path to use as the bucket or bucket file name. I don't see the point in doing this because:

1) I don't foresee a situation where just the final path element will be useful to a scheme. I'm betting that the full path (or heck, even the full URI) will be much more useful.
2) It's possible to have multiple buckets with identical names within the same scheme. This means that in order to differentiate buckets (in, say, debug messages), you'll have to use the full URI.
3) The bucket->name and file->name are never referenced in the core bucket code except to set the values.

I say that if you want to store anything other than the scheme of a URI in a bucket or bucket file, then just store everything after the ':' or '://' in the name field so the individual scheme implementations can do what they need with the data. However, even that's not really necessary since the full URI is retrievable via ast_sorcery_object_get_id().

- Mark Michelson


On Aug. 19, 2013, 3:54 p.m., Joshua Colp wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviewboard.asterisk.org/r/2715/
> -----------------------------------------------------------
> 
> (Updated Aug. 19, 2013, 3:54 p.m.)
> 
> 
> Review request for Asterisk Developers.
> 
> 
> Repository: Asterisk
> 
> 
> Description
> -------
> 
> Bucket is a generic file and directory API implemented as a thin wrapper over sorcery. It decouples the storage of files from the backend and provides the ability to set metadata on file themselves. What it means to have files in a "bucket" and details about the files themselves is left up to the user of the bucket API. It enforces no restrictions. Identification of things is done using URIs, which include a scheme. Modules implement specific schemes (local, for example) and take care of the implementation specific aspect of it. The ability to get bucket and file information in a JSON format is provided, as is the ability to copy and move files.
> 
> Stuff to focus on:
> 
> 1. Is the API sane and complete?
> 2. Do the unit tests cover everything?
> 3. What do we want to do for URI parsing - I wrote a basic extremely optimistic one
> 
> 
> Diffs
> -----
> 
>   /trunk/main/bucket.c PRE-CREATION 
>   /trunk/main/asterisk.c 396929 
>   /trunk/main/Makefile 396929 
>   /trunk/include/asterisk/config_options.h 396929 
>   /trunk/include/asterisk/bucket.h PRE-CREATION 
>   /trunk/include/asterisk/autoconfig.h.in 396929 
>   /trunk/configure.ac 396929 
>   /trunk/configure UNKNOWN 
>   /trunk/build_tools/menuselect-deps.in 396929 
>   /trunk/main/config_options.c 396929 
>   /trunk/main/sorcery.c 396929 
>   /trunk/makeopts.in 396929 
>   /trunk/tests/test_bucket.c PRE-CREATION 
> 
> Diff: https://reviewboard.asterisk.org/r/2715/diff/
> 
> 
> Testing
> -------
> 
> Ran unit tests, confirmed functional. Tweaked this to purposely break and confirmed they broke.
> 
> 
> Thanks,
> 
> Joshua Colp
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20130819/f612f1d2/attachment.htm>


More information about the asterisk-dev mailing list