diff options
Diffstat (limited to 'infra/translate-api/src/main/java/io')
-rw-r--r-- | infra/translate-api/src/main/java/io/fd/honeycomb/translate/write/Writer.java | 16 | ||||
-rw-r--r-- | infra/translate-api/src/main/java/io/fd/honeycomb/translate/write/registry/WriterRegistry.java | 15 |
2 files changed, 22 insertions, 9 deletions
diff --git a/infra/translate-api/src/main/java/io/fd/honeycomb/translate/write/Writer.java b/infra/translate-api/src/main/java/io/fd/honeycomb/translate/write/Writer.java index e6538012b..1a16b72e6 100644 --- a/infra/translate-api/src/main/java/io/fd/honeycomb/translate/write/Writer.java +++ b/infra/translate-api/src/main/java/io/fd/honeycomb/translate/write/Writer.java @@ -33,7 +33,7 @@ import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; public interface Writer<D extends DataObject> extends SubtreeManager<D> { /** - * Handle update operation. U from CRUD. + * Process modifications and translate them as create/update/delete operations to lower level * * @param id Identifier of data being written * @param dataBefore Old data @@ -41,8 +41,14 @@ public interface Writer<D extends DataObject> extends SubtreeManager<D> { * @param ctx Write context enabling writer to get information about candidate data as well as current data * @throws WriteFailedException if update failed */ - void update(@Nonnull final InstanceIdentifier<? extends DataObject> id, - @Nullable final DataObject dataBefore, - @Nullable final DataObject dataAfter, - @Nonnull final WriteContext ctx) throws WriteFailedException; + void processModification(@Nonnull final InstanceIdentifier<? extends DataObject> id, + @Nullable final DataObject dataBefore, + @Nullable final DataObject dataAfter, + @Nonnull final WriteContext ctx) throws WriteFailedException; + + /** + * Indicates whether there is direct support for updating nodes handled by this writer, + * or they must be broken up to individual deletes and creates. + */ + boolean supportsDirectUpdate(); } diff --git a/infra/translate-api/src/main/java/io/fd/honeycomb/translate/write/registry/WriterRegistry.java b/infra/translate-api/src/main/java/io/fd/honeycomb/translate/write/registry/WriterRegistry.java index 5520c00ec..a297b6de8 100644 --- a/infra/translate-api/src/main/java/io/fd/honeycomb/translate/write/registry/WriterRegistry.java +++ b/infra/translate-api/src/main/java/io/fd/honeycomb/translate/write/registry/WriterRegistry.java @@ -41,12 +41,19 @@ public interface WriterRegistry { * @throws BulkUpdateException in case bulk update fails * @throws TranslationException in case some other error occurs while processing update request */ - void update(@Nonnull DataObjectUpdates updates, - @Nonnull WriteContext ctx) throws TranslationException; + void processModifications(@Nonnull DataObjectUpdates updates, + @Nonnull WriteContext ctx) throws TranslationException; /** - * Simple DTO containing updates for {@link WriterRegistry}. Currently only deletes and updates (create + update) - * are distinguished. + * Indicates direct support for update operation on provided type + * + * @param type data object type + */ + boolean writerSupportsUpdate(@Nonnull InstanceIdentifier<?> type); + + /** + * Simple DTO containing updates for {@link WriterRegistry}. Currently only deletes and updates (create + + * update) are distinguished. */ @Beta final class DataObjectUpdates { |