From d18f8ed99dd63c508612965342fc680b5d18284b Mon Sep 17 00:00:00 2001 From: Arisa Tajima Date: Wed, 29 Jun 2022 12:59:18 -0700 Subject: [PATCH] Update compactor API (#247) Summary: Pull Request resolved: https://github.com/facebookresearch/fbpcf/pull/247 Update the compactor API to have consistent formatting with shuffler and permuter APIs. Changes are applied to type T and LabelT to consider them as implicit batches. Reviewed By: chualynn, RuiyuZhu Differential Revision: D37524033 fbshipit-source-id: 36afb8057f37242c71f42c5e1184844610d0921f --- fbpcf/mpc_std_lib/compactor/ICompactor.h | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/fbpcf/mpc_std_lib/compactor/ICompactor.h b/fbpcf/mpc_std_lib/compactor/ICompactor.h index 46f248d9..4955d632 100644 --- a/fbpcf/mpc_std_lib/compactor/ICompactor.h +++ b/fbpcf/mpc_std_lib/compactor/ICompactor.h @@ -19,8 +19,9 @@ namespace fbpcf::mpc_std_lib::compactor { */ /** * A type T corresponds to a set of values (i.e., a batch) to be - * compactified, e.g. std::vector - * A type LabelT corresponds to a binary label, e.g., bool, Bit + * compactified, e.g. std::vector. + * Similarly, a type LabelT corresponds to a set of binary labels (i.e., a + * batch), e.g. std::vector. */ template class ICompactor { @@ -28,19 +29,19 @@ class ICompactor { virtual ~ICompactor() = default; /** - * Perform a compaction on a set of batches based on specified binary labels. - * @param batches: a set of batches, where every batch is composed of - * n values to be compactified - * @param labels: a binary vector of size n where 1 indicates the - * corresponding items in the input are considered as necessary data; + * Perform a compaction on a set of secret values based on given binary + * labels. + * @param src: a set of n values to be compactified + * @param label: a set of n binary labels, where 1 indicates the + * corresponding items in the src are considered as necessary data; * otherwise they are considered as unimportant data * @param shouldRevealSize: whether it is okay to reveal the size of 1s items - * @return the resulting compactified metadata and labels + * @return the resulting compactified src and label */ - virtual std::tuple, std::vector> compaction( - const std::vector& batches, - const std::vector& labels, + virtual std::pair compaction( + const T& src, + const LabelT& label, bool shouldRevealSize) const = 0; };