[Xapian-tickets] [Xapian] #504: Add is_closed() to Database class
Xapian
nobody at xapian.org
Wed Aug 25 10:33:34 BST 2010
#504: Add is_closed() to Database class
-------------------------+--------------------------------------------------
Reporter: jcassee | Owner: olly
Type: enhancement | Status: new
Priority: normal | Milestone:
Component: Library API | Version:
Severity: minor | Keywords:
Blockedby: | Platform: All
Blocking: |
-------------------------+--------------------------------------------------
Comment(by jcassee):
I meant 'dire' in a tongue-in-cheek way. I was reacting to the "this may
happen or that may happen, and you will not know which one" feel of the
text. I agree with [comment:1 Olly] that the behaviour is consistent and
necessary for performance reasons. It is something I had to think about,
though, and I thought "let's just not use the database when it is closed".
A search function that uses Xapian will be a relatively expensive action,
and in that case a check whether the database is still open is relatively
cheap. I was thinking that such function would have to keep a 'database is
closed' flag if it were interested in that fact. And then I thought, what
code knows better whether the database is closed than the database itself?
Why would I not be able to ask the database whether it is closed?
I may have come on a bit strong in my ticket description, sorry. The lack
of an `is_closed()` method seemed an oversight, but I had not considered
that even a small change means an investment of your time and must add
real value.
A suggestion to improve the documentation of the `close()` method would be
to reduce the 'heavyness' of the second half:
"After this call, calls made to methods of the database will either behave
exactly as they would have done if the database had not been closed (if
the method uses cached data) or raise a Xapian::DatabaseError indicating
that the database is closed."
Too much information here indicates that the caller must be very cautious,
which is not the case.
--
Ticket URL: <http://trac.xapian.org/ticket/504#comment:3>
Xapian <http://xapian.org/>
Xapian
More information about the Xapian-tickets
mailing list