deltas: Stub out a few more opcodes

This commit is contained in:
Colin Walters 2015-01-29 17:54:59 -05:00
parent 8fb29c9e5d
commit 7aea18cf0d
2 changed files with 90 additions and 0 deletions

View File

@ -135,6 +135,7 @@ typedef enum {
OSTREE_STATIC_DELTA_OP_OPEN_SPLICE_AND_CLOSE = 'S', OSTREE_STATIC_DELTA_OP_OPEN_SPLICE_AND_CLOSE = 'S',
OSTREE_STATIC_DELTA_OP_OPEN = 'o', OSTREE_STATIC_DELTA_OP_OPEN = 'o',
OSTREE_STATIC_DELTA_OP_WRITE = 'w', OSTREE_STATIC_DELTA_OP_WRITE = 'w',
OSTREE_STATIC_DELTA_OP_SET_READ_SOURCE = 'R',
OSTREE_STATIC_DELTA_OP_CLOSE = 'c' OSTREE_STATIC_DELTA_OP_CLOSE = 'c'
} OstreeStaticDeltaOpCode; } OstreeStaticDeltaOpCode;

View File

@ -83,6 +83,10 @@ typedef struct {
GError **error); GError **error);
OPPROTO(open_splice_and_close) OPPROTO(open_splice_and_close)
OPPROTO(open)
OPPROTO(write)
OPPROTO(set_read_source)
OPPROTO(close)
#undef OPPROTO #undef OPPROTO
static gboolean static gboolean
@ -223,6 +227,22 @@ _ostree_static_delta_part_execute_raw (OstreeRepo *repo,
if (!dispatch_open_splice_and_close (repo, state, cancellable, error)) if (!dispatch_open_splice_and_close (repo, state, cancellable, error))
goto out; goto out;
break; break;
case OSTREE_STATIC_DELTA_OP_OPEN:
if (!dispatch_open (repo, state, cancellable, error))
goto out;
break;
case OSTREE_STATIC_DELTA_OP_WRITE:
if (!dispatch_write (repo, state, cancellable, error))
goto out;
break;
case OSTREE_STATIC_DELTA_OP_SET_READ_SOURCE:
if (!dispatch_set_read_source (repo, state, cancellable, error))
goto out;
break;
case OSTREE_STATIC_DELTA_OP_CLOSE:
if (!dispatch_close (repo, state, cancellable, error))
goto out;
break;
default: default:
g_set_error (error, G_IO_ERROR, G_IO_ERROR_INVALID_ARGUMENT, g_set_error (error, G_IO_ERROR, G_IO_ERROR_INVALID_ARGUMENT,
"Unknown opcode %u at offset %u", opcode, n_executed); "Unknown opcode %u at offset %u", opcode, n_executed);
@ -533,3 +553,72 @@ dispatch_open_splice_and_close (OstreeRepo *repo,
g_prefix_error (error, "opcode open-splice-and-close: "); g_prefix_error (error, "opcode open-splice-and-close: ");
return ret; return ret;
} }
static gboolean
dispatch_open (OstreeRepo *repo,
StaticDeltaExecutionState *state,
GCancellable *cancellable,
GError **error)
{
gboolean ret = FALSE;
if (!open_output_target (state, cancellable, error))
goto out;
ret = TRUE;
out:
if (!ret)
g_prefix_error (error, "opcode open: ");
return ret;
}
static gboolean
dispatch_write (OstreeRepo *repo,
StaticDeltaExecutionState *state,
GCancellable *cancellable,
GError **error)
{
gboolean ret = FALSE;
g_assert_not_reached ();
ret = TRUE;
/* out: */
if (!ret)
g_prefix_error (error, "opcode open-splice-and-close: ");
return ret;
}
static gboolean
dispatch_set_read_source (OstreeRepo *repo,
StaticDeltaExecutionState *state,
GCancellable *cancellable,
GError **error)
{
gboolean ret = FALSE;
g_assert_not_reached ();
ret = TRUE;
/* out: */
if (!ret)
g_prefix_error (error, "opcode open-splice-and-close: ");
return ret;
}
static gboolean
dispatch_close (OstreeRepo *repo,
StaticDeltaExecutionState *state,
GCancellable *cancellable,
GError **error)
{
gboolean ret = FALSE;
g_assert_not_reached ();
ret = TRUE;
/* out: */
if (!ret)
g_prefix_error (error, "opcode open-splice-and-close: ");
return ret;
}