Skip to content

Commit

Permalink
[DVT-911] Add database id (#118)
Browse files Browse the repository at this point in the history
* add database id

* update docs
  • Loading branch information
minhd-vu committed Sep 1, 2023
1 parent a7dfb81 commit f1075df
Show file tree
Hide file tree
Showing 5 changed files with 131 additions and 17 deletions.
3 changes: 3 additions & 0 deletions cmd/p2p/sensor/sensor.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ type (
NodesFile string
TrustedNodesFile string
ProjectID string
DatabaseID string
SensorID string
MaxPeers int
MaxDatabaseConcurrency int
Expand Down Expand Up @@ -146,6 +147,7 @@ var SensorCmd = &cobra.Command{
RunE: func(cmd *cobra.Command, args []string) error {
db := database.NewDatastore(cmd.Context(), database.DatastoreOptions{
ProjectID: inputSensorParams.ProjectID,
DatabaseID: inputSensorParams.DatabaseID,
SensorID: inputSensorParams.SensorID,
MaxConcurrency: inputSensorParams.MaxDatabaseConcurrency,
ShouldWriteBlocks: inputSensorParams.ShouldWriteBlocks,
Expand Down Expand Up @@ -285,6 +287,7 @@ func init() {
log.Error().Err(err).Msg("Failed to mark network-id as required persistent flag")
}
SensorCmd.PersistentFlags().StringVarP(&inputSensorParams.ProjectID, "project-id", "p", "", "GCP project ID")
SensorCmd.PersistentFlags().StringVarP(&inputSensorParams.DatabaseID, "database-id", "d", "", "Datastore database ID")
SensorCmd.Flags().StringVarP(&inputSensorParams.SensorID, "sensor-id", "s", "", "Sensor ID when writing block/tx events")
if err := SensorCmd.MarkFlagRequired("sensor-id"); err != nil {
log.Error().Err(err).Msg("Failed to mark sensor-id as required persistent flag")
Expand Down
1 change: 1 addition & 0 deletions doc/polycli_p2p_sensor.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ If no nodes.json file exists, it will be created.

```bash
-b, --bootnodes string Comma separated nodes used for bootstrapping
-d, --database-id string Datastore database ID
--dial-ratio int Ratio of inbound to dialed connections. A dial ratio of 2 allows 1/2 of
connections to be dialed. Setting this to 0 defaults it to 3.
--discovery-port int UDP P2P discovery port (default 30303)
Expand Down
35 changes: 19 additions & 16 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ require (
github.com/stretchr/testify v1.8.4
github.com/tyler-smith/go-bip32 v1.0.0
github.com/tyler-smith/go-bip39 v1.1.0
golang.org/x/crypto v0.10.0
golang.org/x/text v0.10.0
golang.org/x/crypto v0.12.0
golang.org/x/text v0.12.0
golang.org/x/time v0.3.0
)

Expand All @@ -32,14 +32,15 @@ require (
github.com/jedib0t/go-pretty/v6 v6.4.6
github.com/schollz/progressbar/v3 v3.13.1
github.com/xeipuuv/gojsonschema v1.2.0
google.golang.org/api v0.138.0
)

require (
cloud.google.com/go v0.110.0 // indirect
cloud.google.com/go/compute v1.18.0 // indirect
cloud.google.com/go v0.110.7 // indirect
cloud.google.com/go/compute v1.23.0 // indirect
cloud.google.com/go/compute/metadata v0.2.3 // indirect
cloud.google.com/go/iam v0.12.0 // indirect
cloud.google.com/go/secretmanager v1.10.0 // indirect
cloud.google.com/go/iam v1.1.1 // indirect
cloud.google.com/go/secretmanager v1.11.1 // indirect
github.com/0xPolygon/go-ibft v0.4.1-0.20230612114712-fa4235351cbc // indirect
github.com/DataDog/appsec-internal-go v1.0.0 // indirect
github.com/DataDog/datadog-agent/pkg/obfuscate v0.45.0-rc.1 // indirect
Expand Down Expand Up @@ -76,8 +77,9 @@ require (
github.com/google/go-cmp v0.5.9 // indirect
github.com/google/gopacket v1.1.19 // indirect
github.com/google/pprof v0.0.0-20230509042627-b1315fad0c5a // indirect
github.com/googleapis/enterprise-certificate-proxy v0.2.3 // indirect
github.com/googleapis/gax-go/v2 v2.7.1 // indirect
github.com/google/s2a-go v0.1.5 // indirect
github.com/googleapis/enterprise-certificate-proxy v0.2.5 // indirect
github.com/googleapis/gax-go/v2 v2.12.0 // indirect
github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
github.com/hashicorp/go-immutable-radix v1.3.1 // indirect
Expand Down Expand Up @@ -156,23 +158,24 @@ require (
go4.org/intern v0.0.0-20211027215823-ae77deb06f29 // indirect
go4.org/unsafe/assume-no-moving-gc v0.0.0-20220617031537-928513b29760 // indirect
golang.org/x/mod v0.11.0 // indirect
golang.org/x/net v0.11.0 // indirect
golang.org/x/oauth2 v0.8.0 // indirect
golang.org/x/net v0.14.0 // indirect
golang.org/x/oauth2 v0.11.0 // indirect
golang.org/x/sync v0.3.0 // indirect
golang.org/x/term v0.9.0 // indirect
golang.org/x/term v0.11.0 // indirect
golang.org/x/tools v0.10.0 // indirect
golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect
google.golang.org/api v0.114.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/genproto v0.0.0-20230320184635-7606e756e683 // indirect
google.golang.org/grpc v1.53.0 // indirect
google.golang.org/genproto v0.0.0-20230822172742-b8732ec3820d // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20230822172742-b8732ec3820d // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d // indirect
google.golang.org/grpc v1.57.0 // indirect
gopkg.in/DataDog/dd-trace-go.v1 v1.51.0 // indirect
inet.af/netaddr v0.0.0-20220811202034-502d2d690317 // indirect
nhooyr.io/websocket v1.8.7 // indirect
)

require (
cloud.google.com/go/datastore v1.11.0
cloud.google.com/go/datastore v1.14.0
filippo.io/edwards25519 v1.0.0-rc.1 // indirect
github.com/ChainSafe/go-schnorrkel v1.0.0 // indirect
github.com/FactomProject/basen v0.0.0-20150613233007-fe3947df716e // indirect
Expand Down Expand Up @@ -245,7 +248,7 @@ require (
github.com/tklauser/numcpus v0.2.2 // indirect
github.com/vedhavyas/go-subkey v1.0.3 // indirect
golang.org/x/exp v0.0.0-20230321023759-10a507213a29
golang.org/x/sys v0.9.0 // indirect
golang.org/x/sys v0.11.0 // indirect
google.golang.org/protobuf v1.31.0
gopkg.in/ini.v1 v1.66.4 // indirect
gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce // indirect
Expand Down

0 comments on commit f1075df

Please sign in to comment.