From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lj1-f195.google.com (mail-lj1-f195.google.com [209.85.208.195]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id 57F954696C6 for ; Tue, 28 Apr 2020 19:14:56 +0300 (MSK) Received: by mail-lj1-f195.google.com with SMTP id b2so22052582ljp.4 for ; Tue, 28 Apr 2020 09:14:56 -0700 (PDT) From: Cyrill Gorcunov Date: Tue, 28 Apr 2020 19:11:35 +0300 Message-Id: <20200428161137.20536-16-gorcunov@gmail.com> In-Reply-To: <20200428161137.20536-1-gorcunov@gmail.com> References: <20200428161137.20536-1-gorcunov@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [Tarantool-patches] [PATCH 15/17] recovery: provide throwable wrappers List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: tml Signed-off-by: Cyrill Gorcunov --- src/box/recovery.h | 53 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) diff --git a/src/box/recovery.h b/src/box/recovery.h index e8ac3198a..f085522db 100644 --- a/src/box/recovery.h +++ b/src/box/recovery.h @@ -102,6 +102,59 @@ recover_remaining_wals(struct recovery *r, struct xstream *stream, #if defined(__cplusplus) } /* extern "C" */ + +#include "exception.h" + +static inline struct recovery * +recovery_new_xc(const char *wal_dirname, bool force_recovery, + const struct vclock *vclock) +{ + struct recovery *r; + + r = recovery_new(wal_dirname, force_recovery, vclock); + if (r == NULL) + diag_raise(); + return r; +} + +static inline void +recovery_scan_xc(struct recovery *r, struct vclock *end_vclock, + struct vclock *gc_vclock) +{ + if (recovery_scan(r, end_vclock, gc_vclock)) + diag_raise(); +} + +static inline void +recover_remaining_wals_xc(struct recovery *r, struct xstream *stream, + const struct vclock *stop_vclock, bool scan_dir) +{ + if (recover_remaining_wals(r, stream, stop_vclock, scan_dir)) + diag_raise(); +} + +static inline void +recovery_follow_local_xc(struct recovery *r, struct xstream *stream, + const char *name, ev_tstamp wal_dir_rescan_delay) +{ + if (recovery_follow_local(r, stream, name, wal_dir_rescan_delay)) + diag_raise(); +} + +static inline void +recovery_stop_local_xc(struct recovery *r) +{ + if (recovery_stop_local(r)) + diag_raise(); +} + +static inline void +recovery_finalize_xc(struct recovery *r) +{ + if (recovery_finalize(r)) + diag_raise(); +} + #endif /* defined(__cplusplus) */ #endif /* TARANTOOL_RECOVERY_H_INCLUDED */ -- 2.20.1