Extending VFS documentation

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Extending VFS documentation

Philip Bennefall
Hi all,

I have been interested in the VFS layer of SqLite for a while, and found
the following article to be very useful:

http://www.sqlite.org/vfs.html

However, it ends right when it is about to go into the actual details of
how to implement a VFS. It would be great if that essay could be
completed. I
have looked at the example VFS implementations, but it is hard to
determine which parts of the code that are implementation details as
opposed to being
part of the stable public API so to speak.

Kind regards,

Philip Bennefall
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: Extending VFS documentation

Jeffrey Mattox
I searched stack overflow for "sqlite3_vfs_register" and got a few hits.  For example, this was a good starting point on which I based my own VFS.

     http://stackoverflow.com/a/3842409/236415

Jeff


> On May 24, 2015, at 4:39 AM, Philip Bennefall <[hidden email]> wrote:
>
> Hi all,
>
> I have been interested in the VFS layer of SqLite for a while, and found the following article to be very useful:
>
> http://www.sqlite.org/vfs.html
>
> However, it ends right when it is about to go into the actual details of how to implement a VFS. It would be great if that essay could be completed. I
> have looked at the example VFS implementations, but it is hard to determine which parts of the code that are implementation details as opposed to being
> part of the stable public API so to speak.
>
> Kind regards,
>
> Philip Bennefall
>

_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: Extending VFS documentation

Roger Binns
In reply to this post by Philip Bennefall
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 05/24/2015 02:39 AM, Philip Bennefall wrote:
> I have looked at the example VFS implementations, but it is hard
> to determine which parts of the code that are implementation
> details as opposed to being part of the stable public API so to
> speak.

The answer is that it matters what you are exposing.  A vfs for a csv
file is a very different beast that one exposing bits of Amazon's
services.  I wrote one that exposes couchdb, but it wouldn't help
someone else exposing something different.

What I recommend you do is use one of the higher level languages that
exposes the VFS in their SQLite bindings.  You will get better error
messages, be able to write the code quicker, and explore behaviour
easier (eg xBestIndex).  ie you'll get a better on the VFS specific
issues, rather than having to build out C level plumbing.  Once you
have that understood, converting to C is simpler than having started
with C.

For example my Python wrapper (APSW) exposes the VFS, along with an
example and documentation.  It also easily lets you "inherit" from an
existing VFS so you only have to write methods where you want
different behaviour (eg mangling file names, or modifying how the
database file contents are stored).

  http://rogerbinns.github.io/apsw/vfs.html

You should find similar bindings in your higher level languages of choice.

Roger
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1

iEUEARECAAYFAlViNrAACgkQmOOfHg372QRrrQCYxRX6XbpyS39O5V+tJyyjXjx6
vACgxZ/Uu+TDvT22u1FN083YFMu2muc=
=wo2G
-----END PGP SIGNATURE-----
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: Extending VFS documentation

Philip Bennefall
Hi Roger,

For experimentation, I definitely agree that using a higher level
language is better. What I am after is an authoritative source for exact
behavior of the various functions, what different errors they may return
and what the ramifications of not implementing various methods are, etc
etc. There is some information of that nature in the reference, but it
would be ideal if the article on the sqLite website itself would be
completed as that would eliminate some guesswork. The rest of the sqLite
documentation, and indeed the beginning of the VFS article, is
excellent. It allows me to implement things immediately without having
to search third party sources and hack around to find what works and
what doesn't. It would be ideal if the same could be true for the VFS layer.

Kind regards,

Philip Bennefall
On 5/24/2015 10:38 PM, Roger Binns wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> On 05/24/2015 02:39 AM, Philip Bennefall wrote:
>> I have looked at the example VFS implementations, but it is hard
>> to determine which parts of the code that are implementation
>> details as opposed to being part of the stable public API so to
>> speak.
> The answer is that it matters what you are exposing.  A vfs for a csv
> file is a very different beast that one exposing bits of Amazon's
> services.  I wrote one that exposes couchdb, but it wouldn't help
> someone else exposing something different.
>
> What I recommend you do is use one of the higher level languages that
> exposes the VFS in their SQLite bindings.  You will get better error
> messages, be able to write the code quicker, and explore behaviour
> easier (eg xBestIndex).  ie you'll get a better on the VFS specific
> issues, rather than having to build out C level plumbing.  Once you
> have that understood, converting to C is simpler than having started
> with C.
>
> For example my Python wrapper (APSW) exposes the VFS, along with an
> example and documentation.  It also easily lets you "inherit" from an
> existing VFS so you only have to write methods where you want
> different behaviour (eg mangling file names, or modifying how the
> database file contents are stored).
>
>    http://rogerbinns.github.io/apsw/vfs.html
>
> You should find similar bindings in your higher level languages of choice.
>
> Roger
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1
>
> iEUEARECAAYFAlViNrAACgkQmOOfHg372QRrrQCYxRX6XbpyS39O5V+tJyyjXjx6
> vACgxZ/Uu+TDvT22u1FN083YFMu2muc=
> =wo2G
> -----END PGP SIGNATURE-----
> .
>

_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: Extending VFS documentation

Philip Bennefall
In reply to this post by Jeffrey Mattox
Thanks, Jeff. That's an interesting project; redirecting to iostream.
I'm sure it'll be useful, though an authoritative source for
documentation on the SqLite website itself would be ideal. The methods
themselves and their arguments seem easy enough; my main concern is what
error codes I may return when, etc.

Kind regards,

Philip Bennefall
On 5/24/2015 6:19 PM, Jeff M wrote:

> I searched stack overflow for "sqlite3_vfs_register" and got a few hits.  For example, this was a good starting point on which I based my own VFS.
>
>       http://stackoverflow.com/a/3842409/236415
>
> Jeff
>
>
>> On May 24, 2015, at 4:39 AM, Philip Bennefall <[hidden email]> wrote:
>>
>> Hi all,
>>
>> I have been interested in the VFS layer of SqLite for a while, and found the following article to be very useful:
>>
>> http://www.sqlite.org/vfs.html
>>
>> However, it ends right when it is about to go into the actual details of how to implement a VFS. It would be great if that essay could be completed. I
>> have looked at the example VFS implementations, but it is hard to determine which parts of the code that are implementation details as opposed to being
>> part of the stable public API so to speak.
>>
>> Kind regards,
>>
>> Philip Bennefall
>>
> .
>

_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users