-
Notifications
You must be signed in to change notification settings - Fork 32
Description
Environment
- DiffSync version: 1.0.0
Currently, to add bulk write operations to a DiffSync subclass object, one has to override the "sync_from" function on super(). This is in contrast to each individual DiffSyncModel's create(), update(), and delete() methods which are more idempotent in manner, and called by the "sync_from()" method on super.
Proposed Functionality
It may be beneficial to be able to leave the downstream create(), update(), and delete() DiffSyncModel methods which are called by "sync_from" by default unimplemented and add a write() method to the DiffSync class. This would provide a framework for bulk write operations, without blowing away the logic implemented on "sync_from()"
Use Case
class BackendYAML(DiffSync):
def write(self, source):
"""Bulk write operation to dump data to disk from another backend
Called automatically by super().sync_from()
Args:
source (DiffSync): DiffSync object from which data is being synchronized
"""
# Validate whether or not any changes need to be made to the circuits/providers files
self._write_providers_from(source)
self._write_circuits_from(source)