Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unify installation instructions to use experimental-install #121

Merged
merged 1 commit into from
Oct 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,21 @@ Keyword PIR database generation
## Overview

`PIRGenerateDatabase` is an executable which generates a sample database for testing.
The resulting database can be processed with the `PIRProcessDatabase` executable or sharded with the `PIRShardDatabase` executable.
The resulting database can be sharded with the [PIRShardDatabase](https://swiftpackageindex.com/apple/swift-homomorphic-encryption/main/documentation/pirsharddatabase) executable and processed with the [PIRProcessDatabase](https://swiftpackageindex.com/apple/swift-homomorphic-encryption/main/documentation/pirprocessdatabase) executable.

### Requirements
* Build the `PIRGenerateDatabase` executable by running:
To install the `PIRGenerateDatabase` executable, first make sure that the `~/.swiftpm/bin` directory is on your `$PATH`. To do
so, add the following line to your `~/.zshrc` or appropriate shell configuration file.
```sh
swift build -c release --target PIRGenerateDatabase
export PATH="$HOME/.swiftpm/bin:$PATH"
```
The binary will be generated in `.build/release/PIRGenerateDatabase`.
Make sure to reload it (`source ~/.zshrc`) or by restarting your terminal emulator. Then we are going to use the
`experimental-install` feature of Swift Package Manager.

* Install the binary, e.g., by adding it to your path.
Change directory to a checkout of this repository and run the following command.
```sh
swift package experimental-install -c release --product PIRGenerateDatabase
```

### Example

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,18 @@ Keyword PIR database processing will transform a database in preparation for hos
The `PIRProcessDatabase` binary performs the processing.

### Requirements
Build the `PIRProcessDatabase` executable by running:
To install the `PIRProcessDatabase` executable, first make sure that the `~/.swiftpm/bin` directory is on your `$PATH`. To do
so, add the following line to your `~/.zshrc` or appropriate shell configuration file.
```sh
swift build -c release --target PIRProcessDatabase
export PATH="$HOME/.swiftpm/bin:$PATH"
```
Make sure to reload it (`source ~/.zshrc`) or by restarting your terminal emulator. Then we are going to use the
`experimental-install` feature of Swift Package Manager.

Change directory to a checkout of this repository and run the following command.
```sh
swift package experimental-install -c release --product PIRProcessDatabase
```
The binary will be generated in `.build/release/PIRProcessDatabase`.

### Processing
Keyword PIR's database processing is determined by its parameters.
Expand All @@ -31,7 +38,7 @@ e.g., `n_4096_logq_27_28_28_logt_5`.
2. `inputDatabase` is the path to the unprocessed input database. It must be a
serialized [Apple_SwiftHomomorphicEncryption_Pir_V1_KeywordDatabase](https://swiftpackageindex.com/apple/swift-homomorphic-encryption/main/documentation/privateinformationretrievalprotobuf/apple_swifthomomorphicencryption_pir_v1_keyworddatabase).

> Note: The `PIRGenerateDatabase` binary can be used to generate a sample database.
> Note: The [PIRGenerateDatabase](https://swiftpackageindex.com/apple/swift-homomorphic-encryption/main/documentation/pirgeneratedatabase) binary can be used to generate a sample database.

3. `outputDatabase` is the path to where the processed database’s shards will be
written. This string must contain `SHARD_ID`, unless `sharding` is
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ Database updates may lead to different PIR configurations, which need to be sync
We can configure the database processing to yield the same PIR configuration across database updates.

### Requirements
This example assumes that you have the following binaries available on your `$PATH`.
The binaries are:
This example assumes that you have the following binaries available on your `$PATH`:
- `PIRGenerateDatabase`
- `PIRProcessDatabase`

Expand All @@ -22,8 +21,7 @@ Make sure to reload it (`source ~/.zshrc`) or by restarting your terminal emulat

Change directory to a checkout of this repository and run the following command.
```sh
swift package experimental-install -c release --product PIRGenerateDatabase
swift package experimental-install -c release --product PIRProcessDatabase
swift package experimental-install -c release --product PIRGenerateDatabase --product PIRProcessDatabase
```

### Example
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,23 @@ Each resulting shard is suitable for processing with the [PIRProcessDatabase](ht
* `entryCountPerShard` shards the database using enough shards such that the average shard contains the specified number of entries.

### Requirements
Build the [PIRProcessDatabase](https://swiftpackageindex.com/apple/swift-homomorphic-encryption/main/documentation/pirprocessdatabase) executable by running:
This example assumes that you have the following binaries available on your `$PATH`:
- `PIRGenerateDatabase`
- `PIRShardDatabase`
- `PIRProcessDatabase`

The way to add these to your path is by first making sure that the `~/.swiftpm/bin` directory is on your `$PATH`. To do
so, add the following line to your `~/.zshrc` or appropriate shell configuration file.
```sh
swift build -c release --target PIRProcessDatabase
export PATH="$HOME/.swiftpm/bin:$PATH"
```
The binary will be generated in `.build/release/PIRProcessDatabase`.
Make sure to reload it (`source ~/.zshrc`) or by restarting your terminal emulator. Then we are going to use the
`experimental-install` feature of Swift Package Manager.

For the example below, you'll also need to install the
[PIRGenerateDatabase](https://swiftpackageindex.com/apple/swift-homomorphic-encryption/main/documentation/pirgeneratedatabse)
executable in a similar manner as
[PIRShardDatabase](https://swiftpackageindex.com/apple/swift-homomorphic-encryption/main/documentation/pirsharddatabase).
Change directory to a checkout of this repository and run the following command.
```sh
swift package experimental-install -c release --product PIRGenerateDatabase --product PIRShardDatabase --product PIRProcessDatabase
```

### Example

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ public struct KeywordPirConfig: Hashable, Codable, Sendable {
/// Strategy for ``EvaluationKey`` compression.
@usableFromInline let keyCompression: PirKeyCompressionStrategy

/// When set to true, entry size will be equal to ``CuckooTableConfig/maxSerializedBucketSize``.
///
/// Otherwise the largest serialized bucket size is used instead.
@usableFromInline let useMaxSerializedBucketSize: Bool

/// Keyword PIR parameters.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ Database updates may lead to different PIR configurations, which need to be sync
We can configure the database processing to yield the same PIR configuration on small database updates.

### Requirements
This example assumes that you have the following binaries available on your `$PATH`.
The binaries are:
This example assumes that you have the following binaries available on your `$PATH`:
- `PIRGenerateDatabase`
- `PIRProcessDatabase`

Expand All @@ -22,8 +21,7 @@ Make sure to reload it (`source ~/.zshrc`) or by restarting your terminal emulat

Change directory to a checkout of this repository and run the following command.
```sh
swift package experimental-install -c release --product PIRGenerateDatabase
swift package experimental-install -c release --product PIRProcessDatabase
swift package experimental-install -c release --product PIRGenerateDatabase --product PIRProcessDatabase
```

### Example
Expand Down
Loading