88
99from ravendb import constants , exceptions
1010from ravendb .changes .database_changes import DatabaseChanges
11- from ravendb .documents .bulk_insert_operation import BulkInsertOperation
11+ from ravendb .documents .bulk_insert_operation import BulkInsertOperation , BulkInsertOptions
1212from ravendb .documents .operations .executor import MaintenanceOperationExecutor , OperationExecutor
1313from ravendb .documents .operations .indexes import PutIndexesOperation
1414from ravendb .documents .session .event_args import (
@@ -48,12 +48,12 @@ def __init__(self):
4848 self .__conventions = None
4949 self ._initialized : bool = False
5050
51- self .__certificate_pem_path : Union [ None , str ] = None
52- self .__trust_store_path : Union [ None , str ] = None
51+ self .__certificate_pem_path : Optional [ str ] = None
52+ self .__trust_store_path : Optional [ str ] = None
5353
5454 self ._urls : List [str ] = []
55- self ._database : Union [ None , str ] = None
56- self ._disposed : Union [ None , bool ] = None
55+ self ._database : Optional [ str ] = None
56+ self ._disposed : Optional [ bool ] = None
5757
5858 self .__before_store : List [Callable [[BeforeStoreEventArgs ], None ]] = []
5959 self .__after_save_changes : List [Callable [[AfterSaveChangesEventArgs ], None ]] = []
@@ -311,10 +311,11 @@ def __init__(self, urls: Union[str, List[str]] = None, database: Optional[str] =
311311 self .database = database
312312 self .__request_executors : Dict [str , Lazy [RequestExecutor ]] = CaseInsensitiveDict ()
313313 # todo: aggressive cache
314- self .__maintenance_operation_executor : Union [ None , MaintenanceOperationExecutor ] = None
315- self .__operation_executor : Union [ None , OperationExecutor ] = None
314+ self .__maintenance_operation_executor : Optional [ MaintenanceOperationExecutor ] = None
315+ self .__operation_executor : Optional [ OperationExecutor ] = None
316316 # todo: database smuggler
317- self .__identifier : Union [None , str ] = None
317+ self .__multi_db_hilo : Optional [MultiDatabaseHiLoGenerator ] = None
318+ self .__identifier : Optional [str ] = None
318319 self .__add_change_lock = threading .Lock ()
319320 self .__database_changes = {}
320321 self .__after_close : List [Callable [[], None ]] = []
@@ -327,15 +328,19 @@ def __exit__(self, exc_type, exc_val, exc_tb):
327328 self .close ()
328329
329330 @property
330- def thread_pool_executor (self ):
331+ def hilo_id_generator (self ) -> Optional [MultiDatabaseHiLoGenerator ]:
332+ return self .__multi_db_hilo
333+
334+ @property
335+ def thread_pool_executor (self ) -> ThreadPoolExecutor :
331336 return self .__thread_pool_executor
332337
333338 @property
334339 def subscriptions (self ) -> DocumentSubscriptions :
335340 return self .__subscriptions
336341
337342 @property
338- def identifier (self ) -> Union [ None , str ]:
343+ def identifier (self ) -> Optional [ str ]:
339344 if self .__identifier is not None :
340345 return self .__identifier
341346
@@ -520,9 +525,9 @@ def initialize(self) -> DocumentStore:
520525
521526 # todo: aggressively cache
522527
523- def bulk_insert (self , database_name : Optional [ str ] = None ) -> BulkInsertOperation :
528+ def bulk_insert (self , database_name : str = None , options : BulkInsertOptions = None ) -> BulkInsertOperation :
524529 self .assert_initialized ()
525- return BulkInsertOperation (self .get_effective_database (database_name ), self )
530+ return BulkInsertOperation (self .get_effective_database (database_name ), self , options )
526531
527532 def _assert_valid_configuration (self ) -> None :
528533 if not self .urls :
0 commit comments