Skip to content

Commit

Permalink
fix: double vertex only declare once (#205)
Browse files Browse the repository at this point in the history
Signed-off-by: Sacha Froment <[email protected]>
Co-authored-by: droak <[email protected]>
  • Loading branch information
sfroment and d-roak authored Oct 29, 2024
1 parent 81b7de2 commit 0228b1b
Show file tree
Hide file tree
Showing 18 changed files with 609 additions and 326 deletions.
6 changes: 3 additions & 3 deletions buf.gen.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@ managed:
enabled: true
plugins:
- local: ./node_modules/ts-proto/protoc-gen-ts_proto
out: ./packages
out: .
opt:
- esModuleInterop=true
- fileSuffix=_pb
- ts_proto_opt=outputServices=grpc-js
- remote: buf.build/grpc/node
out: ./packages
out: .
opt:
- ts_proto_opt=esModuleInterop=true
inputs:
- directory: ./packages
exclude_paths:
- packages/node/node_modules
- packages/node
- packages/network/node_modules
- packages/object/node_modules
14 changes: 5 additions & 9 deletions buf.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
version: v2
modules:
# - path: packages/node
# excludes:
# - packages/node/node_modules
- path: packages/network
excludes:
- packages/network/node_modules
- path: packages/object
excludes:
- packages/object/node_modules
- path: packages/object/src/proto
name: buf.build/topology/object

- path: packages/network/src/proto
name: buf.build/topology/network
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@
"clean": "pnpm --filter '@topology-foundation/*' clean",
"docs": "typedoc",
"postinstall": "pnpm --filter '@topology-foundation/*' build",
"proto-gen": "buf generate",
"proto-gen": "pnpm proto-gen:object && pnpm proto-gen:network",
"proto-gen:object": "buf generate packages/object/src/proto -o packages/object/src/proto",
"proto-gen:network": "buf generate packages/network/src/proto -o packages/network/src/proto",
"release": "release-it",
"test": "vitest"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/network/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export * from "./node.js";
export * as NetworkPb from "./proto/messages_pb.js";
export * as NetworkPb from "./proto/topology/network/messages_pb.js";
2 changes: 1 addition & 1 deletion packages/network/src/node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import { webTransport } from "@libp2p/webtransport";
import { multiaddr } from "@multiformats/multiaddr";
import { type Libp2p, createLibp2p } from "libp2p";
import { fromString as uint8ArrayFromString } from "uint8arrays/from-string";
import { Message } from "./proto/messages_pb.js";
import { Message } from "./proto/topology/network/messages_pb.js";
import { uint8ArrayToStream } from "./stream.js";

export * from "./stream.js";
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

47 changes: 0 additions & 47 deletions packages/network/src/proto/messages.proto

This file was deleted.

38 changes: 38 additions & 0 deletions packages/network/src/proto/topology/network/messages.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
syntax = "proto3";
package topology.network;

import "google/protobuf/struct.proto";
import "topology/object/object.proto";


message Message {
enum MessageType {
UPDATE = 0;
SYNC = 1;
SYNC_ACCEPT = 2;
SYNC_REJECT = 3;
CUSTOM = 4;
}

string sender = 1;
MessageType type = 2;
bytes data = 3;
}

message Update {
string objectId = 1;
repeated topology.object.Vertex vertices = 2;
}

message Sync {
string objectId = 1;
repeated string vertex_hashes = 2;
}

message SyncAccept {
string objectId = 1;
repeated topology.object.Vertex requested = 2;
repeated string requesting = 3;
}

message SyncReject {}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
// GENERATED CODE -- NO SERVICES IN PROTO
Loading

0 comments on commit 0228b1b

Please sign in to comment.