Commit 79980199 authored by Jan Včelák's avatar Jan Včelák 🚀

updates: weaker dependency on zone

parent d0eb49cc
......@@ -391,19 +391,14 @@ int apply_prepare_to_sign(apply_ctx_t *ctx)
return zone_contents_adjust_pointers(ctx->contents);
}
int apply_changesets(apply_ctx_t *ctx, zone_t *zone, list_t *chsets,
zone_contents_t **new_contents)
int apply_changesets(apply_ctx_t *ctx, zone_contents_t *old_contents,
list_t *chsets, zone_contents_t **new_contents)
{
if (ctx == NULL || zone == NULL || chsets == NULL ||
if (ctx == NULL || old_contents == NULL || chsets == NULL ||
EMPTY_LIST(*chsets) || new_contents == NULL) {
return KNOT_EINVAL;
}
zone_contents_t *old_contents = zone->contents;
if (!old_contents) {
return KNOT_EINVAL;
}
zone_contents_t *contents_copy = NULL;
int ret = apply_prepare_zone_copy(old_contents, &contents_copy);
if (ret != KNOT_EOK) {
......@@ -436,15 +431,10 @@ int apply_changesets(apply_ctx_t *ctx, zone_t *zone, list_t *chsets,
return KNOT_EOK;
}
int apply_changeset(apply_ctx_t *ctx, zone_t *zone, changeset_t *ch,
zone_contents_t **new_contents)
int apply_changeset(apply_ctx_t *ctx, zone_contents_t *old_contents,
changeset_t *ch, zone_contents_t **new_contents)
{
if (ctx == NULL || zone == NULL || ch == NULL || new_contents == NULL) {
return KNOT_EINVAL;
}
zone_contents_t *old_contents = zone->contents;
if (!old_contents) {
if (ctx == NULL || old_contents == NULL || ch == NULL || new_contents == NULL) {
return KNOT_EINVAL;
}
......
......@@ -24,7 +24,7 @@
#pragma once
#include "knot/zone/zone.h"
#include "knot/zone/contents.h"
#include "knot/updates/changesets.h"
#include "contrib/ucw/lists.h"
......@@ -105,26 +105,26 @@ int apply_prepare_to_sign(apply_ctx_t *ctx);
/*!
* \brief Applies changesets to a shallow zone-copy.
*
* \param zone Zone to be updated.
* \param old_contents Zone to be updated.
* \param chsets List of changesets to be applied.
* \param new_contents Storage for the new zone contents pointer.
*
* \return KNOT_E*
*/
int apply_changesets(apply_ctx_t *ctx, zone_t *zone, list_t *chsets,
zone_contents_t **new_contents);
int apply_changesets(apply_ctx_t *ctx, zone_contents_t *old_contents,
list_t *chsets, zone_contents_t **new_contents);
/*!
* \brief Applies changeset to a shallow zone-copy.
*
* \param zone Zone to be updated.
* \param old_contents Zone to be updated.
* \param ch Changeset to be applied.
* \param new_contents Storage for the new zone contents pointer.
*
* \return KNOT_E*
*/
int apply_changeset(apply_ctx_t *ctx, zone_t *zone, changeset_t *ch,
zone_contents_t **new_contents);
int apply_changeset(apply_ctx_t *ctx, zone_contents_t *old_contents,
changeset_t *ch, zone_contents_t **new_contents);
/*!
* \brief Applies changesets directly to the zone, without copying it.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment