GH-1426: Improve handling of Broker data store creation failures

Broker::create_master() and Broker::create_clone() now return
a valid value even when there's a failure to open the backend database
(e.g. SQLite filesystem error).  In that case, the returned value can
still be passed into other data store operations, but they'll fail
immediately with an error.  Broker::is_closed() can now also be used to
determine whether the data store creation calls failed.
This commit is contained in:
Jon Siwek 2021-03-05 23:28:57 -08:00
parent 6946cffde2
commit 6af436aad3
8 changed files with 138 additions and 14 deletions

View file

@ -78,7 +78,9 @@ export {
##
## options: tunes how some storage backends operate.
##
## Returns: a handle to the data store.
## Returns: a handle to the data store for which a subsequent call to
## :zeek:see:`Broker::is_closed` will return true if the store
## could not be created/opened.
global create_master: function(name: string, b: BackendType &default = MEMORY,
options: BackendOptions &default = BackendOptions()): opaque of Broker::Store;
@ -111,7 +113,9 @@ export {
## acknowledged by the master. A negative/zero
## value indicates that commands never buffer.
##
## Returns: a handle to the data store.
## Returns: a handle to the data store for which a subsequent call to
## :zeek:see:`Broker::is_closed` will return true if the store
## could not be created/opened.
global create_clone: function(name: string,
resync_interval: interval &default = default_clone_resync_interval,
stale_interval: interval &default = default_clone_stale_interval,