Hello Victor :)

> Do you ask us our opinion on the Python API that you propose? Or if
the whole feature is worth it?

Latter must be done first :)


> Can you please show me a short full example opening a database with
automatic snapshot recovery (with your proposed API)?

The following codes are demonstrating how the user sets the gdbm file to be
able to use the crash tolerance feature.

import dbm.gnu as dbm

db = dbm.open('x.db', 'nx') # For extension format
db.gdbm_failure_atomic('even_snapshot.bin', 'odd_snapshot.bin') # For
snapshot declaration
for k, v in zip('abcdef', 'ghijkl'):
    db[k] = v

db.sync()
db.close()


The recovery task will be done separately because this situation is a
very special case.

import dbm.gnu as dbm

latest_snapshot = dbm.gdbm_latest_snapshot('even_snapshot.bin',
'odd_snapshot.bin')

db = dbm.open(latest_snapshot, 'r') # Open the latest valid snapshot

# Do what user want, os.rename(latest_snapshot, 'x.db') whatever.


Warm regards,

Dong-hee


2022년 1월 18일 (화) 오후 6:57, Victor Stinner <vstin...@python.org>님이 작성:

> Hi Dong-hee,
>
> Can you please show me a short full example opening a database with
> automatic snapshop recovery (with your proposed API)?
>
> Do you ask us our opinion on the Python API that you propose? Or if
> the whole feature is worth it?
>
> Victor
>
> On Tue, Jan 18, 2022 at 2:41 AM Dong-hee Na <donghee...@python.org> wrote:
> >
> > Hi folks,
> > From gdbm 1.21, gdbm supports the crash tolerance feature.
> > see: https://www.gnu.org.ua/software/gdbm/manual/Crash-Tolerance.html
> >
> > I would like to introduce this feature since python standard library is
> the only gdbm binding library that is available for end-users.
> > And this is also effort for end-users to provide the latest new features.
> > If this feature is added following methods will be added.
> >   - 'x' flag will be added for extended gdbm format.
> >   - gdbm.gdbm_failure_atomic('path1', 'path2') API will be added for
> snapshot paths.
> >   - gdbm.gdbm_latest_snapshot('path1', 'path2') API will be added for
> getting latest valid snapshot path.
> >
> > The above APIs will be used for people who need to recover their gdbm
> file if disaster situations happen.
> > However, this feature is not yet decided to land to CPython.
> > and we have already discussed this issue at
> https://bugs.python.org/issue45452
> > but I would like to hear other devs opinions.
> >
> > I cc the original authors of this feature and Serhiy who thankfully
> already participated in this discussion too :)
> >
> > Warm Regards,
> > Dong-hee
> > _______________________________________________
> > Python-Dev mailing list -- python-dev@python.org
> > To unsubscribe send an email to python-dev-le...@python.org
> > https://mail.python.org/mailman3/lists/python-dev.python.org/
> > Message archived at
> https://mail.python.org/archives/list/python-dev@python.org/message/RFICESJKJW3KZSHYSU4R7UEPUUAJL2B3/
> > Code of Conduct: http://python.org/psf/codeofconduct/
>
>
>
> --
> Night gathers, and now my watch begins. It shall not end until my death.
>
_______________________________________________
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/python-dev@python.org/message/YFDEPBDWRF35DWFSA4ZE6N2FOCLAUO2U/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to