Skip to content

Commit 1fb5a5a

Browse files
committed
Merge rs-common and the new server proto types
1 parent a9a1b7e commit 1fb5a5a

15 files changed

Lines changed: 82 additions & 135 deletions

File tree

Cargo.lock

Lines changed: 22 additions & 82 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/rs-common/Cargo.toml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,16 @@ crate-type = ["cdylib", "rlib"]
1111

1212
[dependencies]
1313
thiserror = "2.0"
14-
prost = "0.13"
15-
prost-types = "0.13"
14+
prost = "0.14"
15+
prost-types = "0.14"
16+
tonic = { version = "*", default-features = false, features = ["codegen"] }
17+
tonic-prost = "*"
1618
ed25519-dalek = "2.2.0"
1719
hmac-sha256 = "1.1.12"
1820

1921
[build-dependencies]
20-
prost-build = "0.13"
22+
prost-build = "0.14"
23+
tonic-prost-build = "*"
2124

2225
[profile.release]
2326
opt-level = "s"

packages/rs-common/build.rs

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
88
return Err("Proto directory not found at ../../protos".into());
99
}
1010

11+
// ── v1 protos (prost_build) ──────────────────────────────────
1112
let proto_file_path = protos_dir.join("polycentric.proto");
1213
let ffi_proto_file_path = protos_dir.join("rs-core-ffi.proto");
1314

@@ -34,8 +35,31 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
3435
}
3536
}
3637

38+
// ── v2 protos (tonic_prost_build) ────────────────────────────
39+
let v2_protos = [
40+
"../../protos/polycentric/v2/identity.proto",
41+
"../../protos/polycentric/v2/events.proto",
42+
"../../protos/polycentric/v2/content.proto",
43+
"../../protos/polycentric/v2/feeds.proto",
44+
];
45+
46+
let out_dir_path = PathBuf::from(&out_dir);
47+
tonic_prost_build::configure()
48+
.build_transport(false)
49+
.file_descriptor_set_path(
50+
out_dir_path.join("polycentric_v2.bin"),
51+
)
52+
.compile_protos(&v2_protos, &["../../protos"])?;
53+
54+
// ── rerun-if-changed ─────────────────────────────────────────
3755
println!("cargo:rerun-if-changed={}", proto_file_path.display());
38-
println!("cargo:rerun-if-changed={}", ffi_proto_file_path.display());
56+
println!(
57+
"cargo:rerun-if-changed={}",
58+
ffi_proto_file_path.display()
59+
);
60+
for proto in &v2_protos {
61+
println!("cargo:rerun-if-changed={proto}");
62+
}
3963

4064
Ok(())
4165
}

packages/rs-common/src/models/mod.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,14 @@ pub mod protos {
33
include!(concat!(env!("OUT_DIR"), "/polycentric_ffi.rs"));
44
}
55

6+
#[allow(dead_code, unused_attributes)]
7+
pub mod protos_v2 {
8+
tonic::include_proto!("polycentric.v2");
9+
10+
pub const FILE_DESCRIPTOR_SET: &[u8] =
11+
include_bytes!(concat!(env!("OUT_DIR"), "/polycentric_v2.bin"));
12+
}
13+
614
pub mod traits;
715

816
pub mod digest;

packages/rs-core/Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ crate-type = ["cdylib", "rlib"]
1111

1212
[dependencies]
1313
thiserror = "2.0"
14-
prost = "0.13"
15-
prost-types = "0.13"
14+
prost = "0.14"
15+
prost-types = "0.14"
1616
rand = "0.8"
1717
polycentric-common = { path = "../rs-common" }
1818
getrandom = { version = "0.2", features = ["js"] }
@@ -35,7 +35,7 @@ base64 = "0.22.1"
3535
wasm-bindgen-test = "0.3.50"
3636

3737
[build-dependencies]
38-
prost-build = "0.13"
38+
prost-build = "0.14"
3939

4040
[features]
4141
default = ["wasm"]

services/server/proto/polycentric/v1/content.proto renamed to protos/polycentric/v2/content.proto

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
syntax = "proto3";
2-
package polycentric.v1;
2+
package polycentric.v2;
33

4-
import "polycentric/v1/event_key.proto";
5-
import "polycentric/v1/identity.proto";
4+
import "polycentric/v2/event_key.proto";
5+
import "polycentric/v2/identity.proto";
66

77
enum ContentDigestType {
88
CONTENT_DIGEST_TYPE_UNSPECIFIED = 0;

services/server/proto/polycentric/v1/event_key.proto renamed to protos/polycentric/v2/event_key.proto

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
syntax = "proto3";
2-
package polycentric.v1;
2+
package polycentric.v2;
33

4-
import "polycentric/v1/identity.proto";
4+
import "polycentric/v2/identity.proto";
55

66
// EventKey's are the unique identitifiers of Events
77
message EventKey {

services/server/proto/polycentric/v1/events.proto renamed to protos/polycentric/v2/events.proto

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
syntax = "proto3";
2-
package polycentric.v1;
2+
package polycentric.v2;
33

4-
import "polycentric/v1/content.proto";
5-
import "polycentric/v1/event_key.proto";
4+
import "polycentric/v2/content.proto";
5+
import "polycentric/v2/event_key.proto";
66

77
// Event messages reference, but do not include, content
88
message Event {

services/server/proto/polycentric/v1/feeds.proto renamed to protos/polycentric/v2/feeds.proto

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
syntax = "proto3";
2-
package polycentric.v1;
2+
package polycentric.v2;
33

4-
import "polycentric/v1/events.proto";
4+
import "polycentric/v2/events.proto";
55

66
enum FeedAlgorithm {
77
FEED_ALGORITHM_UNSPECIFIED = 0;

services/server/proto/polycentric/v1/identity.proto renamed to protos/polycentric/v2/identity.proto

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
syntax = "proto3";
2-
package polycentric.v1;
2+
package polycentric.v2;
33

44
enum KeyType {
55
KEY_TYPE_UNSPECIFIED = 0;

0 commit comments

Comments
 (0)