Skip to content
This repository was archived by the owner on Jun 20, 2025. It is now read-only.

Commit 7d312d4

Browse files
Ajinkya Ghongefacebook-github-bot
authored andcommitted
Create pc_translator library. (#2265)
Summary: Pull Request resolved: #2265 # Context As per PC Translator design, we need a runtime library will be called during PC run. This library will be called at the beginning of PC run to encode specified fields in publisher side input into a encoded breakdown (aggregation) Ids based on active PC instruction sets for the run. The library will filter the active PC Instruction sets for the run based on parsing the pcs_features i.e. gatekeepers for the particular run. # Product decisions In this stack we would focus solely on functionality required for private lift runs. We would focus on the MVP implementation of the library and its integration with fbpcf ORAM encoder library in this stack. # Stack 1. Create runtime pc_translator library. 2. Add logic to retrieve and parse PC instruction set, filtered based on the active gatekeepers for the run. 3. Integrate pc_translator library with fbpcf ORAM encoder. 4. Add logic to generate transformed publisher output with encoded breakdown ID and write the output. # In this diff Create runtime pc_translator library. Differential Revision: D44617759 Privacy Context Container: L416713 fbshipit-source-id: d2249945153218b314333411fa5adf321df53fca
1 parent 9516d0c commit 7d312d4

2 files changed

Lines changed: 91 additions & 0 deletions

File tree

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
/*
2+
* Copyright (c) Meta Platforms, Inc. and affiliates.
3+
*
4+
* This source code is licensed under the MIT license found in the
5+
* LICENSE file in the root directory of this source tree.
6+
*/
7+
8+
#include "fbpcs/pc_translator/PCTranslator.h"
9+
10+
namespace pc_translator {
11+
12+
std::string PCTranslator::encode(const std::string& /* inputDataset */) {
13+
throw std::runtime_error("Unimplemented");
14+
}
15+
16+
std::string PCTranslator::decode(
17+
const std::string& /* aggregatedOutputDataset */) {
18+
throw std::runtime_error("Unimplemented");
19+
}
20+
21+
void PCTranslator::retrieveInstructionSets(
22+
std::vector<std::string>& /* instructionSetNames */) {
23+
throw std::runtime_error("Unimplemented");
24+
}
25+
26+
std::vector<std::string> PCTranslator::retrieveInstructionSetNamesForRun(
27+
const std::string& /* pcsFeatures */) {
28+
throw std::runtime_error("Unimplemented");
29+
}
30+
31+
void PCTranslator::transformDataset(const std::string& /* input */) {
32+
throw std::runtime_error("Unimplemented");
33+
}
34+
35+
void PCTranslator::parseInstructionSet(
36+
const std::string& /* instructionSet */) {
37+
throw std::runtime_error("Unimplemented");
38+
}
39+
} // namespace pc_translator

fbpcs/pc_translator/PCTranslator.h

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
/*
2+
* Copyright (c) Meta Platforms, Inc. and affiliates.
3+
*
4+
* This source code is licensed under the MIT license found in the
5+
* LICENSE file in the root directory of this source tree.
6+
*/
7+
8+
#pragma once
9+
10+
#include <cstdint>
11+
#include <memory>
12+
#include <string>
13+
#include <vector>
14+
15+
namespace pc_translator {
16+
17+
/*
18+
* This class contains functions required for PC Translator during actual run
19+
* i.e. retrieving the PC instruction sets, filtering the set per active GK for
20+
* run, encoding and decoding the dataset files input as per the instruction
21+
* set.
22+
*/
23+
class PCTranslator {
24+
public:
25+
explicit PCTranslator(const std::string& pcsFeatures)
26+
: pcsfeatures_(pcsFeatures) {}
27+
28+
/*
29+
* Method to encode the configurable fields in input dataset as per the active
30+
* pc instruction sets for the run. This method will output the path of
31+
* transformed input dataset, which can be used in further PC run.
32+
*/
33+
std::string encode(const std::string& inputDataset);
34+
35+
/*
36+
* Method to decode final aggregated output with the encoded breakdown Ids as
37+
* the keys. This method will decode the breakdown Ids to original group Id
38+
* values and format the aggregated output as per the new keys. Output of this
39+
* method would be the path of the decoded aggregated output.
40+
*/
41+
std::string decode(const std::string& aggregatedOutputDataset);
42+
43+
private:
44+
std::string pcsfeatures_;
45+
void retrieveInstructionSets(std::vector<std::string>& instructionSetNames);
46+
std::vector<std::string> retrieveInstructionSetNamesForRun(
47+
const std::string& pcsfeatures);
48+
void parseInstructionSet(const std::string& instructionSet);
49+
void transformDataset(const std::string& input);
50+
};
51+
52+
} // namespace pc_translator

0 commit comments

Comments
 (0)