diff --git a/Makefile b/Makefile index 82305e40..fd4a59be 100644 --- a/Makefile +++ b/Makefile @@ -35,14 +35,14 @@ endif .PHONY: singleNode singleNode: ## Run tests against a single node. - @EVENTSTORE_INSECURE=true go test -count=1 -v ./esdb -run 'TestStreams|TestPersistentSubscriptions|TestExpectations|TestProjections' + @EVENTSTORE_INSECURE=true go test -count=1 -v ./kurrentdb -run 'TestStreams|TestPersistentSubscriptions|TestExpectations|TestProjections' .PHONY: secureNode secureNode: ## Run tests against a secure node. @$(DOCKER_COMPOSE_CMD) down -v @$(DOCKER_COMPOSE_CMD) pull @$(DOCKER_COMPOSE_CMD) up -d - @EVENTSTORE_INSECURE=false go test -v ./esdb -run 'TestStreams|TestPersistentSubscriptions|TestProjections' + @EVENTSTORE_INSECURE=false go test -v ./kurrentdb -run 'TestStreams|TestPersistentSubscriptions|TestProjections' @$(DOCKER_COMPOSE_CMD) down .PHONY: clusterNode @@ -52,16 +52,16 @@ clusterNode: ## Run tests against a cluster node. @$(DOCKER_COMPOSE_CMD) -f cluster-docker-compose.yml up -d @echo "Waiting for services to be fully ready..." @sleep 5 - @EVENTSTORE_INSECURE=false CLUSTER=true go test -count=1 -v ./esdb -run 'TestStreams|TestPersistentSubscriptions|TestProjections|TestClusterRebalance' + @EVENTSTORE_INSECURE=false CLUSTER=true go test -count=1 -v ./kurrentdb -run 'TestStreams|TestPersistentSubscriptions|TestProjections|TestClusterRebalance' @$(DOCKER_COMPOSE_CMD) -f cluster-docker-compose.yml down --remove-orphans .PHONY: misc misc: ## Run tests that don't need a server to run. - go test -v ./esdb -run TestMisc + go test -v ./kurrentdb -run TestMisc .PHONY: test test: singleNode secureNode clusterNode misc ## Run all tests. .PHONY: ci ci: ## Run tests in Github Actions setting. - go test -v ./esdb -run "$(CI_TARGET)" + go test -v ./kurrentdb -run "$(CI_TARGET)" diff --git a/README.md b/README.md index 88524c43..db716af2 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,12 @@ -# EventStoreDB Client SDK for Golang [![Actions Status](https://github.com/eventstore/EventStore-Client-Go/workflows/CI/badge.svg?branch=master)](https://github.com/eventstore/EventStore-Client-Go/actions) +# KurrentDB Client SDK for Golang [![Actions Status](https://github.com/eventstore/EventStore-Client-Go/workflows/CI/badge.svg?branch=master)](https://github.com/eventstore/EventStore-Client-Go/actions) -EventStoreDB is the event-native database, where business events are immutably stored and streamed. Designed for event-sourced, event-driven, and microservices architectures. +KurrentDB is the event-native database, where business events are immutably stored and streamed. Designed for event-sourced, event-driven, and microservices architectures. -This repository contains an [EventStoreDB][es] Client SDK written in Go. +This repository contains an [KurrentDB][kurrent] Client SDK written in Go. ## Developing -Integration tests run against a server using Docker, with the [EventStoreDB gRPC Client Test Container][container]. +Integration tests run against a server using Docker, with the [KurrentDB gRPC Client Test Container][container]. ### Setup dependencies Testing requires [Docker] and [Docker Compose] to be installed. @@ -42,7 +42,7 @@ make test ## Communities - [Discuss](https://discuss.eventstore.com/) -- [Discord (Event Store)](https://discord.gg/Phn9pmCw3t) +- [Discord (Kurrent)](https://discord.gg/Phn9pmCw3t) ## Security @@ -58,5 +58,5 @@ All contributions to the SDK are made via GitHub Pull Requests, and must be lice [docker]: https://www.docker.com/ [docker compose]: https://www.docker.com/ -[es]: https://eventstore.com +[kurrent]: https://kurrent.io [make]: https://www.gnu.org/software/make/ diff --git a/build.ps1 b/build.ps1 index 9f55c1c3..4f0f15e5 100644 --- a/build.ps1 +++ b/build.ps1 @@ -63,5 +63,5 @@ if ($generateProtos) { } Write-Host "Compiling project..." -go build -v .\esdb .\samples +go build -v .\kurrentdb .\samples Write-Host "done." diff --git a/build.sh b/build.sh index a155208f..91c763e3 100755 --- a/build.sh +++ b/build.sh @@ -71,5 +71,5 @@ then fi echo "Compiling project..." -go build -v ./esdb ./samples +go build -v ./kurrentdb ./samples echo "done." diff --git a/esdb/configuration_test.go b/esdb/configuration_test.go deleted file mode 100644 index 0a575131..00000000 --- a/esdb/configuration_test.go +++ /dev/null @@ -1,505 +0,0 @@ -package esdb_test - -import ( - "testing" - "time" - - "github.com/EventStore/EventStore-Client-Go/v4/esdb" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" -) - -func ConnectionStringTests(t *testing.T) { - t.Run("ConnectionStringTests", func(t *testing.T) { - TestConnectionStringDefaults(t) - TestConnectionStringWithNoSchema(t) - TestConnectionStringWithInvalidScheme(t) - TestConnectionStringWithInvalidUserCredentials(t) - TestConnectionStringWithInvalidHost(t) - TestConnectionStringWithEmptyPath(t) - TestConnectionStringWithNonEmptyPath(t) - TestConnectionStringWithoutSettings(t) - TestConnectionStringWithInvalidKeyValuePair(t) - TestConnectionStringWithInvalidSettings(t) - TestConnectionStringWithDifferentNodePreferences(t) - TestConnectionStringWithValidSingleNodeConnectionString(t) - TestConnectionStringWithValidClusterConnectionString(t) - TestConnectionStringWithDifferentTLSSettings(t) - TestConnectionStringWithDifferentTLSVerifySettings(t) - TestConnectionStringWithoutCertificateFile(t) - TestConnectionStringWithCertificateFile(t) - TestConnectionStringWithKeepAlive(t) - TestConnectionStringWithDefaultDeadline(t) - }) -} - -func TestConnectionStringDefaults(t *testing.T) { - config, err := esdb.ParseConnectionString("esdb://localhost") - assert.NoError(t, err) - assert.Equal(t, "localhost:2113", config.Address) - assert.Equal(t, 100, config.DiscoveryInterval) - assert.Equal(t, 5, config.GossipTimeout) - assert.Equal(t, 10, config.MaxDiscoverAttempts) - assert.Equal(t, 10*time.Second, config.KeepAliveInterval) - assert.Equal(t, 10*time.Second, config.KeepAliveTimeout) - assert.Equal(t, esdb.NodePreferenceLeader, config.NodePreference) -} - -func TestConnectionStringWithNoSchema(t *testing.T) { - config, err := esdb.ParseConnectionString(":so/mething/random") - require.Error(t, err) - assert.Nil(t, config) -} - -func TestConnectionStringWithInvalidScheme(t *testing.T) { - config, err := esdb.ParseConnectionString("esdbwrong://") - require.Error(t, err) - assert.Nil(t, config) -} - -func TestConnectionStringWithInvalidUserCredentials(t *testing.T) { - config, err := esdb.ParseConnectionString("esdb://@127.0.0.1/") - require.Error(t, err) - - config, err = esdb.ParseConnectionString("esdb://:pass@127.0.0.1/") - require.Error(t, err) - assert.Nil(t, config) -} - -func TestConnectionStringWithInvalidHost(t *testing.T) { - config, err := esdb.ParseConnectionString("esdb://") - require.Error(t, err) - assert.Nil(t, config) - - config, err = esdb.ParseConnectionString("esdb://user:pass@") - require.Error(t, err) - assert.Nil(t, config) - - config, err = esdb.ParseConnectionString("esdb://user:pass@127.0.0.1:abc") - require.Error(t, err) - assert.Nil(t, config) - - config, err = esdb.ParseConnectionString("esdb://user:pass@127.0.0.1:1234,127.0.0.2:abc,127.0.0.3:4321") - require.Error(t, err) - assert.Nil(t, config) - - config, err = esdb.ParseConnectionString("esdb://user:pass@127.0.0.1:abc:def") - require.Error(t, err) - assert.Nil(t, config) - - config, err = esdb.ParseConnectionString("esdb://user:pass@localhost:1234,127.0.0.2:abc:def,127.0.0.3:4321") - require.Error(t, err) - assert.Nil(t, config) - - config, err = esdb.ParseConnectionString("esdb://user:pass@localhost:1234,,127.0.0.3:4321") - require.Error(t, err) - assert.Nil(t, config) -} - -func TestConnectionStringWithEmptyPath(t *testing.T) { - config, err := esdb.ParseConnectionString("esdb://user:pass@127.0.0.1") - assert.Nil(t, err) - assert.NotNil(t, config) - - config, err = esdb.ParseConnectionString("esdb://user:pass@127.0.0.1:1234") - assert.Nil(t, err) - assert.NotNil(t, config) - - config, err = esdb.ParseConnectionString("esdb://user:pass@127.0.0.1/") - assert.Nil(t, err) - assert.NotNil(t, config) - - config, err = esdb.ParseConnectionString("esdb://user:pass@127.0.0.1?maxDiscoverAttempts=10") - assert.Nil(t, err) - assert.NotNil(t, config) - - config, err = esdb.ParseConnectionString("esdb://user:pass@127.0.0.1/?maxDiscoverAttempts=10") - assert.Nil(t, err) - assert.NotNil(t, config) -} - -func TestConnectionStringWithNonEmptyPath(t *testing.T) { - config, err := esdb.ParseConnectionString("esdb://user:pass@127.0.0.1/test") - require.Error(t, err) - assert.Nil(t, config) - - config, err = esdb.ParseConnectionString("esdb://user:pass@127.0.0.1/maxDiscoverAttempts=10") - require.Error(t, err) - assert.Nil(t, config) - - config, err = esdb.ParseConnectionString("esdb://user:pass@127.0.0.1/hello?maxDiscoverAttempts=10") - require.Error(t, err) - assert.Nil(t, config) -} - -func TestConnectionStringWithoutSettings(t *testing.T) { - config, err := esdb.ParseConnectionString("esdb://localhost") - assert.NoError(t, err) - assert.Equal(t, "localhost:2113", config.Address) - - config, err = esdb.ParseConnectionString("esdb://localhost:2114") - assert.NoError(t, err) - assert.Equal(t, "localhost:2114", config.Address) - - config, err = esdb.ParseConnectionString("esdb://user:pass@localhost:2114") - assert.NoError(t, err) - assert.Equal(t, "localhost:2114", config.Address) - assert.Equal(t, "user", config.Username) - assert.Equal(t, "pass", config.Password) - - config, err = esdb.ParseConnectionString("esdb://user:pass@localhost:2114/") - assert.NoError(t, err) - assert.Equal(t, "localhost:2114", config.Address) - assert.Equal(t, "user", config.Username) - assert.Equal(t, "pass", config.Password) - - config, err = esdb.ParseConnectionString("esdb://user:pass@127.0.0.1") - assert.Nil(t, err) - assert.NotNil(t, config) - assert.Equal(t, "user", config.Username) - assert.Equal(t, "pass", config.Password) - - config, err = esdb.ParseConnectionString("esdb://user:pass@127.0.0.1/") - assert.Nil(t, err) - assert.NotNil(t, config) - assert.Equal(t, "user", config.Username) - assert.Equal(t, "pass", config.Password) - - config, err = esdb.ParseConnectionString("esdb://user:pass@127.0.0.1/?") - assert.Nil(t, err) - assert.NotNil(t, config) - assert.Equal(t, "user", config.Username) - assert.Equal(t, "pass", config.Password) -} - -func TestConnectionStringWithInvalidKeyValuePair(t *testing.T) { - config, err := esdb.ParseConnectionString("esdb://user:pass@127.0.0.1/?maxDiscoverAttempts=12=34") - require.Error(t, err) - assert.Nil(t, config) - - config, err = esdb.ParseConnectionString("esdb://user:pass@127.0.0.1/?maxDiscoverAttempts1234") - assert.Nil(t, err) - assert.NotNil(t, config) -} - -func TestConnectionStringWithInvalidSettings(t *testing.T) { - config, err := esdb.ParseConnectionString("esdb://user:pass@127.0.0.1/?maxDiscoverAttempts=") - require.Error(t, err) - assert.Nil(t, config) - - config, err = esdb.ParseConnectionString("esdb://user:pass@127.0.0.1/?maxDiscoverAttempts=abcd") - require.Error(t, err) - assert.Nil(t, config) - - config, err = esdb.ParseConnectionString("esdb://user:pass@127.0.0.1/?discoveryInterval=abcd") - require.Error(t, err) - assert.Nil(t, config) - - config, err = esdb.ParseConnectionString("esdb://user:pass@127.0.0.1/?gossipTimeout=defg") - require.Error(t, err) - assert.Nil(t, config) - - config, err = esdb.ParseConnectionString("esdb://user:pass@127.0.0.1/?tlsVerifyCert=truee") - require.Error(t, err) - assert.Nil(t, config) - - config, err = esdb.ParseConnectionString("esdb://user:pass@127.0.0.1/?nodePreference=blabla") - require.Error(t, err) - assert.Nil(t, config) - - config, err = esdb.ParseConnectionString("esdb://user:pass@127.0.0.1?/") - assert.Nil(t, err) - assert.NotNil(t, config) -} - -func TestConnectionStringWithDifferentNodePreferences(t *testing.T) { - config, err := esdb.ParseConnectionString("esdb://user:pass@127.0.0.1/?nodePreference=leader") - assert.NoError(t, err) - assert.Equal(t, esdb.NodePreferenceLeader, config.NodePreference) - - config, err = esdb.ParseConnectionString("esdb://user:pass@127.0.0.1/?nodePreference=Follower") - assert.NoError(t, err) - assert.Equal(t, esdb.NodePreferenceFollower, config.NodePreference) - - config, err = esdb.ParseConnectionString("esdb://user:pass@127.0.0.1/?nodePreference=rAndom") - assert.NoError(t, err) - assert.Equal(t, esdb.NodePreferenceRandom, config.NodePreference) - - config, err = esdb.ParseConnectionString("esdb://user:pass@127.0.0.1/?nodePreference=ReadOnlyReplica") - assert.NoError(t, err) - assert.Equal(t, esdb.NodePreferenceReadOnlyReplica, config.NodePreference) - - config, err = esdb.ParseConnectionString("esdb://user:pass@127.0.0.1/?nodePreference=invalid") - require.Error(t, err) - assert.Nil(t, config) - assert.Contains(t, err.Error(), "Invalid NodePreference") -} - -func TestConnectionStringWithValidSingleNodeConnectionString(t *testing.T) { - config, err := esdb.ParseConnectionString("esdb://user:pass@localhost:2114?tlsVerifyCert=false") - require.NoError(t, err) - assert.Equal(t, "user", config.Username) - assert.Equal(t, "pass", config.Password) - assert.Equal(t, "localhost:2114", config.Address) - assert.Equal(t, true, config.SkipCertificateVerification) - assert.Equal(t, false, config.DnsDiscover) - - config, err = esdb.ParseConnectionString("esdb://user:pass@localhost:2114?tls=false") - assert.NoError(t, err) - assert.Equal(t, "user", config.Username) - assert.Equal(t, "pass", config.Password) - assert.Equal(t, "localhost:2114", config.Address) - - config, err = esdb.ParseConnectionString("esdb://user:pass@127.0.0.1/?maxDiscoverAttempts=13&DiscoveryInterval=37&gossipTimeout=33&nOdEPrEfErence=FoLLoWer&tlsVerifyCert=faLse") - require.NoError(t, err) - assert.Equal(t, "user", config.Username) - assert.Equal(t, "pass", config.Password) - assert.Equal(t, "127.0.0.1:2113", config.Address) - assert.Empty(t, config.GossipSeeds) - assert.Equal(t, 13, config.MaxDiscoverAttempts) - assert.Equal(t, 37, config.DiscoveryInterval) - assert.Equal(t, 33, config.GossipTimeout) - assert.Equal(t, esdb.NodePreferenceFollower, config.NodePreference) - assert.Equal(t, true, config.SkipCertificateVerification) - - config, err = esdb.ParseConnectionString("esdb://hostname:4321/?tls=fAlse") - require.NoError(t, err) - assert.Empty(t, config.Username) - assert.Empty(t, config.Password) - assert.Equal(t, "hostname:4321", config.Address) - assert.Empty(t, config.GossipSeeds) - assert.Equal(t, esdb.NodePreferenceLeader, config.NodePreference) - assert.Equal(t, true, config.DisableTLS) - assert.Equal(t, false, config.SkipCertificateVerification) - - config, err = esdb.ParseConnectionString("esdb+discover://user:pass@host?nodePreference=follower&tlsVerifyCert=false") - require.NoError(t, err) - assert.Equal(t, "user", config.Username) - assert.Equal(t, "pass", config.Password) - assert.Equal(t, "host:2113", config.Address) - assert.Empty(t, config.GossipSeeds) - assert.Equal(t, esdb.NodePreferenceFollower, config.NodePreference) - assert.Equal(t, false, config.DisableTLS) - assert.Equal(t, true, config.SkipCertificateVerification) - assert.Equal(t, true, config.DnsDiscover) - - config, err = esdb.ParseConnectionString("esdb://user:pass@localhost:2113?tls=true") - require.NoError(t, err) - assert.Equal(t, "user", config.Username) - assert.Equal(t, "pass", config.Password) - assert.Equal(t, "localhost:2113", config.Address) - assert.Equal(t, false, config.DisableTLS) - assert.Equal(t, false, config.DnsDiscover) - assert.Equal(t, false, config.SkipCertificateVerification) -} - -func endpointParse(addr string) *esdb.EndPoint { - value, _ := esdb.ParseEndPoint(addr) - return value -} - -func TestConnectionStringWithValidClusterConnectionString(t *testing.T) { - config, err := esdb.ParseConnectionString("esdb://host1,host2,host3") - assert.NoError(t, err) - assert.Empty(t, config.Address) - require.NotEmpty(t, config.GossipSeeds) - assert.Len(t, config.GossipSeeds, 3) - assert.Equal(t, endpointParse("host1:2113"), config.GossipSeeds[0]) - assert.Equal(t, endpointParse("host2:2113"), config.GossipSeeds[1]) - assert.Equal(t, endpointParse("host3:2113"), config.GossipSeeds[2]) - - config, err = esdb.ParseConnectionString("esdb://host1:1234,host2:4321,host3:3231") - assert.NoError(t, err) - assert.Empty(t, config.Address) - require.NotEmpty(t, config.GossipSeeds) - assert.Len(t, config.GossipSeeds, 3) - assert.Equal(t, endpointParse("host1:1234"), config.GossipSeeds[0]) - assert.Equal(t, endpointParse("host2:4321"), config.GossipSeeds[1]) - assert.Equal(t, endpointParse("host3:3231"), config.GossipSeeds[2]) - - config, err = esdb.ParseConnectionString("esdb://user:pass@host1:1234,host2:4321,host3:3231?nodePreference=follower") - assert.NoError(t, err) - assert.Equal(t, "user", config.Username) - assert.Equal(t, "pass", config.Password) - assert.Empty(t, config.Address) - require.NotEmpty(t, config.GossipSeeds) - assert.Len(t, config.GossipSeeds, 3) - assert.Equal(t, endpointParse("host1:1234"), config.GossipSeeds[0]) - assert.Equal(t, endpointParse("host2:4321"), config.GossipSeeds[1]) - assert.Equal(t, endpointParse("host3:3231"), config.GossipSeeds[2]) - assert.Equal(t, esdb.NodePreferenceFollower, config.NodePreference) - - config, err = esdb.ParseConnectionString("esdb://host1,host2,host3?tls=false") - assert.NoError(t, err) - assert.Empty(t, config.Address) - require.NotEmpty(t, config.GossipSeeds) - assert.Len(t, config.GossipSeeds, 3) - assert.Equal(t, endpointParse("host1:2113"), config.GossipSeeds[0]) - assert.Equal(t, endpointParse("host2:2113"), config.GossipSeeds[1]) - assert.Equal(t, endpointParse("host3:2113"), config.GossipSeeds[2]) - - config, err = esdb.ParseConnectionString("esdb://host1,host2,host3?tlsVerifyCert=false") - assert.NoError(t, err) - assert.Empty(t, config.Address) - require.NotEmpty(t, config.GossipSeeds) - assert.Len(t, config.GossipSeeds, 3) - assert.Equal(t, endpointParse("host1:2113"), config.GossipSeeds[0]) - assert.Equal(t, endpointParse("host2:2113"), config.GossipSeeds[1]) - assert.Equal(t, endpointParse("host3:2113"), config.GossipSeeds[2]) - assert.Equal(t, true, config.SkipCertificateVerification) - - config, err = esdb.ParseConnectionString("esdb://user:pass@127.0.0.1,127.0.0.2:3321,127.0.0.3/?maxDiscoverAttempts=13&DiscoveryInterval=37&nOdEPrEfErence=FoLLoWer&tlsVerifyCert=false") - assert.NoError(t, err) - assert.Equal(t, "user", config.Username) - assert.Equal(t, "pass", config.Password) - assert.Empty(t, config.Address) - assert.Equal(t, 13, config.MaxDiscoverAttempts) - assert.Equal(t, 37, config.DiscoveryInterval) - assert.Equal(t, esdb.NodePreferenceFollower, config.NodePreference) - require.NotEmpty(t, config.GossipSeeds) - assert.Len(t, config.GossipSeeds, 3) - assert.Equal(t, endpointParse("127.0.0.1:2113"), config.GossipSeeds[0]) - assert.Equal(t, endpointParse("127.0.0.2:3321"), config.GossipSeeds[1]) - assert.Equal(t, endpointParse("127.0.0.3:2113"), config.GossipSeeds[2]) - - config, err = esdb.ParseConnectionString("esdb://user:pass@host1,host2:3321,127.0.0.3/?tls=false&maxDiscoverAttempts=13&DiscoveryInterval=37&nOdEPrEfErence=FoLLoWer&tlsVerifyCert=false") - assert.NoError(t, err) - assert.Equal(t, "user", config.Username) - assert.Equal(t, "pass", config.Password) - assert.Empty(t, config.Address) - assert.Equal(t, 13, config.MaxDiscoverAttempts) - assert.Equal(t, 37, config.DiscoveryInterval) - assert.Equal(t, esdb.NodePreferenceFollower, config.NodePreference) - require.NotEmpty(t, config.GossipSeeds) - assert.Len(t, config.GossipSeeds, 3) - assert.Equal(t, endpointParse("host1:2113"), config.GossipSeeds[0]) - assert.Equal(t, endpointParse("host2:3321"), config.GossipSeeds[1]) - assert.Equal(t, endpointParse("127.0.0.3:2113"), config.GossipSeeds[2]) -} - -func TestConnectionStringWithDifferentTLSSettings(t *testing.T) { - config, _ := esdb.ParseConnectionString("esdb://127.0.0.1/") - assert.Equal(t, "127.0.0.1:2113", config.Address) - - config, _ = esdb.ParseConnectionString("esdb://127.0.0.1?tls=true") - assert.Equal(t, "127.0.0.1:2113", config.Address) - - config, _ = esdb.ParseConnectionString("esdb://127.0.0.1/?tls=FaLsE") - assert.Equal(t, "127.0.0.1:2113", config.Address) - - config, _ = esdb.ParseConnectionString("esdb://127.0.0.1,127.0.0.2:3321,127.0.0.3/") - assert.Equal(t, endpointParse("127.0.0.1:2113"), config.GossipSeeds[0]) - assert.Equal(t, endpointParse("127.0.0.2:3321"), config.GossipSeeds[1]) - assert.Equal(t, endpointParse("127.0.0.3:2113"), config.GossipSeeds[2]) - - config, _ = esdb.ParseConnectionString("esdb://127.0.0.1,127.0.0.2:3321,127.0.0.3?tls=true") - assert.Equal(t, endpointParse("127.0.0.1:2113"), config.GossipSeeds[0]) - assert.Equal(t, endpointParse("127.0.0.2:3321"), config.GossipSeeds[1]) - assert.Equal(t, endpointParse("127.0.0.3:2113"), config.GossipSeeds[2]) - - config, _ = esdb.ParseConnectionString("esdb://127.0.0.1,127.0.0.2:3321,127.0.0.3/?tls=fAlSe") - assert.Equal(t, endpointParse("127.0.0.1:2113"), config.GossipSeeds[0]) - assert.Equal(t, endpointParse("127.0.0.2:3321"), config.GossipSeeds[1]) - assert.Equal(t, endpointParse("127.0.0.3:2113"), config.GossipSeeds[2]) -} - -func TestConnectionStringWithDifferentTLSVerifySettings(t *testing.T) { - config, _ := esdb.ParseConnectionString("esdb://127.0.0.1/") - assert.Equal(t, false, config.SkipCertificateVerification) - - config, _ = esdb.ParseConnectionString("esdb://127.0.0.1/?tlsVerifyCert=TrUe") - assert.Equal(t, false, config.SkipCertificateVerification) - - config, _ = esdb.ParseConnectionString("esdb://127.0.0.1/?tlsVerifyCert=FaLsE") - assert.Equal(t, true, config.SkipCertificateVerification) - - config, _ = esdb.ParseConnectionString("esdb://127.0.0.1,127.0.0.2:3321,127.0.0.3/") - assert.Equal(t, false, config.SkipCertificateVerification) - - config, _ = esdb.ParseConnectionString("esdb://127.0.0.1,127.0.0.2:3321,127.0.0.3/?tlsVerifyCert=true") - assert.Equal(t, false, config.SkipCertificateVerification) - - config, _ = esdb.ParseConnectionString("esdb://127.0.0.1,127.0.0.2:3321,127.0.0.3/?tlsVerifyCert=false") - assert.Equal(t, true, config.SkipCertificateVerification) - -} - -func TestConnectionStringWithoutCertificateFile(t *testing.T) { - config, err := esdb.ParseConnectionString("esdb://user:pass@127.0.0.1") - assert.Nil(t, err) - assert.NotNil(t, config) -} - -func TestConnectionStringWithCertificateFile(t *testing.T) { - config, err := esdb.ParseConnectionString("esdb://user:pass@127.0.0.1/?tlsCAFile=invalidPath") - require.Error(t, err) - assert.Nil(t, config) -} - -func TestConnectionStringWithKeepAlive(t *testing.T) { - // KeepAliveInterval - config, err := esdb.ParseConnectionString("esdb://user:pass@127.0.0.1/?keepAliveInterval=zero") - require.Error(t, err) - assert.Nil(t, config) - assert.Contains(t, err.Error(), "Invalid keepAliveInterval \"zero\". Please provide a positive integer, or -1 to disable") - - config, err = esdb.ParseConnectionString("esdb://user:pass@127.0.0.1/?keepAliveInterval=-2") - require.Error(t, err) - assert.Nil(t, config) - assert.Contains(t, err.Error(), "Invalid keepAliveInterval \"-2\". Please provide a positive integer, or -1 to disable") - - config, err = esdb.ParseConnectionString("esdb://user:pass@127.0.0.1/?keepAliveInterval=-1") - require.NoError(t, err) - assert.Equal(t, -1, int(config.KeepAliveInterval)) - - config, err = esdb.ParseConnectionString("esdb://user:pass@127.0.0.1/?KeepAliveInterval=100") - require.NoError(t, err) - assert.Equal(t, 100*time.Millisecond, config.KeepAliveInterval) - - // KeepAliveTimeout - config, err = esdb.ParseConnectionString("esdb://user:pass@127.0.0.1/?keepAliveTimeout=one") - require.Error(t, err) - assert.Nil(t, config) - assert.Contains(t, err.Error(), "Invalid keepAliveTimeout \"one\". Please provide a positive integer, or -1 to disable") - - config, err = esdb.ParseConnectionString("esdb://user:pass@127.0.0.1/?keepAliveTimeout=-3") - require.Error(t, err) - assert.Nil(t, config) - assert.Contains(t, err.Error(), "Invalid keepAliveTimeout \"-3\". Please provide a positive integer, or -1 to disable") - - config, err = esdb.ParseConnectionString("esdb://user:pass@127.0.0.1/?keepAliveTimeout=-1") - require.NoError(t, err) - assert.Equal(t, -1, int(config.KeepAliveTimeout)) - - config, err = esdb.ParseConnectionString("esdb://user:pass@127.0.0.1/?KeepAliveTimeout=50000") - require.NoError(t, err) - assert.Equal(t, 50*time.Second, config.KeepAliveTimeout) - - // KeepAliveInterval & KeepAliveTimeout - config, err = esdb.ParseConnectionString("esdb://user:pass@127.0.0.1/?keepAliveInterval=12000&KeepAliveTimeout=15000") - require.NoError(t, err) - assert.Equal(t, 12*time.Second, config.KeepAliveInterval) - assert.Equal(t, 15*time.Second, config.KeepAliveTimeout) - - config, err = esdb.ParseConnectionString("esdb://user:pass@127.0.0.1/?keepAliveInterval=-1&KeepAliveTimeout=-1") - require.NoError(t, err) - assert.Equal(t, -1, int(config.KeepAliveInterval)) - assert.Equal(t, -1, int(config.KeepAliveTimeout)) - - config, err = esdb.ParseConnectionString("esdb://user:pass@127.0.0.1/?keepAliveInterval=-1&KeepAliveTimeout=15000") - require.NoError(t, err) - assert.Equal(t, -1, int(config.KeepAliveInterval)) - assert.Equal(t, 15*time.Second, config.KeepAliveTimeout) - - config, err = esdb.ParseConnectionString("esdb://user:pass@127.0.0.1/?keepAliveInterval=11000&KeepAliveTimeout=-1") - require.NoError(t, err) - assert.Equal(t, 11*time.Second, config.KeepAliveInterval) - assert.Equal(t, -1, int(config.KeepAliveTimeout)) -} - -func TestConnectionStringWithDefaultDeadline(t *testing.T) { - config, err := esdb.ParseConnectionString("esdb://localhost?defaultDeadline=60000") - require.NoError(t, err) - assert.NotNil(t, config.DefaultDeadline) - assert.Equal(t, *config.DefaultDeadline, 60*time.Second) -} diff --git a/esdb/position_parsing_test.go b/esdb/position_parsing_test.go deleted file mode 100644 index 2ee7af17..00000000 --- a/esdb/position_parsing_test.go +++ /dev/null @@ -1,46 +0,0 @@ -package esdb_test - -import ( - "github.com/EventStore/EventStore-Client-Go/v4/esdb" - "github.com/stretchr/testify/assert" - "testing" -) - -func TestPositionParsing(t *testing.T) { - t.Run("StreamPositionTests", func(t *testing.T) { - pos, err := esdb.ParseStreamPosition("C:123/P:456") - assert.NoError(t, err) - assert.NotNil(t, pos) - - obj, err := esdb.ParseStreamPosition("C:-1/P:-1") - assert.NoError(t, err) - - _, ok := obj.(esdb.End) - assert.True(t, ok) - - obj, err = esdb.ParseStreamPosition("C:0/P:0") - assert.NoError(t, err) - - _, ok = obj.(esdb.Start) - assert.True(t, ok) - - obj, err = esdb.ParseStreamPosition("-1") - assert.NoError(t, err) - - _, ok = obj.(esdb.End) - assert.True(t, ok) - - obj, err = esdb.ParseStreamPosition("0") - assert.NoError(t, err) - - _, ok = obj.(esdb.Start) - assert.True(t, ok) - - obj, err = esdb.ParseStreamPosition("42") - assert.NoError(t, err) - - value, ok := obj.(esdb.StreamRevision) - assert.True(t, ok) - assert.Equal(t, uint64(42), value.Value) - }) -} diff --git a/go.mod b/go.mod index eaeee533..cb1a1736 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module github.com/EventStore/EventStore-Client-Go/v4 +module github.com/EventStore/EventStore-Client-Go/v1 go 1.21 diff --git a/esdb/append_options.go b/kurrentdb/append_options.go similarity index 98% rename from esdb/append_options.go rename to kurrentdb/append_options.go index 084d6ede..d907a8ed 100644 --- a/esdb/append_options.go +++ b/kurrentdb/append_options.go @@ -1,4 +1,4 @@ -package esdb +package kurrentdb import ( "time" diff --git a/esdb/append_test.go b/kurrentdb/append_test.go similarity index 73% rename from esdb/append_test.go rename to kurrentdb/append_test.go index 0ee4865d..c71d242f 100644 --- a/esdb/append_test.go +++ b/kurrentdb/append_test.go @@ -1,21 +1,21 @@ -package esdb_test +package kurrentdb_test import ( "context" "fmt" + "github.com/EventStore/EventStore-Client-Go/v1/kurrentdb" "github.com/google/uuid" "io" "testing" "time" - "github.com/EventStore/EventStore-Client-Go/v4/esdb" "github.com/stretchr/testify/assert" ) -func createTestEvent() esdb.EventData { - event := esdb.EventData{ +func createTestEvent() kurrentdb.EventData { + event := kurrentdb.EventData{ EventType: "TestEvent", - ContentType: esdb.ContentTypeBinary, + ContentType: kurrentdb.ContentTypeBinary, EventID: uuid.New(), Data: []byte{0xb, 0xe, 0xe, 0xf}, Metadata: []byte{0xd, 0xe, 0xa, 0xd}, @@ -24,8 +24,8 @@ func createTestEvent() esdb.EventData { return event } -func collectStreamEvents(stream *esdb.ReadStream) ([]*esdb.ResolvedEvent, error) { - events := []*esdb.ResolvedEvent{} +func collectStreamEvents(stream *kurrentdb.ReadStream) ([]*kurrentdb.ResolvedEvent, error) { + events := []*kurrentdb.ResolvedEvent{} for { event, err := stream.Recv() @@ -45,7 +45,7 @@ func collectStreamEvents(stream *esdb.ReadStream) ([]*esdb.ResolvedEvent, error) type TestCall = func(t *testing.T) -func AppendTests(t *testing.T, emptyDB *Container, emptyDBClient *esdb.Client) { +func AppendTests(t *testing.T, emptyDB *Container, emptyDBClient *kurrentdb.Client) { t.Run("AppendTests", func(t *testing.T) { t.Run("appendToStreamSingleEventNoStream", appendToStreamSingleEventNoStream(emptyDBClient)) t.Run("appendWithInvalidStreamRevision", appendWithInvalidStreamRevision(emptyDBClient)) @@ -54,7 +54,7 @@ func AppendTests(t *testing.T, emptyDB *Container, emptyDBClient *esdb.Client) { }) } -func appendToStreamSingleEventNoStream(db *esdb.Client) TestCall { +func appendToStreamSingleEventNoStream(db *kurrentdb.Client) TestCall { return func(t *testing.T) { testEvent := createTestEvent() testEvent.EventID = uuid.MustParse("38fffbc2-339e-11ea-8c7b-784f43837872") @@ -63,8 +63,8 @@ func appendToStreamSingleEventNoStream(db *esdb.Client) TestCall { context, cancel := context.WithTimeout(context.Background(), time.Duration(5)*time.Second) defer cancel() - opts := esdb.AppendToStreamOptions{ - ExpectedRevision: esdb.NoStream{}, + opts := kurrentdb.AppendToStreamOptions{ + ExpectedRevision: kurrentdb.NoStream{}, } _, err := db.AppendToStream(context, streamID.String(), opts, testEvent) @@ -73,7 +73,7 @@ func appendToStreamSingleEventNoStream(db *esdb.Client) TestCall { t.Fatalf("Unexpected failure %+v", err) } - stream, err := db.ReadStream(context, streamID.String(), esdb.ReadStreamOptions{}, 1) + stream, err := db.ReadStream(context, streamID.String(), kurrentdb.ReadStreamOptions{}, 1) if err != nil { t.Fatalf("Unexpected failure %+v", err) @@ -96,20 +96,20 @@ func appendToStreamSingleEventNoStream(db *esdb.Client) TestCall { } } -func appendWithInvalidStreamRevision(db *esdb.Client) TestCall { +func appendWithInvalidStreamRevision(db *kurrentdb.Client) TestCall { return func(t *testing.T) { streamID := uuid.New() context, cancel := context.WithTimeout(context.Background(), time.Duration(5)*time.Second) defer cancel() - opts := esdb.AppendToStreamOptions{ - ExpectedRevision: esdb.StreamExists{}, + opts := kurrentdb.AppendToStreamOptions{ + ExpectedRevision: kurrentdb.StreamExists{}, } _, err := db.AppendToStream(context, streamID.String(), opts, createTestEvent()) - esdbErr, ok := esdb.FromError(err) + esdbErr, ok := kurrentdb.FromError(err) assert.False(t, ok) - assert.Equal(t, esdbErr.Code(), esdb.ErrorCodeWrongExpectedVersion) + assert.Equal(t, esdbErr.Code(), kurrentdb.ErrorCodeWrongExpectedVersion) } } @@ -122,12 +122,12 @@ func appendToSystemStreamWithIncorrectCredentials(container *Container) TestCall } conn := fmt.Sprintf("esdb://bad_user:bad_password@%s?tlsverifycert=false", container.Endpoint) - config, err := esdb.ParseConnectionString(conn) + config, err := kurrentdb.ParseConnectionString(conn) if err != nil { t.Fatalf("Unexpected configuration error: %s", err.Error()) } - db, err := esdb.NewClient(config) + db, err := kurrentdb.NewClient(config) if err != nil { t.Fatalf("Unexpected failure setting up test connection: %s", err.Error()) } @@ -138,35 +138,35 @@ func appendToSystemStreamWithIncorrectCredentials(container *Container) TestCall context, cancel := context.WithTimeout(context.Background(), 1*time.Minute) defer cancel() - opts := esdb.AppendToStreamOptions{ - ExpectedRevision: esdb.Any{}, + opts := kurrentdb.AppendToStreamOptions{ + ExpectedRevision: kurrentdb.Any{}, } _, err = db.AppendToStream(context, streamID.String(), opts, createTestEvent()) - esdbErr, ok := esdb.FromError(err) + esdbErr, ok := kurrentdb.FromError(err) assert.False(t, ok) - assert.Equal(t, esdbErr.Code(), esdb.ErrorCodeUnauthenticated) + assert.Equal(t, esdbErr.Code(), kurrentdb.ErrorCodeUnauthenticated) } } -func metadataOperation(db *esdb.Client) TestCall { +func metadataOperation(db *kurrentdb.Client) TestCall { return func(t *testing.T) { streamID := uuid.New() context, cancel := context.WithTimeout(context.Background(), time.Duration(5)*time.Second) defer cancel() - opts := esdb.AppendToStreamOptions{ - ExpectedRevision: esdb.Any{}, + opts := kurrentdb.AppendToStreamOptions{ + ExpectedRevision: kurrentdb.Any{}, } _, err := db.AppendToStream(context, streamID.String(), opts, createTestEvent()) assert.Nil(t, err, "error when writing an event") - acl := esdb.Acl{} + acl := kurrentdb.Acl{} acl.AddReadRoles("admin") - meta := esdb.StreamMetadata{} + meta := kurrentdb.StreamMetadata{} meta.SetMaxAge(2 * time.Second) meta.SetAcl(acl) @@ -175,7 +175,7 @@ func metadataOperation(db *esdb.Client) TestCall { assert.Nil(t, err, "no error from writing stream metadata") assert.NotNil(t, result, "defined write result after writing metadata") - metaActual, err := db.GetStreamMetadata(context, streamID.String(), esdb.ReadStreamOptions{}) + metaActual, err := db.GetStreamMetadata(context, streamID.String(), kurrentdb.ReadStreamOptions{}) assert.Nil(t, err, "no error when reading stream metadata") diff --git a/esdb/auth_insecure_test.go b/kurrentdb/auth_insecure_test.go similarity index 65% rename from esdb/auth_insecure_test.go rename to kurrentdb/auth_insecure_test.go index 7238810f..bd454fbd 100644 --- a/esdb/auth_insecure_test.go +++ b/kurrentdb/auth_insecure_test.go @@ -1,26 +1,25 @@ -package esdb_test +package kurrentdb_test import ( "context" + "github.com/EventStore/EventStore-Client-Go/v1/kurrentdb" "testing" "time" - - "github.com/EventStore/EventStore-Client-Go/v4/esdb" ) -func InsecureAuthenticationTests(t *testing.T, client *esdb.Client) { +func InsecureAuthenticationTests(t *testing.T, client *kurrentdb.Client) { t.Run("AuthenticationTests", func(t *testing.T) { t.Run("callInsecureWithoutCredentials", callInsecureWithoutCredentials(client)) t.Run("callInsecureWithInvalidCredentials", callInsecureWithInvalidCredentials(client)) }) } -func callInsecureWithoutCredentials(db *esdb.Client) TestCall { +func callInsecureWithoutCredentials(db *kurrentdb.Client) TestCall { return func(t *testing.T) { context, cancel := context.WithTimeout(context.Background(), time.Duration(5)*time.Second) defer cancel() - err := db.CreatePersistentSubscription(context, NAME_GENERATOR.Generate(), NAME_GENERATOR.Generate(), esdb.PersistentStreamSubscriptionOptions{}) + err := db.CreatePersistentSubscription(context, NAME_GENERATOR.Generate(), NAME_GENERATOR.Generate(), kurrentdb.PersistentStreamSubscriptionOptions{}) if err != nil { t.Fatalf("Unexpected failure %+v", err) @@ -28,13 +27,13 @@ func callInsecureWithoutCredentials(db *esdb.Client) TestCall { } } -func callInsecureWithInvalidCredentials(db *esdb.Client) TestCall { +func callInsecureWithInvalidCredentials(db *kurrentdb.Client) TestCall { return func(t *testing.T) { context, cancel := context.WithTimeout(context.Background(), time.Duration(5)*time.Second) defer cancel() - opts := esdb.PersistentStreamSubscriptionOptions{ - Authenticated: &esdb.Credentials{ + opts := kurrentdb.PersistentStreamSubscriptionOptions{ + Authenticated: &kurrentdb.Credentials{ Login: "invalid", Password: "invalid", }, diff --git a/esdb/auth_secure_test.go b/kurrentdb/auth_secure_test.go similarity index 68% rename from esdb/auth_secure_test.go rename to kurrentdb/auth_secure_test.go index 957064ba..55539e13 100644 --- a/esdb/auth_secure_test.go +++ b/kurrentdb/auth_secure_test.go @@ -1,14 +1,13 @@ -package esdb_test +package kurrentdb_test import ( "context" + "github.com/EventStore/EventStore-Client-Go/v1/kurrentdb" "testing" "time" - - "github.com/EventStore/EventStore-Client-Go/v4/esdb" ) -func SecureAuthenticationTests(t *testing.T, client *esdb.Client) { +func SecureAuthenticationTests(t *testing.T, client *kurrentdb.Client) { t.Run("AuthenticationTests", func(t *testing.T) { t.Run("callWithTLSAndDefaultCredentials", callWithTLSAndDefaultCredentials(client)) t.Run("callWithTLSAndOverrideCredentials", callWithTLSAndOverrideCredentials(client)) @@ -16,12 +15,12 @@ func SecureAuthenticationTests(t *testing.T, client *esdb.Client) { }) } -func callWithTLSAndDefaultCredentials(db *esdb.Client) TestCall { +func callWithTLSAndDefaultCredentials(db *kurrentdb.Client) TestCall { return func(t *testing.T) { context, cancel := context.WithTimeout(context.Background(), time.Duration(5)*time.Second) defer cancel() - err := db.CreatePersistentSubscription(context, NAME_GENERATOR.Generate(), NAME_GENERATOR.Generate(), esdb.PersistentStreamSubscriptionOptions{}) + err := db.CreatePersistentSubscription(context, NAME_GENERATOR.Generate(), NAME_GENERATOR.Generate(), kurrentdb.PersistentStreamSubscriptionOptions{}) if err != nil { t.Fatalf("Unexpected failure %+v", err) @@ -29,13 +28,13 @@ func callWithTLSAndDefaultCredentials(db *esdb.Client) TestCall { } } -func callWithTLSAndOverrideCredentials(db *esdb.Client) TestCall { +func callWithTLSAndOverrideCredentials(db *kurrentdb.Client) TestCall { return func(t *testing.T) { context, cancel := context.WithTimeout(context.Background(), time.Duration(5)*time.Second) defer cancel() - opts := esdb.PersistentStreamSubscriptionOptions{ - Authenticated: &esdb.Credentials{ + opts := kurrentdb.PersistentStreamSubscriptionOptions{ + Authenticated: &kurrentdb.Credentials{ Login: "admin", Password: "changeit", }, @@ -48,13 +47,13 @@ func callWithTLSAndOverrideCredentials(db *esdb.Client) TestCall { } } -func callWithTLSAndInvalidOverrideCredentials(db *esdb.Client) TestCall { +func callWithTLSAndInvalidOverrideCredentials(db *kurrentdb.Client) TestCall { return func(t *testing.T) { context, cancel := context.WithTimeout(context.Background(), time.Duration(5)*time.Second) defer cancel() - opts := esdb.PersistentStreamSubscriptionOptions{ - Authenticated: &esdb.Credentials{ + opts := kurrentdb.PersistentStreamSubscriptionOptions{ + Authenticated: &kurrentdb.Credentials{ Login: "invalid", Password: "invalid", }, diff --git a/esdb/client.go b/kurrentdb/client.go similarity index 98% rename from esdb/client.go rename to kurrentdb/client.go index bd46b532..74e2cfca 100644 --- a/esdb/client.go +++ b/kurrentdb/client.go @@ -1,5 +1,5 @@ -// Package esdb EventStoreDB gRPC client. -package esdb +// Package kurrentdb KurrentDB gRPC client. +package kurrentdb import ( "context" @@ -9,23 +9,23 @@ import ( "io" "strconv" - "github.com/EventStore/EventStore-Client-Go/v4/protos/gossip" - persistentProto "github.com/EventStore/EventStore-Client-Go/v4/protos/persistent" - "github.com/EventStore/EventStore-Client-Go/v4/protos/shared" + "github.com/EventStore/EventStore-Client-Go/v1/protos/gossip" + persistentProto "github.com/EventStore/EventStore-Client-Go/v1/protos/persistent" + "github.com/EventStore/EventStore-Client-Go/v1/protos/shared" "google.golang.org/grpc" "google.golang.org/grpc/metadata" - api "github.com/EventStore/EventStore-Client-Go/v4/protos/streams" + api "github.com/EventStore/EventStore-Client-Go/v1/protos/streams" ) -// Client Represents a client to a single node. A client instance maintains a full duplex communication to EventStoreDB. -// Many threads can use an EventStoreDB client at the same time or a single thread can make many asynchronous requests. +// Client Represents a client to a single node. A client instance maintains a full duplex communication to KurrentDB. +// Many threads can use an KurrentDB client at the same time or a single thread can make many asynchronous requests. type Client struct { grpcClient *grpcClient config *Configuration } -// NewClient Creates a gRPC client to an EventStoreDB database. +// NewClient Creates a gRPC client to an KurrentDB database. func NewClient(configuration *Configuration) (*Client, error) { if err := configuration.Validate(); err != nil { return nil, fmt.Errorf("invalid configuration: %w", err) diff --git a/esdb/client_certificates_test.go b/kurrentdb/client_certificates_test.go similarity index 76% rename from esdb/client_certificates_test.go rename to kurrentdb/client_certificates_test.go index e4151bdc..18e9fbd1 100644 --- a/esdb/client_certificates_test.go +++ b/kurrentdb/client_certificates_test.go @@ -1,10 +1,10 @@ -package esdb_test +package kurrentdb_test import ( "context" "errors" "fmt" - "github.com/EventStore/EventStore-Client-Go/v4/esdb" + "github.com/EventStore/EventStore-Client-Go/v1/kurrentdb" "github.com/google/uuid" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" @@ -54,12 +54,12 @@ func testValidClientCertificatesTlsWithRelativePath(t *testing.T, endpoint strin userCertFile := "../certs/user-admin/user-admin.crt" userKeyFile := "../certs/user-admin/user-admin.key" - config, err := esdb.ParseConnectionString(fmt.Sprintf("esdb://admin:changeit@%s?tls=true&tlscafile=%s&userCertFile=%s&userKeyFile=%s", endpoint, tlsCaFile, userCertFile, userKeyFile)) + config, err := kurrentdb.ParseConnectionString(fmt.Sprintf("esdb://admin:changeit@%s?tls=true&tlscafile=%s&userCertFile=%s&userKeyFile=%s", endpoint, tlsCaFile, userCertFile, userKeyFile)) if err != nil { t.Fatalf("Unexpected configuration error: %s", err.Error()) } - c, err := esdb.NewClient(config) + c, err := kurrentdb.NewClient(config) if err != nil { t.Fatalf("Unexpected error: %s", err.Error()) } @@ -67,9 +67,9 @@ func testValidClientCertificatesTlsWithRelativePath(t *testing.T, endpoint strin numberOfEventsToRead := 1 numberOfEvents := uint64(numberOfEventsToRead) - opts := esdb.ReadAllOptions{ - From: esdb.Start{}, - Direction: esdb.Backwards, + opts := kurrentdb.ReadAllOptions{ + From: kurrentdb.Start{}, + Direction: kurrentdb.Backwards, ResolveLinkTos: true, } @@ -97,12 +97,12 @@ func testValidClientCertificatesTlsWithAbsolutePath(t *testing.T, endpoint strin t.Fatalf("Unexpected error: %s", err.Error()) } - config, err := esdb.ParseConnectionString(fmt.Sprintf("esdb://admin:changeit@%s?tls=true&tlscafile=%s&usercertfile=%s&userkeyfile=%s", endpoint, tlsCaFile, userCertFile, userKeyFile)) + config, err := kurrentdb.ParseConnectionString(fmt.Sprintf("esdb://admin:changeit@%s?tls=true&tlscafile=%s&usercertfile=%s&userkeyfile=%s", endpoint, tlsCaFile, userCertFile, userKeyFile)) if err != nil { t.Fatalf("Unexpected configuration error: %s", err.Error()) } - c, err := esdb.NewClient(config) + c, err := kurrentdb.NewClient(config) if err != nil { t.Fatalf("Unexpected error: %s", err.Error()) } @@ -110,9 +110,9 @@ func testValidClientCertificatesTlsWithAbsolutePath(t *testing.T, endpoint strin numberOfEventsToRead := 1 numberOfEvents := uint64(numberOfEventsToRead) - opts := esdb.ReadAllOptions{ - From: esdb.Start{}, - Direction: esdb.Backwards, + opts := kurrentdb.ReadAllOptions{ + From: kurrentdb.Start{}, + Direction: kurrentdb.Backwards, ResolveLinkTos: true, } @@ -129,12 +129,12 @@ func testInvalidUserCertificates(t *testing.T, endpoint string) { userCertFile := "../certs/user-invalid/user-invalid.crt" userKeyFile := "../certs/user-invalid/user-invalid.key" - config, err := esdb.ParseConnectionString(fmt.Sprintf("esdb://admin:changeit@%s?tls=true&tlscafile=%s&usercertfile=%s&userkeyfile=%s", endpoint, tlsCaFile, userCertFile, userKeyFile)) + config, err := kurrentdb.ParseConnectionString(fmt.Sprintf("esdb://admin:changeit@%s?tls=true&tlscafile=%s&usercertfile=%s&userkeyfile=%s", endpoint, tlsCaFile, userCertFile, userKeyFile)) if err != nil { t.Fatalf("Unexpected configuration error: %s", err.Error()) } - c, err := esdb.NewClient(config) + c, err := kurrentdb.NewClient(config) if err != nil { t.Fatalf("Unexpected error: %s", err.Error()) } @@ -143,8 +143,8 @@ func testInvalidUserCertificates(t *testing.T, endpoint string) { testEvent := createTestEvent() streamID := uuid.NewString() - opts := esdb.AppendToStreamOptions{ - ExpectedRevision: esdb.Any{}, + opts := kurrentdb.AppendToStreamOptions{ + ExpectedRevision: kurrentdb.Any{}, } result, err := c.AppendToStream(context.Background(), streamID, opts, testEvent) @@ -157,10 +157,10 @@ func testMissingCertificateFile(t *testing.T, endpoint string) { tlsCaFile := "../certs/ca/ca.crt" userCertFile := "../certs/user-admin/user-admin.crt" - config, err := esdb.ParseConnectionString(fmt.Sprintf("esdb://admin:changeit@%s?tls=true&tlscafile=%s&usercertfile=%s", endpoint, tlsCaFile, userCertFile)) + config, err := kurrentdb.ParseConnectionString(fmt.Sprintf("esdb://admin:changeit@%s?tls=true&tlscafile=%s&usercertfile=%s", endpoint, tlsCaFile, userCertFile)) - _, err = esdb.NewClient(config) - esdbErr, ok := esdb.FromError(err) + _, err = kurrentdb.NewClient(config) + esdbErr, ok := kurrentdb.FromError(err) require.False(t, ok) require.NotNil(t, esdbErr) assert.Contains(t, esdbErr.Error(), "both userCertFile and userKeyFile must be provided") diff --git a/esdb/client_test.go b/kurrentdb/client_test.go similarity index 99% rename from esdb/client_test.go rename to kurrentdb/client_test.go index 1e16333b..dac2b78a 100644 --- a/esdb/client_test.go +++ b/kurrentdb/client_test.go @@ -1,4 +1,4 @@ -package esdb_test +package kurrentdb_test import ( "testing" diff --git a/esdb/cluster_test.go b/kurrentdb/cluster_test.go similarity index 85% rename from esdb/cluster_test.go rename to kurrentdb/cluster_test.go index f90a1c35..8ca3277c 100644 --- a/esdb/cluster_test.go +++ b/kurrentdb/cluster_test.go @@ -1,15 +1,15 @@ -package esdb_test +package kurrentdb_test import ( "context" "crypto/tls" "fmt" + "github.com/EventStore/EventStore-Client-Go/v1/kurrentdb" "net/http" "testing" "time" - "github.com/EventStore/EventStore-Client-Go/v4/esdb" - "github.com/EventStore/EventStore-Client-Go/v4/protos/gossip" + "github.com/EventStore/EventStore-Client-Go/v1/protos/gossip" "github.com/stretchr/testify/assert" ) @@ -36,10 +36,10 @@ func notLeaderExceptionButWorkAfterRetry(t *testing.T) { defer db.Close() streamID := NAME_GENERATOR.Generate() - err := db.CreatePersistentSubscription(ctx, streamID, "a_group", esdb.PersistentStreamSubscriptionOptions{}) + err := db.CreatePersistentSubscription(ctx, streamID, "a_group", kurrentdb.PersistentStreamSubscriptionOptions{}) - if esdbError, ok := esdb.FromError(err); !ok { - if esdbError.IsErrorCode(esdb.ErrorCodeResourceAlreadyExists) { + if esdbError, ok := kurrentdb.FromError(err); !ok { + if esdbError.IsErrorCode(kurrentdb.ErrorCodeResourceAlreadyExists) { // Name generator is not random enough. time.Sleep(1 * time.Second) continue @@ -49,10 +49,10 @@ func notLeaderExceptionButWorkAfterRetry(t *testing.T) { assert.NotNil(t, err) // It should work now as the db automatically reconnected to the leader node. - err = db.CreatePersistentSubscription(ctx, streamID, "a_group", esdb.PersistentStreamSubscriptionOptions{}) + err = db.CreatePersistentSubscription(ctx, streamID, "a_group", kurrentdb.PersistentStreamSubscriptionOptions{}) - if esdbErr, ok := esdb.FromError(err); !ok { - if esdbErr.IsErrorCode(esdb.ErrorCodeResourceAlreadyExists) { + if esdbErr, ok := kurrentdb.FromError(err); !ok { + if esdbErr.IsErrorCode(kurrentdb.ErrorCodeResourceAlreadyExists) { // Freak accident considering we use random stream name, safe to assume the test was // successful. return @@ -77,7 +77,7 @@ func readStreamAfterClusterRebalance(t *testing.T) { streamID := NAME_GENERATOR.Generate() // Start reading the stream - options := esdb.ReadStreamOptions{From: esdb.Start{}} + options := kurrentdb.ReadStreamOptions{From: kurrentdb.Start{}} stream, err := db.ReadStream(ctx, streamID, options, 10) if err != nil { diff --git a/esdb/configuration.go b/kurrentdb/configuration.go similarity index 93% rename from esdb/configuration.go rename to kurrentdb/configuration.go index dc59303d..68a8d8b5 100644 --- a/esdb/configuration.go +++ b/kurrentdb/configuration.go @@ -1,4 +1,4 @@ -package esdb +package kurrentdb import ( "crypto/x509" @@ -11,10 +11,16 @@ import ( "time" ) -const ( - schemeName = "esdb" - schemeNameWithDiscover = "esdb+discover" -) +var supportedProtocols = map[string]struct{}{ + "esdb": {}, + "esdb+discover": {}, + "kdb": {}, + "kdb+discover": {}, + "kurrent": {}, + "kurrent+discover": {}, + "kurrentdb": {}, + "kurrentdb+discover": {}, +} var basepath string @@ -23,9 +29,9 @@ func init() { basepath = cwd } -// Configuration describes how to connect to an instance of EventStoreDB. +// Configuration describes how to connect to an instance of KurrentDB. type Configuration struct { - // The URI of the EventStoreDB. Use this when connecting to a single node. + // The URI of the KurrentDB. Use this when connecting to a single node. // Example: localhost:2113 Address string @@ -38,10 +44,10 @@ type Configuration struct { // The NodePreference to use when connecting. NodePreference NodePreference - // The username to use for authenticating against the EventStoreDB instance. + // The username to use for authenticating against the KurrentDB instance. Username string - // The password to use for authenticating against the EventStoreDB instance. + // The password to use for authenticating against the KurrentDB instance. Password string // RootCAs defines the set of root certificate authorities @@ -205,11 +211,11 @@ func parseEndpoint(host string) (*EndPoint, error) { } func parseFromUrl(config *Configuration, url *url2.URL) (*Configuration, error) { - if url.Scheme != schemeName && url.Scheme != schemeNameWithDiscover { - return nil, fmt.Errorf("an invalid scheme is specified, expecting esdb:// or esdb+discover://") + if _, exists := supportedProtocols[url.Scheme]; !exists { + return nil, fmt.Errorf("an invalid scheme is specified") } - config.DnsDiscover = url.Scheme == schemeNameWithDiscover + config.DnsDiscover = strings.Contains(url.Scheme, "+discover") if url.User != nil { config.Username = url.User.Username() diff --git a/kurrentdb/configuration_test.go b/kurrentdb/configuration_test.go new file mode 100644 index 00000000..cd9837f0 --- /dev/null +++ b/kurrentdb/configuration_test.go @@ -0,0 +1,599 @@ +package kurrentdb_test + +import ( + "testing" + "time" + + "github.com/EventStore/EventStore-Client-Go/v1/kurrentdb" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" +) + +func ConnectionStringTests(t *testing.T) { + t.Run("ConnectionStringTests", func(t *testing.T) { + TestConnectionStringDefaults(t) + TestConnectionStringDefaultsDiscover(t) + TestConnectionStringDefaultsKurrent(t) + TestConnectionStringDefaultsKurrentDiscover(t) + TestConnectionStringDefaultsKdb(t) + TestConnectionStringDefaultsKdbDiscover(t) + TestConnectionStringWithNoSchema(t) + TestConnectionStringWithInvalidScheme(t) + TestConnectionStringWithInvalidUserCredentials(t) + TestConnectionStringWithInvalidHost(t) + TestConnectionStringWithEmptyPath(t) + TestConnectionStringWithNonEmptyPath(t) + TestConnectionStringWithoutSettings(t) + TestConnectionStringWithInvalidKeyValuePair(t) + TestConnectionStringWithInvalidSettings(t) + TestConnectionStringWithDifferentNodePreferences(t) + TestConnectionStringWithValidSingleNodeConnectionString(t) + TestConnectionStringWithValidClusterConnectionString(t) + TestConnectionStringWithDifferentTLSSettings(t) + TestConnectionStringWithDifferentTLSVerifySettings(t) + TestConnectionStringWithoutCertificateFile(t) + TestConnectionStringWithCertificateFile(t) + TestConnectionStringWithKeepAlive(t) + TestConnectionStringWithDefaultDeadline(t) + }) +} + +func TestConnectionStringDefaults(t *testing.T) { + config, err := kurrentdb.ParseConnectionString("esdb://localhost") + assert.NoError(t, err) + assert.Equal(t, "localhost:2113", config.Address) + assert.Equal(t, 100, config.DiscoveryInterval) + assert.Equal(t, 5, config.GossipTimeout) + assert.Equal(t, 10, config.MaxDiscoverAttempts) + assert.Equal(t, 10*time.Second, config.KeepAliveInterval) + assert.Equal(t, 10*time.Second, config.KeepAliveTimeout) + assert.Equal(t, kurrentdb.NodePreferenceLeader, config.NodePreference) +} + +func TestConnectionStringDefaultsDiscover(t *testing.T) { + config, err := kurrentdb.ParseConnectionString("esdb+discover://localhost") + assert.NoError(t, err) + assert.Equal(t, "localhost:2113", config.Address) + assert.Equal(t, 100, config.DiscoveryInterval) + assert.Equal(t, 5, config.GossipTimeout) + assert.Equal(t, 10, config.MaxDiscoverAttempts) + assert.Equal(t, 10*time.Second, config.KeepAliveInterval) + assert.Equal(t, 10*time.Second, config.KeepAliveTimeout) + assert.Equal(t, kurrentdb.NodePreferenceLeader, config.NodePreference) + assert.True(t, config.DnsDiscover) +} + +func TestConnectionStringDefaultsKurrent(t *testing.T) { + config, err := kurrentdb.ParseConnectionString("kurrent://localhost") + assert.NoError(t, err) + assert.Equal(t, "localhost:2113", config.Address) + assert.Equal(t, 100, config.DiscoveryInterval) + assert.Equal(t, 5, config.GossipTimeout) + assert.Equal(t, 10, config.MaxDiscoverAttempts) + assert.Equal(t, 10*time.Second, config.KeepAliveInterval) + assert.Equal(t, 10*time.Second, config.KeepAliveTimeout) + assert.Equal(t, kurrentdb.NodePreferenceLeader, config.NodePreference) +} + +func TestConnectionStringDefaultsKurrentDiscover(t *testing.T) { + config, err := kurrentdb.ParseConnectionString("kurrent+discover://localhost") + assert.NoError(t, err) + assert.Equal(t, "localhost:2113", config.Address) + assert.Equal(t, 100, config.DiscoveryInterval) + assert.Equal(t, 5, config.GossipTimeout) + assert.Equal(t, 10, config.MaxDiscoverAttempts) + assert.Equal(t, 10*time.Second, config.KeepAliveInterval) + assert.Equal(t, 10*time.Second, config.KeepAliveTimeout) + assert.Equal(t, kurrentdb.NodePreferenceLeader, config.NodePreference) + assert.True(t, config.DnsDiscover) +} + +func TestConnectionStringDefaultsKdb(t *testing.T) { + config, err := kurrentdb.ParseConnectionString("kdb://localhost") + assert.NoError(t, err) + assert.Equal(t, "localhost:2113", config.Address) + assert.Equal(t, 100, config.DiscoveryInterval) + assert.Equal(t, 5, config.GossipTimeout) + assert.Equal(t, 10, config.MaxDiscoverAttempts) + assert.Equal(t, 10*time.Second, config.KeepAliveInterval) + assert.Equal(t, 10*time.Second, config.KeepAliveTimeout) + assert.Equal(t, kurrentdb.NodePreferenceLeader, config.NodePreference) +} + +func TestConnectionStringDefaultsKdbDiscover(t *testing.T) { + config, err := kurrentdb.ParseConnectionString("kdb+discover://localhost") + assert.NoError(t, err) + assert.Equal(t, "localhost:2113", config.Address) + assert.Equal(t, 100, config.DiscoveryInterval) + assert.Equal(t, 5, config.GossipTimeout) + assert.Equal(t, 10, config.MaxDiscoverAttempts) + assert.Equal(t, 10*time.Second, config.KeepAliveInterval) + assert.Equal(t, 10*time.Second, config.KeepAliveTimeout) + assert.Equal(t, kurrentdb.NodePreferenceLeader, config.NodePreference) + assert.True(t, config.DnsDiscover) +} + +func TestConnectionStringDefaultsKurrentDb(t *testing.T) { + config, err := kurrentdb.ParseConnectionString("kurrentbd://localhost") + assert.NoError(t, err) + assert.Equal(t, "localhost:2113", config.Address) + assert.Equal(t, 100, config.DiscoveryInterval) + assert.Equal(t, 5, config.GossipTimeout) + assert.Equal(t, 10, config.MaxDiscoverAttempts) + assert.Equal(t, 10*time.Second, config.KeepAliveInterval) + assert.Equal(t, 10*time.Second, config.KeepAliveTimeout) + assert.Equal(t, kurrentdb.NodePreferenceLeader, config.NodePreference) +} + +func TestConnectionStringDefaultsKurrentDbDiscover(t *testing.T) { + config, err := kurrentdb.ParseConnectionString("kurrentbd+discover://localhost") + assert.NoError(t, err) + assert.Equal(t, "localhost:2113", config.Address) + assert.Equal(t, 100, config.DiscoveryInterval) + assert.Equal(t, 5, config.GossipTimeout) + assert.Equal(t, 10, config.MaxDiscoverAttempts) + assert.Equal(t, 10*time.Second, config.KeepAliveInterval) + assert.Equal(t, 10*time.Second, config.KeepAliveTimeout) + assert.Equal(t, kurrentdb.NodePreferenceLeader, config.NodePreference) + assert.True(t, config.DnsDiscover) +} + +func TestConnectionStringWithNoSchema(t *testing.T) { + config, err := kurrentdb.ParseConnectionString(":so/mething/random") + require.Error(t, err) + assert.Nil(t, config) +} + +func TestConnectionStringWithInvalidScheme(t *testing.T) { + config, err := kurrentdb.ParseConnectionString("esdbwrong://") + require.Error(t, err) + assert.Nil(t, config) +} + +func TestConnectionStringWithInvalidUserCredentials(t *testing.T) { + config, err := kurrentdb.ParseConnectionString("esdb://@127.0.0.1/") + require.Error(t, err) + + config, err = kurrentdb.ParseConnectionString("esdb://:pass@127.0.0.1/") + require.Error(t, err) + assert.Nil(t, config) +} + +func TestConnectionStringWithInvalidHost(t *testing.T) { + config, err := kurrentdb.ParseConnectionString("esdb://") + require.Error(t, err) + assert.Nil(t, config) + + config, err = kurrentdb.ParseConnectionString("esdb://user:pass@") + require.Error(t, err) + assert.Nil(t, config) + + config, err = kurrentdb.ParseConnectionString("esdb://user:pass@127.0.0.1:abc") + require.Error(t, err) + assert.Nil(t, config) + + config, err = kurrentdb.ParseConnectionString("esdb://user:pass@127.0.0.1:1234,127.0.0.2:abc,127.0.0.3:4321") + require.Error(t, err) + assert.Nil(t, config) + + config, err = kurrentdb.ParseConnectionString("esdb://user:pass@127.0.0.1:abc:def") + require.Error(t, err) + assert.Nil(t, config) + + config, err = kurrentdb.ParseConnectionString("esdb://user:pass@localhost:1234,127.0.0.2:abc:def,127.0.0.3:4321") + require.Error(t, err) + assert.Nil(t, config) + + config, err = kurrentdb.ParseConnectionString("esdb://user:pass@localhost:1234,,127.0.0.3:4321") + require.Error(t, err) + assert.Nil(t, config) +} + +func TestConnectionStringWithEmptyPath(t *testing.T) { + config, err := kurrentdb.ParseConnectionString("esdb://user:pass@127.0.0.1") + assert.Nil(t, err) + assert.NotNil(t, config) + + config, err = kurrentdb.ParseConnectionString("esdb://user:pass@127.0.0.1:1234") + assert.Nil(t, err) + assert.NotNil(t, config) + + config, err = kurrentdb.ParseConnectionString("esdb://user:pass@127.0.0.1/") + assert.Nil(t, err) + assert.NotNil(t, config) + + config, err = kurrentdb.ParseConnectionString("esdb://user:pass@127.0.0.1?maxDiscoverAttempts=10") + assert.Nil(t, err) + assert.NotNil(t, config) + + config, err = kurrentdb.ParseConnectionString("esdb://user:pass@127.0.0.1/?maxDiscoverAttempts=10") + assert.Nil(t, err) + assert.NotNil(t, config) +} + +func TestConnectionStringWithNonEmptyPath(t *testing.T) { + config, err := kurrentdb.ParseConnectionString("esdb://user:pass@127.0.0.1/test") + require.Error(t, err) + assert.Nil(t, config) + + config, err = kurrentdb.ParseConnectionString("esdb://user:pass@127.0.0.1/maxDiscoverAttempts=10") + require.Error(t, err) + assert.Nil(t, config) + + config, err = kurrentdb.ParseConnectionString("esdb://user:pass@127.0.0.1/hello?maxDiscoverAttempts=10") + require.Error(t, err) + assert.Nil(t, config) +} + +func TestConnectionStringWithoutSettings(t *testing.T) { + config, err := kurrentdb.ParseConnectionString("esdb://localhost") + assert.NoError(t, err) + assert.Equal(t, "localhost:2113", config.Address) + + config, err = kurrentdb.ParseConnectionString("esdb://localhost:2114") + assert.NoError(t, err) + assert.Equal(t, "localhost:2114", config.Address) + + config, err = kurrentdb.ParseConnectionString("esdb://user:pass@localhost:2114") + assert.NoError(t, err) + assert.Equal(t, "localhost:2114", config.Address) + assert.Equal(t, "user", config.Username) + assert.Equal(t, "pass", config.Password) + + config, err = kurrentdb.ParseConnectionString("esdb://user:pass@localhost:2114/") + assert.NoError(t, err) + assert.Equal(t, "localhost:2114", config.Address) + assert.Equal(t, "user", config.Username) + assert.Equal(t, "pass", config.Password) + + config, err = kurrentdb.ParseConnectionString("esdb://user:pass@127.0.0.1") + assert.Nil(t, err) + assert.NotNil(t, config) + assert.Equal(t, "user", config.Username) + assert.Equal(t, "pass", config.Password) + + config, err = kurrentdb.ParseConnectionString("esdb://user:pass@127.0.0.1/") + assert.Nil(t, err) + assert.NotNil(t, config) + assert.Equal(t, "user", config.Username) + assert.Equal(t, "pass", config.Password) + + config, err = kurrentdb.ParseConnectionString("esdb://user:pass@127.0.0.1/?") + assert.Nil(t, err) + assert.NotNil(t, config) + assert.Equal(t, "user", config.Username) + assert.Equal(t, "pass", config.Password) +} + +func TestConnectionStringWithInvalidKeyValuePair(t *testing.T) { + config, err := kurrentdb.ParseConnectionString("esdb://user:pass@127.0.0.1/?maxDiscoverAttempts=12=34") + require.Error(t, err) + assert.Nil(t, config) + + config, err = kurrentdb.ParseConnectionString("esdb://user:pass@127.0.0.1/?maxDiscoverAttempts1234") + assert.Nil(t, err) + assert.NotNil(t, config) +} + +func TestConnectionStringWithInvalidSettings(t *testing.T) { + config, err := kurrentdb.ParseConnectionString("esdb://user:pass@127.0.0.1/?maxDiscoverAttempts=") + require.Error(t, err) + assert.Nil(t, config) + + config, err = kurrentdb.ParseConnectionString("esdb://user:pass@127.0.0.1/?maxDiscoverAttempts=abcd") + require.Error(t, err) + assert.Nil(t, config) + + config, err = kurrentdb.ParseConnectionString("esdb://user:pass@127.0.0.1/?discoveryInterval=abcd") + require.Error(t, err) + assert.Nil(t, config) + + config, err = kurrentdb.ParseConnectionString("esdb://user:pass@127.0.0.1/?gossipTimeout=defg") + require.Error(t, err) + assert.Nil(t, config) + + config, err = kurrentdb.ParseConnectionString("esdb://user:pass@127.0.0.1/?tlsVerifyCert=truee") + require.Error(t, err) + assert.Nil(t, config) + + config, err = kurrentdb.ParseConnectionString("esdb://user:pass@127.0.0.1/?nodePreference=blabla") + require.Error(t, err) + assert.Nil(t, config) + + config, err = kurrentdb.ParseConnectionString("esdb://user:pass@127.0.0.1?/") + assert.Nil(t, err) + assert.NotNil(t, config) +} + +func TestConnectionStringWithDifferentNodePreferences(t *testing.T) { + config, err := kurrentdb.ParseConnectionString("esdb://user:pass@127.0.0.1/?nodePreference=leader") + assert.NoError(t, err) + assert.Equal(t, kurrentdb.NodePreferenceLeader, config.NodePreference) + + config, err = kurrentdb.ParseConnectionString("esdb://user:pass@127.0.0.1/?nodePreference=Follower") + assert.NoError(t, err) + assert.Equal(t, kurrentdb.NodePreferenceFollower, config.NodePreference) + + config, err = kurrentdb.ParseConnectionString("esdb://user:pass@127.0.0.1/?nodePreference=rAndom") + assert.NoError(t, err) + assert.Equal(t, kurrentdb.NodePreferenceRandom, config.NodePreference) + + config, err = kurrentdb.ParseConnectionString("esdb://user:pass@127.0.0.1/?nodePreference=ReadOnlyReplica") + assert.NoError(t, err) + assert.Equal(t, kurrentdb.NodePreferenceReadOnlyReplica, config.NodePreference) + + config, err = kurrentdb.ParseConnectionString("esdb://user:pass@127.0.0.1/?nodePreference=invalid") + require.Error(t, err) + assert.Nil(t, config) + assert.Contains(t, err.Error(), "Invalid NodePreference") +} + +func TestConnectionStringWithValidSingleNodeConnectionString(t *testing.T) { + config, err := kurrentdb.ParseConnectionString("esdb://user:pass@localhost:2114?tlsVerifyCert=false") + require.NoError(t, err) + assert.Equal(t, "user", config.Username) + assert.Equal(t, "pass", config.Password) + assert.Equal(t, "localhost:2114", config.Address) + assert.Equal(t, true, config.SkipCertificateVerification) + assert.Equal(t, false, config.DnsDiscover) + + config, err = kurrentdb.ParseConnectionString("esdb://user:pass@localhost:2114?tls=false") + assert.NoError(t, err) + assert.Equal(t, "user", config.Username) + assert.Equal(t, "pass", config.Password) + assert.Equal(t, "localhost:2114", config.Address) + + config, err = kurrentdb.ParseConnectionString("esdb://user:pass@127.0.0.1/?maxDiscoverAttempts=13&DiscoveryInterval=37&gossipTimeout=33&nOdEPrEfErence=FoLLoWer&tlsVerifyCert=faLse") + require.NoError(t, err) + assert.Equal(t, "user", config.Username) + assert.Equal(t, "pass", config.Password) + assert.Equal(t, "127.0.0.1:2113", config.Address) + assert.Empty(t, config.GossipSeeds) + assert.Equal(t, 13, config.MaxDiscoverAttempts) + assert.Equal(t, 37, config.DiscoveryInterval) + assert.Equal(t, 33, config.GossipTimeout) + assert.Equal(t, kurrentdb.NodePreferenceFollower, config.NodePreference) + assert.Equal(t, true, config.SkipCertificateVerification) + + config, err = kurrentdb.ParseConnectionString("esdb://hostname:4321/?tls=fAlse") + require.NoError(t, err) + assert.Empty(t, config.Username) + assert.Empty(t, config.Password) + assert.Equal(t, "hostname:4321", config.Address) + assert.Empty(t, config.GossipSeeds) + assert.Equal(t, kurrentdb.NodePreferenceLeader, config.NodePreference) + assert.Equal(t, true, config.DisableTLS) + assert.Equal(t, false, config.SkipCertificateVerification) + + config, err = kurrentdb.ParseConnectionString("esdb+discover://user:pass@host?nodePreference=follower&tlsVerifyCert=false") + require.NoError(t, err) + assert.Equal(t, "user", config.Username) + assert.Equal(t, "pass", config.Password) + assert.Equal(t, "host:2113", config.Address) + assert.Empty(t, config.GossipSeeds) + assert.Equal(t, kurrentdb.NodePreferenceFollower, config.NodePreference) + assert.Equal(t, false, config.DisableTLS) + assert.Equal(t, true, config.SkipCertificateVerification) + assert.Equal(t, true, config.DnsDiscover) + + config, err = kurrentdb.ParseConnectionString("esdb://user:pass@localhost:2113?tls=true") + require.NoError(t, err) + assert.Equal(t, "user", config.Username) + assert.Equal(t, "pass", config.Password) + assert.Equal(t, "localhost:2113", config.Address) + assert.Equal(t, false, config.DisableTLS) + assert.Equal(t, false, config.DnsDiscover) + assert.Equal(t, false, config.SkipCertificateVerification) +} + +func endpointParse(addr string) *kurrentdb.EndPoint { + value, _ := kurrentdb.ParseEndPoint(addr) + return value +} + +func TestConnectionStringWithValidClusterConnectionString(t *testing.T) { + config, err := kurrentdb.ParseConnectionString("esdb://host1,host2,host3") + assert.NoError(t, err) + assert.Empty(t, config.Address) + require.NotEmpty(t, config.GossipSeeds) + assert.Len(t, config.GossipSeeds, 3) + assert.Equal(t, endpointParse("host1:2113"), config.GossipSeeds[0]) + assert.Equal(t, endpointParse("host2:2113"), config.GossipSeeds[1]) + assert.Equal(t, endpointParse("host3:2113"), config.GossipSeeds[2]) + + config, err = kurrentdb.ParseConnectionString("esdb://host1:1234,host2:4321,host3:3231") + assert.NoError(t, err) + assert.Empty(t, config.Address) + require.NotEmpty(t, config.GossipSeeds) + assert.Len(t, config.GossipSeeds, 3) + assert.Equal(t, endpointParse("host1:1234"), config.GossipSeeds[0]) + assert.Equal(t, endpointParse("host2:4321"), config.GossipSeeds[1]) + assert.Equal(t, endpointParse("host3:3231"), config.GossipSeeds[2]) + + config, err = kurrentdb.ParseConnectionString("esdb://user:pass@host1:1234,host2:4321,host3:3231?nodePreference=follower") + assert.NoError(t, err) + assert.Equal(t, "user", config.Username) + assert.Equal(t, "pass", config.Password) + assert.Empty(t, config.Address) + require.NotEmpty(t, config.GossipSeeds) + assert.Len(t, config.GossipSeeds, 3) + assert.Equal(t, endpointParse("host1:1234"), config.GossipSeeds[0]) + assert.Equal(t, endpointParse("host2:4321"), config.GossipSeeds[1]) + assert.Equal(t, endpointParse("host3:3231"), config.GossipSeeds[2]) + assert.Equal(t, kurrentdb.NodePreferenceFollower, config.NodePreference) + + config, err = kurrentdb.ParseConnectionString("esdb://host1,host2,host3?tls=false") + assert.NoError(t, err) + assert.Empty(t, config.Address) + require.NotEmpty(t, config.GossipSeeds) + assert.Len(t, config.GossipSeeds, 3) + assert.Equal(t, endpointParse("host1:2113"), config.GossipSeeds[0]) + assert.Equal(t, endpointParse("host2:2113"), config.GossipSeeds[1]) + assert.Equal(t, endpointParse("host3:2113"), config.GossipSeeds[2]) + + config, err = kurrentdb.ParseConnectionString("esdb://host1,host2,host3?tlsVerifyCert=false") + assert.NoError(t, err) + assert.Empty(t, config.Address) + require.NotEmpty(t, config.GossipSeeds) + assert.Len(t, config.GossipSeeds, 3) + assert.Equal(t, endpointParse("host1:2113"), config.GossipSeeds[0]) + assert.Equal(t, endpointParse("host2:2113"), config.GossipSeeds[1]) + assert.Equal(t, endpointParse("host3:2113"), config.GossipSeeds[2]) + assert.Equal(t, true, config.SkipCertificateVerification) + + config, err = kurrentdb.ParseConnectionString("esdb://user:pass@127.0.0.1,127.0.0.2:3321,127.0.0.3/?maxDiscoverAttempts=13&DiscoveryInterval=37&nOdEPrEfErence=FoLLoWer&tlsVerifyCert=false") + assert.NoError(t, err) + assert.Equal(t, "user", config.Username) + assert.Equal(t, "pass", config.Password) + assert.Empty(t, config.Address) + assert.Equal(t, 13, config.MaxDiscoverAttempts) + assert.Equal(t, 37, config.DiscoveryInterval) + assert.Equal(t, kurrentdb.NodePreferenceFollower, config.NodePreference) + require.NotEmpty(t, config.GossipSeeds) + assert.Len(t, config.GossipSeeds, 3) + assert.Equal(t, endpointParse("127.0.0.1:2113"), config.GossipSeeds[0]) + assert.Equal(t, endpointParse("127.0.0.2:3321"), config.GossipSeeds[1]) + assert.Equal(t, endpointParse("127.0.0.3:2113"), config.GossipSeeds[2]) + + config, err = kurrentdb.ParseConnectionString("esdb://user:pass@host1,host2:3321,127.0.0.3/?tls=false&maxDiscoverAttempts=13&DiscoveryInterval=37&nOdEPrEfErence=FoLLoWer&tlsVerifyCert=false") + assert.NoError(t, err) + assert.Equal(t, "user", config.Username) + assert.Equal(t, "pass", config.Password) + assert.Empty(t, config.Address) + assert.Equal(t, 13, config.MaxDiscoverAttempts) + assert.Equal(t, 37, config.DiscoveryInterval) + assert.Equal(t, kurrentdb.NodePreferenceFollower, config.NodePreference) + require.NotEmpty(t, config.GossipSeeds) + assert.Len(t, config.GossipSeeds, 3) + assert.Equal(t, endpointParse("host1:2113"), config.GossipSeeds[0]) + assert.Equal(t, endpointParse("host2:3321"), config.GossipSeeds[1]) + assert.Equal(t, endpointParse("127.0.0.3:2113"), config.GossipSeeds[2]) +} + +func TestConnectionStringWithDifferentTLSSettings(t *testing.T) { + config, _ := kurrentdb.ParseConnectionString("esdb://127.0.0.1/") + assert.Equal(t, "127.0.0.1:2113", config.Address) + + config, _ = kurrentdb.ParseConnectionString("esdb://127.0.0.1?tls=true") + assert.Equal(t, "127.0.0.1:2113", config.Address) + + config, _ = kurrentdb.ParseConnectionString("esdb://127.0.0.1/?tls=FaLsE") + assert.Equal(t, "127.0.0.1:2113", config.Address) + + config, _ = kurrentdb.ParseConnectionString("esdb://127.0.0.1,127.0.0.2:3321,127.0.0.3/") + assert.Equal(t, endpointParse("127.0.0.1:2113"), config.GossipSeeds[0]) + assert.Equal(t, endpointParse("127.0.0.2:3321"), config.GossipSeeds[1]) + assert.Equal(t, endpointParse("127.0.0.3:2113"), config.GossipSeeds[2]) + + config, _ = kurrentdb.ParseConnectionString("esdb://127.0.0.1,127.0.0.2:3321,127.0.0.3?tls=true") + assert.Equal(t, endpointParse("127.0.0.1:2113"), config.GossipSeeds[0]) + assert.Equal(t, endpointParse("127.0.0.2:3321"), config.GossipSeeds[1]) + assert.Equal(t, endpointParse("127.0.0.3:2113"), config.GossipSeeds[2]) + + config, _ = kurrentdb.ParseConnectionString("esdb://127.0.0.1,127.0.0.2:3321,127.0.0.3/?tls=fAlSe") + assert.Equal(t, endpointParse("127.0.0.1:2113"), config.GossipSeeds[0]) + assert.Equal(t, endpointParse("127.0.0.2:3321"), config.GossipSeeds[1]) + assert.Equal(t, endpointParse("127.0.0.3:2113"), config.GossipSeeds[2]) +} + +func TestConnectionStringWithDifferentTLSVerifySettings(t *testing.T) { + config, _ := kurrentdb.ParseConnectionString("esdb://127.0.0.1/") + assert.Equal(t, false, config.SkipCertificateVerification) + + config, _ = kurrentdb.ParseConnectionString("esdb://127.0.0.1/?tlsVerifyCert=TrUe") + assert.Equal(t, false, config.SkipCertificateVerification) + + config, _ = kurrentdb.ParseConnectionString("esdb://127.0.0.1/?tlsVerifyCert=FaLsE") + assert.Equal(t, true, config.SkipCertificateVerification) + + config, _ = kurrentdb.ParseConnectionString("esdb://127.0.0.1,127.0.0.2:3321,127.0.0.3/") + assert.Equal(t, false, config.SkipCertificateVerification) + + config, _ = kurrentdb.ParseConnectionString("esdb://127.0.0.1,127.0.0.2:3321,127.0.0.3/?tlsVerifyCert=true") + assert.Equal(t, false, config.SkipCertificateVerification) + + config, _ = kurrentdb.ParseConnectionString("esdb://127.0.0.1,127.0.0.2:3321,127.0.0.3/?tlsVerifyCert=false") + assert.Equal(t, true, config.SkipCertificateVerification) + +} + +func TestConnectionStringWithoutCertificateFile(t *testing.T) { + config, err := kurrentdb.ParseConnectionString("esdb://user:pass@127.0.0.1") + assert.Nil(t, err) + assert.NotNil(t, config) +} + +func TestConnectionStringWithCertificateFile(t *testing.T) { + config, err := kurrentdb.ParseConnectionString("esdb://user:pass@127.0.0.1/?tlsCAFile=invalidPath") + require.Error(t, err) + assert.Nil(t, config) +} + +func TestConnectionStringWithKeepAlive(t *testing.T) { + // KeepAliveInterval + config, err := kurrentdb.ParseConnectionString("esdb://user:pass@127.0.0.1/?keepAliveInterval=zero") + require.Error(t, err) + assert.Nil(t, config) + assert.Contains(t, err.Error(), "Invalid keepAliveInterval \"zero\". Please provide a positive integer, or -1 to disable") + + config, err = kurrentdb.ParseConnectionString("esdb://user:pass@127.0.0.1/?keepAliveInterval=-2") + require.Error(t, err) + assert.Nil(t, config) + assert.Contains(t, err.Error(), "Invalid keepAliveInterval \"-2\". Please provide a positive integer, or -1 to disable") + + config, err = kurrentdb.ParseConnectionString("esdb://user:pass@127.0.0.1/?keepAliveInterval=-1") + require.NoError(t, err) + assert.Equal(t, -1, int(config.KeepAliveInterval)) + + config, err = kurrentdb.ParseConnectionString("esdb://user:pass@127.0.0.1/?KeepAliveInterval=100") + require.NoError(t, err) + assert.Equal(t, 100*time.Millisecond, config.KeepAliveInterval) + + // KeepAliveTimeout + config, err = kurrentdb.ParseConnectionString("esdb://user:pass@127.0.0.1/?keepAliveTimeout=one") + require.Error(t, err) + assert.Nil(t, config) + assert.Contains(t, err.Error(), "Invalid keepAliveTimeout \"one\". Please provide a positive integer, or -1 to disable") + + config, err = kurrentdb.ParseConnectionString("esdb://user:pass@127.0.0.1/?keepAliveTimeout=-3") + require.Error(t, err) + assert.Nil(t, config) + assert.Contains(t, err.Error(), "Invalid keepAliveTimeout \"-3\". Please provide a positive integer, or -1 to disable") + + config, err = kurrentdb.ParseConnectionString("esdb://user:pass@127.0.0.1/?keepAliveTimeout=-1") + require.NoError(t, err) + assert.Equal(t, -1, int(config.KeepAliveTimeout)) + + config, err = kurrentdb.ParseConnectionString("esdb://user:pass@127.0.0.1/?KeepAliveTimeout=50000") + require.NoError(t, err) + assert.Equal(t, 50*time.Second, config.KeepAliveTimeout) + + // KeepAliveInterval & KeepAliveTimeout + config, err = kurrentdb.ParseConnectionString("esdb://user:pass@127.0.0.1/?keepAliveInterval=12000&KeepAliveTimeout=15000") + require.NoError(t, err) + assert.Equal(t, 12*time.Second, config.KeepAliveInterval) + assert.Equal(t, 15*time.Second, config.KeepAliveTimeout) + + config, err = kurrentdb.ParseConnectionString("esdb://user:pass@127.0.0.1/?keepAliveInterval=-1&KeepAliveTimeout=-1") + require.NoError(t, err) + assert.Equal(t, -1, int(config.KeepAliveInterval)) + assert.Equal(t, -1, int(config.KeepAliveTimeout)) + + config, err = kurrentdb.ParseConnectionString("esdb://user:pass@127.0.0.1/?keepAliveInterval=-1&KeepAliveTimeout=15000") + require.NoError(t, err) + assert.Equal(t, -1, int(config.KeepAliveInterval)) + assert.Equal(t, 15*time.Second, config.KeepAliveTimeout) + + config, err = kurrentdb.ParseConnectionString("esdb://user:pass@127.0.0.1/?keepAliveInterval=11000&KeepAliveTimeout=-1") + require.NoError(t, err) + assert.Equal(t, 11*time.Second, config.KeepAliveInterval) + assert.Equal(t, -1, int(config.KeepAliveTimeout)) +} + +func TestConnectionStringWithDefaultDeadline(t *testing.T) { + config, err := kurrentdb.ParseConnectionString("esdb://localhost?defaultDeadline=60000") + require.NoError(t, err) + assert.NotNil(t, config.DefaultDeadline) + assert.Equal(t, *config.DefaultDeadline, 60*time.Second) +} diff --git a/esdb/connection_test.go b/kurrentdb/connection_test.go similarity index 73% rename from esdb/connection_test.go rename to kurrentdb/connection_test.go index a84ecb64..032a7c2b 100644 --- a/esdb/connection_test.go +++ b/kurrentdb/connection_test.go @@ -1,12 +1,12 @@ -package esdb_test +package kurrentdb_test import ( "context" + "github.com/EventStore/EventStore-Client-Go/v1/kurrentdb" "github.com/google/uuid" "testing" "time" - "github.com/EventStore/EventStore-Client-Go/v4/esdb" "github.com/stretchr/testify/assert" ) @@ -26,8 +26,8 @@ func closeConnection(container *Container) TestCall { streamID := uuid.New() context, cancel := context.WithTimeout(context.Background(), time.Duration(5)*time.Second) defer cancel() - opts := esdb.AppendToStreamOptions{ - ExpectedRevision: esdb.NoStream{}, + opts := kurrentdb.AppendToStreamOptions{ + ExpectedRevision: kurrentdb.NoStream{}, } _, err := db.AppendToStream(context, streamID.String(), opts, testEvent) @@ -36,11 +36,11 @@ func closeConnection(container *Container) TestCall { } db.Close() - opts.ExpectedRevision = esdb.Any{} + opts.ExpectedRevision = kurrentdb.Any{} _, err = db.AppendToStream(context, streamID.String(), opts, testEvent) - esdbErr, ok := esdb.FromError(err) + esdbErr, ok := kurrentdb.FromError(err) assert.False(t, ok) - assert.Equal(t, esdbErr.Code(), esdb.ErrorCodeConnectionClosed) + assert.Equal(t, esdbErr.Code(), kurrentdb.ErrorCodeConnectionClosed) } } diff --git a/esdb/containers_test.go b/kurrentdb/containers_test.go similarity index 86% rename from esdb/containers_test.go rename to kurrentdb/containers_test.go index 0e5f8054..9ec7e1bf 100644 --- a/esdb/containers_test.go +++ b/kurrentdb/containers_test.go @@ -1,8 +1,9 @@ -package esdb_test +package kurrentdb_test import ( "context" "fmt" + "github.com/EventStore/EventStore-Client-Go/v1/kurrentdb" "github.com/docker/go-connections/nat" "github.com/testcontainers/testcontainers-go" "github.com/testcontainers/testcontainers-go/wait" @@ -13,7 +14,6 @@ import ( "testing" "time" - "github.com/EventStore/EventStore-Client-Go/v4/esdb" "github.com/davecgh/go-spew/spew" "github.com/goombaio/namegenerator" ) @@ -218,7 +218,7 @@ func verifyCertificatesExist() error { for _, f := range certs { if _, err := os.Stat(path.Join(certsDir, f)); os.IsNotExist(err) { - return fmt.Errorf("could not locate the certificates needed to run EventStoreDB and the tests. Please run 'docker compose up' for generating the certificates") + return fmt.Errorf("could not locate the certificates needed to run KurrentDB and the tests. Please run 'docker compose up' for generating the certificates") } } return nil @@ -241,7 +241,7 @@ func getRootDir() (string, error) { return path.Clean(path.Join(currentDir, "../")), nil } -func GetClient(t *testing.T, container *Container) *esdb.Client { +func GetClient(t *testing.T, container *Container) *kurrentdb.Client { isInsecure := GetEnvOrDefault("EVENTSTORE_INSECURE", "true") == "true" isCluster := GetEnvOrDefault("CLUSTER", "false") == "true" @@ -254,15 +254,15 @@ func GetClient(t *testing.T, container *Container) *esdb.Client { return createTestClient(fmt.Sprintf("esdb://admin:changeit@%s?tlsverifycert=false&tls=true", container.Endpoint), container, t) } -func CreateEmptyDatabase(t *testing.T) (*Container, *esdb.Client) { +func CreateEmptyDatabase(t *testing.T) (*Container, *kurrentdb.Client) { return createDatabase(t, false) } -func CreatePopulatedDatabase(t *testing.T) (*Container, *esdb.Client) { +func CreatePopulatedDatabase(t *testing.T) (*Container, *kurrentdb.Client) { return createDatabase(t, true) } -func createDatabase(t *testing.T, populated bool) (*Container, *esdb.Client) { +func createDatabase(t *testing.T, populated bool) (*Container, *kurrentdb.Client) { isInsecure := GetEnvOrDefault("EVENTSTORE_INSECURE", "true") == "true" var label string @@ -274,7 +274,7 @@ func createDatabase(t *testing.T, populated bool) (*Container, *esdb.Client) { } var container *Container - var client *esdb.Client + var client *kurrentdb.Client if GetEnvOrDefault("CLUSTER", "false") == "true" { // When run on the cluster configuration we don't run the pre-populated database, so we have no use for a client @@ -313,13 +313,13 @@ func createDatabase(t *testing.T, populated bool) (*Container, *esdb.Client) { return container, client } -func createTestClient(conn string, container *Container, t *testing.T) *esdb.Client { - config, err := esdb.ParseConnectionString(conn) +func createTestClient(conn string, container *Container, t *testing.T) *kurrentdb.Client { + config, err := kurrentdb.ParseConnectionString(conn) if err != nil { t.Fatalf("Unexpected configuration error: %s", err.Error()) } - client, err := esdb.NewClient(config) + client, err := kurrentdb.NewClient(config) if err != nil { t.Fatalf("Unexpected failure setting up test connection: %s", err.Error()) } @@ -327,12 +327,12 @@ func createTestClient(conn string, container *Container, t *testing.T) *esdb.Cli return client } -func WaitForAdminToBeAvailable(t *testing.T, db *esdb.Client) { +func WaitForAdminToBeAvailable(t *testing.T, db *kurrentdb.Client) { for count := 0; count < 50; count++ { ctx, cancel := context.WithTimeout(context.Background(), 1*time.Second) t.Logf("[debug] checking if admin user is available...%v/50", count) - stream, err := db.ReadStream(ctx, "$users", esdb.ReadStreamOptions{}, 1) + stream, err := db.ReadStream(ctx, "$users", kurrentdb.ReadStreamOptions{}, 1) if ctx.Err() != nil { t.Log("[debug] request timed out, retrying...") @@ -352,11 +352,11 @@ func WaitForAdminToBeAvailable(t *testing.T, db *esdb.Client) { } if err != nil { - if esdbError, ok := esdb.FromError(err); !ok { - if esdbError.Code() == esdb.ErrorCodeResourceNotFound || - esdbError.Code() == esdb.ErrorCodeUnauthenticated || - esdbError.Code() == esdb.ErrorCodeDeadlineExceeded || - esdbError.Code() == esdb.ErrorUnavailable { + if esdbError, ok := kurrentdb.FromError(err); !ok { + if esdbError.Code() == kurrentdb.ErrorCodeResourceNotFound || + esdbError.Code() == kurrentdb.ErrorCodeUnauthenticated || + esdbError.Code() == kurrentdb.ErrorCodeDeadlineExceeded || + esdbError.Code() == kurrentdb.ErrorUnavailable { time.Sleep(1 * time.Second) t.Logf("[debug] not available retrying...") cancel() @@ -373,13 +373,13 @@ func WaitForAdminToBeAvailable(t *testing.T, db *esdb.Client) { t.Fatalf("failed to access admin account in a timely manner") } -func WaitForLeaderToBeElected(t *testing.T, db *esdb.Client) { +func WaitForLeaderToBeElected(t *testing.T, db *kurrentdb.Client) { for count := 0; count < 50; count++ { streamID := NAME_GENERATOR.Generate() ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second) t.Logf("[debug] checking if a leader has been elected...%v/50", count) - err := db.CreatePersistentSubscription(ctx, streamID, "group", esdb.PersistentStreamSubscriptionOptions{}) + err := db.CreatePersistentSubscription(ctx, streamID, "group", kurrentdb.PersistentStreamSubscriptionOptions{}) if ctx.Err() != nil { t.Log("[debug] request timed out, retrying...") @@ -395,8 +395,8 @@ func WaitForLeaderToBeElected(t *testing.T, db *esdb.Client) { } if err != nil { - if esdbError, ok := esdb.FromError(err); !ok { - if esdbError.Code() == esdb.ErrorCodeNotLeader || esdbError.Code() == esdb.ErrorUnavailable || esdbError.Code() == esdb.ErrorCodeUnauthenticated { + if esdbError, ok := kurrentdb.FromError(err); !ok { + if esdbError.Code() == kurrentdb.ErrorCodeNotLeader || esdbError.Code() == kurrentdb.ErrorUnavailable || esdbError.Code() == kurrentdb.ErrorCodeUnauthenticated { time.Sleep(1 * time.Second) t.Logf("[debug] not available retrying...") cancel() @@ -413,17 +413,17 @@ func WaitForLeaderToBeElected(t *testing.T, db *esdb.Client) { t.Fatalf("cluster failed to elect a leader in a timely manner") } -func CreateClient(connStr string, t *testing.T) *esdb.Client { - config, err := esdb.ParseConnectionString(connStr) +func CreateClient(connStr string, t *testing.T) *kurrentdb.Client { + config, err := kurrentdb.ParseConnectionString(connStr) if err != nil { t.Fatalf("Error when parsin connection string: %v", err) } - client, err := esdb.NewClient(config) + client, err := kurrentdb.NewClient(config) if err != nil { - t.Fatalf("Error when creating an ESDB esdb: %v", err) + t.Fatalf("Error when creating an KurrentDB esdb: %v", err) } return client diff --git a/esdb/credentials.go b/kurrentdb/credentials.go similarity index 90% rename from esdb/credentials.go rename to kurrentdb/credentials.go index d80f636c..765509fd 100644 --- a/esdb/credentials.go +++ b/kurrentdb/credentials.go @@ -1,4 +1,4 @@ -package esdb +package kurrentdb // Credentials holds a login and a password for authenticated requests. type Credentials struct { diff --git a/esdb/delete_options.go b/kurrentdb/delete_options.go similarity index 98% rename from esdb/delete_options.go rename to kurrentdb/delete_options.go index a7e070fb..bbc1c830 100644 --- a/esdb/delete_options.go +++ b/kurrentdb/delete_options.go @@ -1,4 +1,4 @@ -package esdb +package kurrentdb import ( "time" diff --git a/esdb/delete_result.go b/kurrentdb/delete_result.go similarity index 90% rename from esdb/delete_result.go rename to kurrentdb/delete_result.go index 3cd7d709..fd48308d 100644 --- a/esdb/delete_result.go +++ b/kurrentdb/delete_result.go @@ -1,4 +1,4 @@ -package esdb +package kurrentdb // DeleteResult is returned on a successful stream deletion request. type DeleteResult struct { diff --git a/esdb/delete_test.go b/kurrentdb/delete_test.go similarity index 50% rename from esdb/delete_test.go rename to kurrentdb/delete_test.go index e48b52a7..1dfbf314 100644 --- a/esdb/delete_test.go +++ b/kurrentdb/delete_test.go @@ -1,30 +1,30 @@ -package esdb_test +package kurrentdb_test import ( "context" + "github.com/EventStore/EventStore-Client-Go/v1/kurrentdb" "testing" - "github.com/EventStore/EventStore-Client-Go/v4/esdb" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) -func DeleteTests(t *testing.T, db *esdb.Client) { +func DeleteTests(t *testing.T, db *kurrentdb.Client) { t.Run("DeleteTests", func(t *testing.T) { t.Run("canDeleteStream", canDeleteStream(db)) t.Run("canTombstoneStream", canTombstoneStream(db)) t.Run("detectStreamDeleted", detectStreamDeleted(db)) }) } -func canDeleteStream(db *esdb.Client) TestCall { +func canDeleteStream(db *kurrentdb.Client) TestCall { return func(t *testing.T) { - opts := esdb.DeleteStreamOptions{ - ExpectedRevision: esdb.Revision(0), + opts := kurrentdb.DeleteStreamOptions{ + ExpectedRevision: kurrentdb.Revision(0), } streamID := NAME_GENERATOR.Generate() - _, err := db.AppendToStream(context.Background(), streamID, esdb.AppendToStreamOptions{}, createTestEvent()) + _, err := db.AppendToStream(context.Background(), streamID, kurrentdb.AppendToStreamOptions{}, createTestEvent()) assert.NoError(t, err) deleteResult, err := db.DeleteStream(context.Background(), streamID, opts) @@ -37,13 +37,13 @@ func canDeleteStream(db *esdb.Client) TestCall { } } -func canTombstoneStream(db *esdb.Client) TestCall { +func canTombstoneStream(db *kurrentdb.Client) TestCall { return func(t *testing.T) { streamId := NAME_GENERATOR.Generate() - _, err := db.AppendToStream(context.Background(), streamId, esdb.AppendToStreamOptions{}, createTestEvent()) - deleteResult, err := db.TombstoneStream(context.Background(), streamId, esdb.TombstoneStreamOptions{ - ExpectedRevision: esdb.Revision(0), + _, err := db.AppendToStream(context.Background(), streamId, kurrentdb.AppendToStreamOptions{}, createTestEvent()) + deleteResult, err := db.TombstoneStream(context.Background(), streamId, kurrentdb.TombstoneStreamOptions{ + ExpectedRevision: kurrentdb.Revision(0), }) if err != nil { @@ -53,30 +53,30 @@ func canTombstoneStream(db *esdb.Client) TestCall { assert.True(t, deleteResult.Position.Commit > 0) assert.True(t, deleteResult.Position.Prepare > 0) - _, err = db.AppendToStream(context.Background(), streamId, esdb.AppendToStreamOptions{}, createTestEvent()) + _, err = db.AppendToStream(context.Background(), streamId, kurrentdb.AppendToStreamOptions{}, createTestEvent()) require.Error(t, err) } } -func detectStreamDeleted(db *esdb.Client) TestCall { +func detectStreamDeleted(db *kurrentdb.Client) TestCall { return func(t *testing.T) { streamID := NAME_GENERATOR.Generate() event := createTestEvent() - _, err := db.AppendToStream(context.Background(), streamID, esdb.AppendToStreamOptions{}, event) + _, err := db.AppendToStream(context.Background(), streamID, kurrentdb.AppendToStreamOptions{}, event) require.Nil(t, err) - _, err = db.TombstoneStream(context.Background(), streamID, esdb.TombstoneStreamOptions{}) + _, err = db.TombstoneStream(context.Background(), streamID, kurrentdb.TombstoneStreamOptions{}) require.Nil(t, err) - stream, err := db.ReadStream(context.Background(), streamID, esdb.ReadStreamOptions{}, 1) + stream, err := db.ReadStream(context.Background(), streamID, kurrentdb.ReadStreamOptions{}, 1) require.NoError(t, err) defer stream.Close() evt, err := stream.Recv() require.Nil(t, evt) - esdbErr, ok := esdb.FromError(err) + esdbErr, ok := kurrentdb.FromError(err) require.False(t, ok) - require.Equal(t, esdbErr.Code(), esdb.ErrorCodeStreamDeleted) + require.Equal(t, esdbErr.Code(), kurrentdb.ErrorCodeStreamDeleted) } } diff --git a/esdb/endpoint.go b/kurrentdb/endpoint.go similarity index 99% rename from esdb/endpoint.go rename to kurrentdb/endpoint.go index 046e8884..be9cbc50 100644 --- a/esdb/endpoint.go +++ b/kurrentdb/endpoint.go @@ -1,4 +1,4 @@ -package esdb +package kurrentdb import ( "fmt" diff --git a/esdb/errors.go b/kurrentdb/errors.go similarity index 95% rename from esdb/errors.go rename to kurrentdb/errors.go index 12c470e4..d9ef7290 100644 --- a/esdb/errors.go +++ b/kurrentdb/errors.go @@ -1,16 +1,16 @@ -package esdb +package kurrentdb import ( "fmt" ) -// ErrorCode EventStoreDB error code. +// ErrorCode KurrentDB error code. type ErrorCode int const ( // ErrorCodeUnknown unclassified error. ErrorCodeUnknown ErrorCode = iota - // ErrorCodeUnsupportedFeature a request not supported by the targeted EventStoreDB node was sent. + // ErrorCodeUnsupportedFeature a request not supported by the targeted KurrentDB node was sent. ErrorCodeUnsupportedFeature // ErrorCodeDeadlineExceeded a gRPC deadline exceeded error. ErrorCodeDeadlineExceeded @@ -38,7 +38,7 @@ const ( ErrorCodeNotLeader // ErrorAborted when the server aborted the request. ErrorAborted - // ErrorUnavailable when the EventStoreDB node became unavailable. + // ErrorUnavailable when the KurrentDB node became unavailable. ErrorUnavailable ) @@ -68,7 +68,7 @@ func (e *Error) Error() string { switch e.code { case ErrorCodeUnsupportedFeature: - msg = "[ErrorCodeUnsupportedFeature] request not supported by the targeted EventStoreDB node" + msg = "[ErrorCodeUnsupportedFeature] request not supported by the targeted KurrentDB node" case ErrorCodeDeadlineExceeded: msg = "[ErrorCodeDeadlineExceeded] gRPC deadline exceeded error" case ErrorCodeUnauthenticated: diff --git a/esdb/event_data.go b/kurrentdb/event_data.go similarity index 85% rename from esdb/event_data.go rename to kurrentdb/event_data.go index e0bf1f64..7175ff74 100644 --- a/esdb/event_data.go +++ b/kurrentdb/event_data.go @@ -1,4 +1,4 @@ -package esdb +package kurrentdb import "github.com/google/uuid" @@ -12,7 +12,7 @@ const ( ContentTypeJson ContentType = 1 ) -// EventData represents an event that will be sent to EventStoreDB. +// EventData represents an event that will be sent to KurrentDB. type EventData struct { // Event's unique identifier. EventID uuid.UUID diff --git a/esdb/impl.go b/kurrentdb/impl.go similarity index 98% rename from esdb/impl.go rename to kurrentdb/impl.go index e25bc522..b6f5f355 100644 --- a/esdb/impl.go +++ b/kurrentdb/impl.go @@ -1,4 +1,4 @@ -package esdb +package kurrentdb import ( "context" @@ -13,9 +13,9 @@ import ( "sync/atomic" "time" - gossipApi "github.com/EventStore/EventStore-Client-Go/v4/protos/gossip" - server_features "github.com/EventStore/EventStore-Client-Go/v4/protos/serverfeatures" - "github.com/EventStore/EventStore-Client-Go/v4/protos/shared" + gossipApi "github.com/EventStore/EventStore-Client-Go/v1/protos/gossip" + server_features "github.com/EventStore/EventStore-Client-Go/v1/protos/serverfeatures" + "github.com/EventStore/EventStore-Client-Go/v1/protos/shared" "google.golang.org/grpc" "google.golang.org/grpc/codes" "google.golang.org/grpc/credentials" @@ -395,7 +395,7 @@ func getSupportedMethods(ctx context.Context, conf *Configuration, conn *grpc.Cl num, err := strconv.Atoi(value) if err != nil { - return nil, fmt.Errorf("invalid EventStoreDB server version format: %w", err) + return nil, fmt.Errorf("invalid KurrentDB server version format: %w", err) } switch idx { diff --git a/esdb/logging.go b/kurrentdb/logging.go similarity index 98% rename from esdb/logging.go rename to kurrentdb/logging.go index 9b54b27a..07b229bb 100644 --- a/esdb/logging.go +++ b/kurrentdb/logging.go @@ -1,4 +1,4 @@ -package esdb +package kurrentdb import ( "fmt" diff --git a/esdb/operations.go b/kurrentdb/operations.go similarity index 50% rename from esdb/operations.go rename to kurrentdb/operations.go index 5a19573d..1fc14d04 100644 --- a/esdb/operations.go +++ b/kurrentdb/operations.go @@ -1,18 +1,18 @@ -package esdb +package kurrentdb -// ServerVersion Represents the version of an EventStoreDB node. +// ServerVersion Represents the version of an KurrentDB node. type ServerVersion struct { Major int Minor int Patch int } -// GetServerVersion Returns the version of the EventStoreDB node to which the client is currently connected. +// GetServerVersion Returns the version of the KurrentDB node to which the client is currently connected. func (client *Client) GetServerVersion() (*ServerVersion, error) { handle, err := client.grpcClient.getConnectionHandle() if err != nil { return nil, err } - return handle.GetServerVersion(); -} \ No newline at end of file + return handle.GetServerVersion() +} diff --git a/esdb/options.go b/kurrentdb/options.go similarity index 98% rename from esdb/options.go rename to kurrentdb/options.go index cc7e6258..03422a28 100644 --- a/esdb/options.go +++ b/kurrentdb/options.go @@ -1,4 +1,4 @@ -package esdb +package kurrentdb import ( "context" diff --git a/esdb/persistent_options.go b/kurrentdb/persistent_options.go similarity index 99% rename from esdb/persistent_options.go rename to kurrentdb/persistent_options.go index 92204a2c..5bbbcb32 100644 --- a/esdb/persistent_options.go +++ b/kurrentdb/persistent_options.go @@ -1,4 +1,4 @@ -package esdb +package kurrentdb import "time" diff --git a/esdb/persistent_subscription.go b/kurrentdb/persistent_subscription.go similarity index 96% rename from esdb/persistent_subscription.go rename to kurrentdb/persistent_subscription.go index 76f845de..d971f074 100644 --- a/esdb/persistent_subscription.go +++ b/kurrentdb/persistent_subscription.go @@ -1,4 +1,4 @@ -package esdb +package kurrentdb import ( "context" @@ -8,8 +8,8 @@ import ( "sync" - "github.com/EventStore/EventStore-Client-Go/v4/protos/persistent" - "github.com/EventStore/EventStore-Client-Go/v4/protos/shared" + "github.com/EventStore/EventStore-Client-Go/v1/protos/persistent" + "github.com/EventStore/EventStore-Client-Go/v1/protos/shared" ) // NackAction persistent subscription acknowledgement error type. diff --git a/esdb/persistent_subscription_client.go b/kurrentdb/persistent_subscription_client.go similarity index 99% rename from esdb/persistent_subscription_client.go rename to kurrentdb/persistent_subscription_client.go index 2290b6c9..70237f56 100644 --- a/esdb/persistent_subscription_client.go +++ b/kurrentdb/persistent_subscription_client.go @@ -1,11 +1,11 @@ -package esdb +package kurrentdb import ( "context" "fmt" - "github.com/EventStore/EventStore-Client-Go/v4/protos/persistent" - "github.com/EventStore/EventStore-Client-Go/v4/protos/shared" + "github.com/EventStore/EventStore-Client-Go/v1/protos/persistent" + "github.com/EventStore/EventStore-Client-Go/v1/protos/shared" "google.golang.org/grpc" "google.golang.org/grpc/metadata" ) diff --git a/esdb/persistent_subscription_http_client.go b/kurrentdb/persistent_subscription_http_client.go similarity index 99% rename from esdb/persistent_subscription_http_client.go rename to kurrentdb/persistent_subscription_http_client.go index f1a91968..ae069ee0 100644 --- a/esdb/persistent_subscription_http_client.go +++ b/kurrentdb/persistent_subscription_http_client.go @@ -1,4 +1,4 @@ -package esdb +package kurrentdb import ( "encoding/json" diff --git a/esdb/persistent_subscription_read_test.go b/kurrentdb/persistent_subscription_read_test.go similarity index 79% rename from esdb/persistent_subscription_read_test.go rename to kurrentdb/persistent_subscription_read_test.go index 15c02b1b..12bbf09a 100644 --- a/esdb/persistent_subscription_read_test.go +++ b/kurrentdb/persistent_subscription_read_test.go @@ -1,15 +1,15 @@ -package esdb_test +package kurrentdb_test import ( "context" + "github.com/EventStore/EventStore-Client-Go/v1/kurrentdb" "testing" "time" - "github.com/EventStore/EventStore-Client-Go/v4/esdb" "github.com/stretchr/testify/require" ) -func PersistentSubReadTests(t *testing.T, emptyDBClient *esdb.Client) { +func PersistentSubReadTests(t *testing.T, emptyDBClient *kurrentdb.Client) { t.Run("PersistentSubReadTests", func(t *testing.T) { t.Run("ReadExistingStream_AckToReceiveNewEvents", persistentSubscription_ReadExistingStream_AckToReceiveNewEvents(emptyDBClient)) t.Run("ToExistingStream_StartFromBeginning_AndEventsInIt", persistentSubscription_ToExistingStream_StartFromBeginning_AndEventsInIt(emptyDBClient)) @@ -25,13 +25,13 @@ func PersistentSubReadTests(t *testing.T, emptyDBClient *esdb.Client) { }) } -func persistentSubscription_ReadExistingStream_AckToReceiveNewEvents(clientInstance *esdb.Client) TestCall { +func persistentSubscription_ReadExistingStream_AckToReceiveNewEvents(clientInstance *kurrentdb.Client) TestCall { return func(t *testing.T) { streamID := NAME_GENERATOR.Generate() firstEvent := createTestEvent() secondEvent := createTestEvent() thirdEvent := createTestEvent() - events := []esdb.EventData{firstEvent, secondEvent, thirdEvent} + events := []kurrentdb.EventData{firstEvent, secondEvent, thirdEvent} pushEventsToStream(t, clientInstance, streamID, events) groupName := "Group 1" @@ -39,14 +39,14 @@ func persistentSubscription_ReadExistingStream_AckToReceiveNewEvents(clientInsta context.Background(), streamID, groupName, - esdb.PersistentStreamSubscriptionOptions{ - StartFrom: esdb.Start{}, + kurrentdb.PersistentStreamSubscriptionOptions{ + StartFrom: kurrentdb.Start{}, }, ) require.NoError(t, err) readConnectionClient, err := clientInstance.SubscribeToPersistentSubscription( - context.Background(), streamID, groupName, esdb.SubscribeToPersistentSubscriptionOptions{ + context.Background(), streamID, groupName, kurrentdb.SubscribeToPersistentSubscriptionOptions{ BufferSize: 2, }) require.NoError(t, err) @@ -71,15 +71,15 @@ func persistentSubscription_ReadExistingStream_AckToReceiveNewEvents(clientInsta } } -func persistentSubscription_ToExistingStream_StartFromBeginning_AndEventsInIt(clientInstance *esdb.Client) TestCall { +func persistentSubscription_ToExistingStream_StartFromBeginning_AndEventsInIt(clientInstance *kurrentdb.Client) TestCall { return func(t *testing.T) { // create 10 events events := testCreateEvents(10) streamID := NAME_GENERATOR.Generate() // append events to StreamsClient.AppendToStreamAsync(Stream, StreamState.NoStream, Events); - opts := esdb.AppendToStreamOptions{ - ExpectedRevision: esdb.NoStream{}, + opts := kurrentdb.AppendToStreamOptions{ + ExpectedRevision: kurrentdb.NoStream{}, } _, err := clientInstance.AppendToStream(context.Background(), streamID, opts, events...) @@ -90,14 +90,14 @@ func persistentSubscription_ToExistingStream_StartFromBeginning_AndEventsInIt(cl context.Background(), streamID, groupName, - esdb.PersistentStreamSubscriptionOptions{ - StartFrom: esdb.Start{}, + kurrentdb.PersistentStreamSubscriptionOptions{ + StartFrom: kurrentdb.Start{}, }, ) require.NoError(t, err) // read one event readConnectionClient, err := clientInstance.SubscribeToPersistentSubscription( - context.Background(), streamID, groupName, esdb.SubscribeToPersistentSubscriptionOptions{}) + context.Background(), streamID, groupName, kurrentdb.SubscribeToPersistentSubscriptionOptions{}) require.NoError(t, err) defer readConnectionClient.Close() @@ -112,7 +112,7 @@ func persistentSubscription_ToExistingStream_StartFromBeginning_AndEventsInIt(cl } } -func persistentSubscription_ToNonExistingStream_StartFromBeginning_AppendEventsAfterwards(clientInstance *esdb.Client) TestCall { +func persistentSubscription_ToNonExistingStream_StartFromBeginning_AppendEventsAfterwards(clientInstance *kurrentdb.Client) TestCall { return func(t *testing.T) { // create 10 events events := testCreateEvents(10) @@ -124,21 +124,21 @@ func persistentSubscription_ToNonExistingStream_StartFromBeginning_AppendEventsA context.Background(), streamID, groupName, - esdb.PersistentStreamSubscriptionOptions{ - StartFrom: esdb.Start{}, + kurrentdb.PersistentStreamSubscriptionOptions{ + StartFrom: kurrentdb.Start{}, }, ) require.NoError(t, err) // append events to StreamsClient.AppendToStreamAsync(Stream, stream_revision.StreamRevisionNoStream, Events); - opts := esdb.AppendToStreamOptions{ - ExpectedRevision: esdb.NoStream{}, + opts := kurrentdb.AppendToStreamOptions{ + ExpectedRevision: kurrentdb.NoStream{}, } _, err = clientInstance.AppendToStream(context.Background(), streamID, opts, events...) require.NoError(t, err) // read one event readConnectionClient, err := clientInstance.SubscribeToPersistentSubscription( - context.Background(), streamID, groupName, esdb.SubscribeToPersistentSubscriptionOptions{}) + context.Background(), streamID, groupName, kurrentdb.SubscribeToPersistentSubscriptionOptions{}) require.NoError(t, err) defer readConnectionClient.Close() @@ -152,15 +152,15 @@ func persistentSubscription_ToNonExistingStream_StartFromBeginning_AppendEventsA } } -func persistentSubscription_ToExistingStream_StartFromEnd_EventsInItAndAppendEventsAfterwards(clientInstance *esdb.Client) TestCall { +func persistentSubscription_ToExistingStream_StartFromEnd_EventsInItAndAppendEventsAfterwards(clientInstance *kurrentdb.Client) TestCall { return func(t *testing.T) { // create 11 events events := testCreateEvents(11) // append 10 events to StreamsClient.AppendToStreamAsync(Stream, StreamState.NoStream, events[:10]); streamID := NAME_GENERATOR.Generate() // append events to StreamsClient.AppendToStreamAsync(Stream, StreamState.NoStream, Events); - opts := esdb.AppendToStreamOptions{ - ExpectedRevision: esdb.NoStream{}, + opts := kurrentdb.AppendToStreamOptions{ + ExpectedRevision: kurrentdb.NoStream{}, } _, err := clientInstance.AppendToStream(context.Background(), streamID, opts, events[:10]...) require.NoError(t, err) @@ -170,20 +170,20 @@ func persistentSubscription_ToExistingStream_StartFromEnd_EventsInItAndAppendEve context.Background(), streamID, groupName, - esdb.PersistentStreamSubscriptionOptions{ - StartFrom: esdb.End{}, + kurrentdb.PersistentStreamSubscriptionOptions{ + StartFrom: kurrentdb.End{}, }, ) require.NoError(t, err) // append 1 event to StreamsClient.AppendToStreamAsync(Stream, new StreamRevision(9), event[10]) - opts.ExpectedRevision = esdb.Revision(9) + opts.ExpectedRevision = kurrentdb.Revision(9) _, err = clientInstance.AppendToStream(context.Background(), streamID, opts, events[10:]...) require.NoError(t, err) // read one event readConnectionClient, err := clientInstance.SubscribeToPersistentSubscription( - context.Background(), streamID, groupName, esdb.SubscribeToPersistentSubscriptionOptions{}) + context.Background(), streamID, groupName, kurrentdb.SubscribeToPersistentSubscriptionOptions{}) require.NoError(t, err) defer readConnectionClient.Close() @@ -197,15 +197,15 @@ func persistentSubscription_ToExistingStream_StartFromEnd_EventsInItAndAppendEve } } -func persistentSubscription_ToExistingStream_StartFromEnd_EventsInIt(clientInstance *esdb.Client) TestCall { +func persistentSubscription_ToExistingStream_StartFromEnd_EventsInIt(clientInstance *kurrentdb.Client) TestCall { return func(t *testing.T) { // create 10 events events := testCreateEvents(10) // append 10 events to StreamsClient.AppendToStreamAsync(Stream, StreamState.NoStream, events[:10]); streamID := NAME_GENERATOR.Generate() // append events to StreamsClient.AppendToStreamAsync(Stream, StreamState.NoStream, Events); - opts := esdb.AppendToStreamOptions{ - ExpectedRevision: esdb.NoStream{}, + opts := kurrentdb.AppendToStreamOptions{ + ExpectedRevision: kurrentdb.NoStream{}, } _, err := clientInstance.AppendToStream(context.Background(), streamID, opts, events[:10]...) @@ -216,15 +216,15 @@ func persistentSubscription_ToExistingStream_StartFromEnd_EventsInIt(clientInsta context.Background(), streamID, groupName, - esdb.PersistentStreamSubscriptionOptions{ - StartFrom: esdb.End{}, + kurrentdb.PersistentStreamSubscriptionOptions{ + StartFrom: kurrentdb.End{}, }, ) require.NoError(t, err) ctx, cancelFunc := context.WithTimeout(context.Background(), 5*time.Second) readConnectionClient, err := clientInstance.SubscribeToPersistentSubscription( - ctx, streamID, groupName, esdb.SubscribeToPersistentSubscriptionOptions{}) + ctx, streamID, groupName, kurrentdb.SubscribeToPersistentSubscriptionOptions{}) require.NoError(t, err) defer readConnectionClient.Close() @@ -256,7 +256,7 @@ func persistentSubscription_ToExistingStream_StartFromEnd_EventsInIt(clientInsta } } -func persistentSubscription_ToNonExistingStream_StartFromTwo_AppendEventsAfterwards(clientInstance *esdb.Client) TestCall { +func persistentSubscription_ToNonExistingStream_StartFromTwo_AppendEventsAfterwards(clientInstance *kurrentdb.Client) TestCall { return func(t *testing.T) { // create 3 events events := testCreateEvents(4) @@ -267,20 +267,20 @@ func persistentSubscription_ToNonExistingStream_StartFromTwo_AppendEventsAfterwa context.Background(), streamID, groupName, - esdb.PersistentStreamSubscriptionOptions{ - StartFrom: esdb.Revision(2), + kurrentdb.PersistentStreamSubscriptionOptions{ + StartFrom: kurrentdb.Revision(2), }, ) require.NoError(t, err) // append 3 event to StreamsClient.AppendToStreamAsync(Stream, StreamState.NoStream, events) - opts := esdb.AppendToStreamOptions{ - ExpectedRevision: esdb.NoStream{}, + opts := kurrentdb.AppendToStreamOptions{ + ExpectedRevision: kurrentdb.NoStream{}, } _, err = clientInstance.AppendToStream(context.Background(), streamID, opts, events...) require.NoError(t, err) // read one event readConnectionClient, err := clientInstance.SubscribeToPersistentSubscription( - context.Background(), streamID, groupName, esdb.SubscribeToPersistentSubscriptionOptions{}) + context.Background(), streamID, groupName, kurrentdb.SubscribeToPersistentSubscriptionOptions{}) require.NoError(t, err) defer readConnectionClient.Close() @@ -295,14 +295,14 @@ func persistentSubscription_ToNonExistingStream_StartFromTwo_AppendEventsAfterwa } } -func persistentSubscription_ToExistingStream_StartFrom10_EventsInItAppendEventsAfterwards(clientInstance *esdb.Client) TestCall { +func persistentSubscription_ToExistingStream_StartFrom10_EventsInItAppendEventsAfterwards(clientInstance *kurrentdb.Client) TestCall { return func(t *testing.T) { // create 11 events events := testCreateEvents(11) // append 10 events to StreamsClient.AppendToStreamAsync(Stream, StreamState.NoStream, events[:10]); - opts := esdb.AppendToStreamOptions{ - ExpectedRevision: esdb.NoStream{}, + opts := kurrentdb.AppendToStreamOptions{ + ExpectedRevision: kurrentdb.NoStream{}, } streamID := NAME_GENERATOR.Generate() _, err := clientInstance.AppendToStream(context.Background(), streamID, opts, events[:10]...) @@ -314,22 +314,22 @@ func persistentSubscription_ToExistingStream_StartFrom10_EventsInItAppendEventsA context.Background(), streamID, groupName, - esdb.PersistentStreamSubscriptionOptions{ - StartFrom: esdb.Revision(10), + kurrentdb.PersistentStreamSubscriptionOptions{ + StartFrom: kurrentdb.Revision(10), }, ) require.NoError(t, err) // append 1 event to StreamsClient.AppendToStreamAsync(Stream, StreamRevision(9), events[10:) - opts = esdb.AppendToStreamOptions{ - ExpectedRevision: esdb.Revision(9), + opts = kurrentdb.AppendToStreamOptions{ + ExpectedRevision: kurrentdb.Revision(9), } _, err = clientInstance.AppendToStream(context.Background(), streamID, opts, events[10:]...) require.NoError(t, err) // read one event readConnectionClient, err := clientInstance.SubscribeToPersistentSubscription( - context.Background(), streamID, groupName, esdb.SubscribeToPersistentSubscriptionOptions{}) + context.Background(), streamID, groupName, kurrentdb.SubscribeToPersistentSubscriptionOptions{}) require.NoError(t, err) defer readConnectionClient.Close() @@ -344,14 +344,14 @@ func persistentSubscription_ToExistingStream_StartFrom10_EventsInItAppendEventsA } } -func persistentSubscription_ToExistingStream_StartFrom4_EventsInIt(clientInstance *esdb.Client) TestCall { +func persistentSubscription_ToExistingStream_StartFrom4_EventsInIt(clientInstance *kurrentdb.Client) TestCall { return func(t *testing.T) { // create 11 events events := testCreateEvents(11) // append 10 events to StreamsClient.AppendToStreamAsync(Stream, StreamState.NoStream, events[:10]); - opts := esdb.AppendToStreamOptions{ - ExpectedRevision: esdb.NoStream{}, + opts := kurrentdb.AppendToStreamOptions{ + ExpectedRevision: kurrentdb.NoStream{}, } streamID := NAME_GENERATOR.Generate() _, err := clientInstance.AppendToStream(context.Background(), streamID, opts, events[:10]...) @@ -364,22 +364,22 @@ func persistentSubscription_ToExistingStream_StartFrom4_EventsInIt(clientInstanc context.Background(), streamID, groupName, - esdb.PersistentStreamSubscriptionOptions{ - StartFrom: esdb.Revision(4), + kurrentdb.PersistentStreamSubscriptionOptions{ + StartFrom: kurrentdb.Revision(4), }, ) require.NoError(t, err) // append 1 event to StreamsClient.AppendToStreamAsync(Stream, StreamRevision(9), events) - opts = esdb.AppendToStreamOptions{ - ExpectedRevision: esdb.Revision(9), + opts = kurrentdb.AppendToStreamOptions{ + ExpectedRevision: kurrentdb.Revision(9), } _, err = clientInstance.AppendToStream(context.Background(), streamID, opts, events[10:]...) require.NoError(t, err) // read one event readConnectionClient, err := clientInstance.SubscribeToPersistentSubscription( - context.Background(), streamID, groupName, esdb.SubscribeToPersistentSubscriptionOptions{}) + context.Background(), streamID, groupName, kurrentdb.SubscribeToPersistentSubscriptionOptions{}) require.NoError(t, err) defer readConnectionClient.Close() readEvent := readConnectionClient.Recv().EventAppeared.Event @@ -393,7 +393,7 @@ func persistentSubscription_ToExistingStream_StartFrom4_EventsInIt(clientInstanc } } -func persistentSubscription_ToExistingStream_StartFromHigherRevisionThenEventsInStream_EventsInItAppendEventsAfterwards(clientInstance *esdb.Client) TestCall { +func persistentSubscription_ToExistingStream_StartFromHigherRevisionThenEventsInStream_EventsInItAppendEventsAfterwards(clientInstance *kurrentdb.Client) TestCall { return func(t *testing.T) { // create 12 events events := testCreateEvents(12) @@ -401,8 +401,8 @@ func persistentSubscription_ToExistingStream_StartFromHigherRevisionThenEventsIn // append 11 events to StreamsClient.AppendToStreamAsync(Stream, StreamState.NoStream, events[:11]); // append 10 events to StreamsClient.AppendToStreamAsync(Stream, StreamState.NoStream, events[:10]); streamID := NAME_GENERATOR.Generate() - opts := esdb.AppendToStreamOptions{ - ExpectedRevision: esdb.NoStream{}, + opts := kurrentdb.AppendToStreamOptions{ + ExpectedRevision: kurrentdb.NoStream{}, } _, err := clientInstance.AppendToStream(context.Background(), streamID, opts, events[:11]...) require.NoError(t, err) @@ -413,15 +413,15 @@ func persistentSubscription_ToExistingStream_StartFromHigherRevisionThenEventsIn context.Background(), streamID, groupName, - esdb.PersistentStreamSubscriptionOptions{ - StartFrom: esdb.Revision(11), + kurrentdb.PersistentStreamSubscriptionOptions{ + StartFrom: kurrentdb.Revision(11), }, ) require.NoError(t, err) // append event to StreamsClient.AppendToStreamAsync(Stream, StreamRevision(10), events[11:]) - opts = esdb.AppendToStreamOptions{ - ExpectedRevision: esdb.Revision(10), + opts = kurrentdb.AppendToStreamOptions{ + ExpectedRevision: kurrentdb.Revision(10), } _, err = clientInstance.AppendToStream(context.Background(), streamID, opts, events[11]) @@ -429,7 +429,7 @@ func persistentSubscription_ToExistingStream_StartFromHigherRevisionThenEventsIn // read one event readConnectionClient, err := clientInstance.SubscribeToPersistentSubscription( - context.Background(), streamID, groupName, esdb.SubscribeToPersistentSubscriptionOptions{}) + context.Background(), streamID, groupName, kurrentdb.SubscribeToPersistentSubscriptionOptions{}) require.NoError(t, err) readEvent := readConnectionClient.Recv().EventAppeared.Event require.NoError(t, err) @@ -443,13 +443,13 @@ func persistentSubscription_ToExistingStream_StartFromHigherRevisionThenEventsIn } } -func persistentSubscription_ReadExistingStream_NackToReceiveNewEvents(clientInstance *esdb.Client) TestCall { +func persistentSubscription_ReadExistingStream_NackToReceiveNewEvents(clientInstance *kurrentdb.Client) TestCall { return func(t *testing.T) { streamID := NAME_GENERATOR.Generate() firstEvent := createTestEvent() secondEvent := createTestEvent() thirdEvent := createTestEvent() - events := []esdb.EventData{firstEvent, secondEvent, thirdEvent} + events := []kurrentdb.EventData{firstEvent, secondEvent, thirdEvent} pushEventsToStream(t, clientInstance, streamID, events) groupName := "Group 1" @@ -457,13 +457,13 @@ func persistentSubscription_ReadExistingStream_NackToReceiveNewEvents(clientInst context.Background(), streamID, groupName, - esdb.PersistentStreamSubscriptionOptions{ - StartFrom: esdb.Start{}, + kurrentdb.PersistentStreamSubscriptionOptions{ + StartFrom: kurrentdb.Start{}, }, ) readConnectionClient, err := clientInstance.SubscribeToPersistentSubscription( - context.Background(), streamID, groupName, esdb.SubscribeToPersistentSubscriptionOptions{ + context.Background(), streamID, groupName, kurrentdb.SubscribeToPersistentSubscriptionOptions{ BufferSize: 2, }) require.NoError(t, err) @@ -479,7 +479,7 @@ func persistentSubscription_ReadExistingStream_NackToReceiveNewEvents(clientInst // since buffer size is two, after reading two outstanding messages // we must acknowledge a message in order to receive third one - err = readConnectionClient.Nack("test reason", esdb.NackActionPark, firstReadEvent) + err = readConnectionClient.Nack("test reason", kurrentdb.NackActionPark, firstReadEvent) require.NoError(t, err) thirdReadEvent := readConnectionClient.Recv() @@ -488,19 +488,19 @@ func persistentSubscription_ReadExistingStream_NackToReceiveNewEvents(clientInst } } -func persistentSubscriptionToAll_Read(clientInstance *esdb.Client) TestCall { +func persistentSubscriptionToAll_Read(clientInstance *kurrentdb.Client) TestCall { return func(t *testing.T) { groupName := "Group 1" err := clientInstance.CreatePersistentSubscriptionToAll( context.Background(), groupName, - esdb.PersistentAllSubscriptionOptions{ - StartFrom: esdb.Start{}, + kurrentdb.PersistentAllSubscriptionOptions{ + StartFrom: kurrentdb.Start{}, }, ) - if err, ok := esdb.FromError(err); !ok { - if err.Code() == esdb.ErrorCodeUnsupportedFeature && IsESDBVersion20() { + if err, ok := kurrentdb.FromError(err); !ok { + if err.Code() == kurrentdb.ErrorCodeUnsupportedFeature && IsESDBVersion20() { t.Skip() } } @@ -508,7 +508,7 @@ func persistentSubscriptionToAll_Read(clientInstance *esdb.Client) TestCall { require.NoError(t, err) readConnectionClient, err := clientInstance.SubscribeToPersistentSubscriptionToAll( - context.Background(), groupName, esdb.SubscribeToPersistentSubscriptionOptions{ + context.Background(), groupName, kurrentdb.SubscribeToPersistentSubscriptionOptions{ BufferSize: 2, }, ) @@ -536,8 +536,8 @@ func persistentSubscriptionToAll_Read(clientInstance *esdb.Client) TestCall { } } -func testCreateEvents(count uint32) []esdb.EventData { - result := make([]esdb.EventData, count) +func testCreateEvents(count uint32) []kurrentdb.EventData { + result := make([]kurrentdb.EventData, count) var i uint32 = 0 for ; i < count; i++ { result[i] = createTestEvent() diff --git a/esdb/persistent_subscriptions_test.go b/kurrentdb/persistent_subscriptions_test.go similarity index 70% rename from esdb/persistent_subscriptions_test.go rename to kurrentdb/persistent_subscriptions_test.go index 60f0ad7b..73e06470 100644 --- a/esdb/persistent_subscriptions_test.go +++ b/kurrentdb/persistent_subscriptions_test.go @@ -1,18 +1,18 @@ -package esdb_test +package kurrentdb_test import ( "context" "fmt" + "github.com/EventStore/EventStore-Client-Go/v1/kurrentdb" "sync" "testing" "time" - "github.com/EventStore/EventStore-Client-Go/v4/esdb" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) -func PersistentSubTests(t *testing.T, emptyDBClient *esdb.Client, populatedDBClient *esdb.Client) { +func PersistentSubTests(t *testing.T, emptyDBClient *kurrentdb.Client, populatedDBClient *kurrentdb.Client) { t.Run("PersistentSubTests", func(t *testing.T) { t.Run("createPersistentStreamSubscription", createPersistentStreamSubscription(emptyDBClient)) t.Run("createPersistentStreamSubscription_MessageTimeoutZero", createPersistentStreamSubscription_MessageTimeoutZero(emptyDBClient)) @@ -42,7 +42,7 @@ func PersistentSubTests(t *testing.T, emptyDBClient *esdb.Client, populatedDBCli }) } -func createPersistentStreamSubscription(clientInstance *esdb.Client) TestCall { +func createPersistentStreamSubscription(clientInstance *kurrentdb.Client) TestCall { return func(t *testing.T) { streamID := NAME_GENERATOR.Generate() pushEventToStream(t, clientInstance, streamID) @@ -51,26 +51,26 @@ func createPersistentStreamSubscription(clientInstance *esdb.Client) TestCall { context.Background(), streamID, "Group 1", - esdb.PersistentStreamSubscriptionOptions{}, + kurrentdb.PersistentStreamSubscriptionOptions{}, ) require.NoError(t, err) } } -func createPersistentStreamSubscription_MessageTimeoutZero(clientInstance *esdb.Client) TestCall { +func createPersistentStreamSubscription_MessageTimeoutZero(clientInstance *kurrentdb.Client) TestCall { return func(t *testing.T) { streamID := NAME_GENERATOR.Generate() pushEventToStream(t, clientInstance, streamID) - settings := esdb.SubscriptionSettingsDefault() + settings := kurrentdb.SubscriptionSettingsDefault() settings.MessageTimeout = 0 err := clientInstance.CreatePersistentSubscription( context.Background(), streamID, "Group 1", - esdb.PersistentStreamSubscriptionOptions{ + kurrentdb.PersistentStreamSubscriptionOptions{ Settings: &settings, }, ) @@ -79,7 +79,7 @@ func createPersistentStreamSubscription_MessageTimeoutZero(clientInstance *esdb. } } -func createPersistentStreamSubscription_StreamNotExits(clientInstance *esdb.Client) TestCall { +func createPersistentStreamSubscription_StreamNotExits(clientInstance *kurrentdb.Client) TestCall { return func(t *testing.T) { streamID := NAME_GENERATOR.Generate() @@ -87,14 +87,14 @@ func createPersistentStreamSubscription_StreamNotExits(clientInstance *esdb.Clie context.Background(), streamID, "Group 1", - esdb.PersistentStreamSubscriptionOptions{}, + kurrentdb.PersistentStreamSubscriptionOptions{}, ) require.NoError(t, err) } } -func createPersistentStreamSubscription_FailsIfAlreadyExists(clientInstance *esdb.Client) TestCall { +func createPersistentStreamSubscription_FailsIfAlreadyExists(clientInstance *kurrentdb.Client) TestCall { return func(t *testing.T) { streamID := NAME_GENERATOR.Generate() pushEventToStream(t, clientInstance, streamID) @@ -103,7 +103,7 @@ func createPersistentStreamSubscription_FailsIfAlreadyExists(clientInstance *esd context.Background(), streamID, "Group 1", - esdb.PersistentStreamSubscriptionOptions{}, + kurrentdb.PersistentStreamSubscriptionOptions{}, ) require.NoError(t, err) @@ -112,16 +112,16 @@ func createPersistentStreamSubscription_FailsIfAlreadyExists(clientInstance *esd context.Background(), streamID, "Group 1", - esdb.PersistentStreamSubscriptionOptions{}, + kurrentdb.PersistentStreamSubscriptionOptions{}, ) - esdbErr, ok := esdb.FromError(err) + esdbErr, ok := kurrentdb.FromError(err) assert.False(t, ok) - assert.Equal(t, esdbErr.Code(), esdb.ErrorCodeResourceAlreadyExists) + assert.Equal(t, esdbErr.Code(), kurrentdb.ErrorCodeResourceAlreadyExists) } } -func createPersistentStreamSubscription_AfterDeleting(clientInstance *esdb.Client) TestCall { +func createPersistentStreamSubscription_AfterDeleting(clientInstance *kurrentdb.Client) TestCall { return func(t *testing.T) { streamID := NAME_GENERATOR.Generate() pushEventToStream(t, clientInstance, streamID) @@ -130,12 +130,12 @@ func createPersistentStreamSubscription_AfterDeleting(clientInstance *esdb.Clien context.Background(), streamID, "Group 1", - esdb.PersistentStreamSubscriptionOptions{}, + kurrentdb.PersistentStreamSubscriptionOptions{}, ) require.NoError(t, err) - err = clientInstance.DeletePersistentSubscription(context.Background(), streamID, "Group 1", esdb.DeletePersistentSubscriptionOptions{}) + err = clientInstance.DeletePersistentSubscription(context.Background(), streamID, "Group 1", kurrentdb.DeletePersistentSubscriptionOptions{}) require.NoError(t, err) @@ -143,14 +143,14 @@ func createPersistentStreamSubscription_AfterDeleting(clientInstance *esdb.Clien context.Background(), streamID, "Group 1", - esdb.PersistentStreamSubscriptionOptions{}, + kurrentdb.PersistentStreamSubscriptionOptions{}, ) require.NoError(t, err) } } -func updatePersistentStreamSubscription(clientInstance *esdb.Client) TestCall { +func updatePersistentStreamSubscription(clientInstance *kurrentdb.Client) TestCall { return func(t *testing.T) { streamID := NAME_GENERATOR.Generate() pushEventToStream(t, clientInstance, streamID) @@ -159,14 +159,14 @@ func updatePersistentStreamSubscription(clientInstance *esdb.Client) TestCall { context.Background(), streamID, "Group 1", - esdb.PersistentStreamSubscriptionOptions{}, + kurrentdb.PersistentStreamSubscriptionOptions{}, ) require.NoError(t, err) - settings := esdb.SubscriptionSettingsDefault() + settings := kurrentdb.SubscriptionSettingsDefault() settings.HistoryBufferSize = settings.HistoryBufferSize + 1 - settings.ConsumerStrategyName = esdb.ConsumerStrategyDispatchToSingle + settings.ConsumerStrategyName = kurrentdb.ConsumerStrategyDispatchToSingle settings.MaxSubscriberCount = settings.MaxSubscriberCount + 1 settings.ReadBatchSize = settings.ReadBatchSize + 1 settings.CheckpointAfter = settings.CheckpointAfter + 1 @@ -178,7 +178,7 @@ func updatePersistentStreamSubscription(clientInstance *esdb.Client) TestCall { settings.ExtraStatistics = !settings.ExtraStatistics settings.ResolveLinkTos = !settings.ResolveLinkTos - err = clientInstance.UpdatePersistentSubscription(context.Background(), streamID, "Group 1", esdb.PersistentStreamSubscriptionOptions{ + err = clientInstance.UpdatePersistentSubscription(context.Background(), streamID, "Group 1", kurrentdb.PersistentStreamSubscriptionOptions{ Settings: &settings, }) @@ -186,17 +186,17 @@ func updatePersistentStreamSubscription(clientInstance *esdb.Client) TestCall { } } -func updatePersistentStreamSubscription_ErrIfSubscriptionDoesNotExist(clientInstance *esdb.Client) TestCall { +func updatePersistentStreamSubscription_ErrIfSubscriptionDoesNotExist(clientInstance *kurrentdb.Client) TestCall { return func(t *testing.T) { streamID := NAME_GENERATOR.Generate() - err := clientInstance.UpdatePersistentSubscription(context.Background(), streamID, "Group 1", esdb.PersistentStreamSubscriptionOptions{}) + err := clientInstance.UpdatePersistentSubscription(context.Background(), streamID, "Group 1", kurrentdb.PersistentStreamSubscriptionOptions{}) require.Error(t, err) } } -func deletePersistentStreamSubscription(clientInstance *esdb.Client) TestCall { +func deletePersistentStreamSubscription(clientInstance *kurrentdb.Client) TestCall { return func(t *testing.T) { streamID := NAME_GENERATOR.Generate() pushEventToStream(t, clientInstance, streamID) @@ -205,7 +205,7 @@ func deletePersistentStreamSubscription(clientInstance *esdb.Client) TestCall { context.Background(), streamID, "Group 1", - esdb.PersistentStreamSubscriptionOptions{}, + kurrentdb.PersistentStreamSubscriptionOptions{}, ) require.NoError(t, err) @@ -214,47 +214,47 @@ func deletePersistentStreamSubscription(clientInstance *esdb.Client) TestCall { context.Background(), streamID, "Group 1", - esdb.DeletePersistentSubscriptionOptions{}, + kurrentdb.DeletePersistentSubscriptionOptions{}, ) require.NoError(t, err) } } -func deletePersistentSubscription_ErrIfSubscriptionDoesNotExist(clientInstance *esdb.Client) TestCall { +func deletePersistentSubscription_ErrIfSubscriptionDoesNotExist(clientInstance *kurrentdb.Client) TestCall { return func(t *testing.T) { err := clientInstance.DeletePersistentSubscription( context.Background(), NAME_GENERATOR.Generate(), "a", - esdb.DeletePersistentSubscriptionOptions{}, + kurrentdb.DeletePersistentSubscriptionOptions{}, ) - esdbErr, ok := esdb.FromError(err) + esdbErr, ok := kurrentdb.FromError(err) assert.False(t, ok) - assert.Equal(t, esdbErr.Code(), esdb.ErrorCodeResourceNotFound) + assert.Equal(t, esdbErr.Code(), kurrentdb.ErrorCodeResourceNotFound) } } -func pushEventToStream(t *testing.T, clientInstance *esdb.Client, streamID string) { +func pushEventToStream(t *testing.T, clientInstance *kurrentdb.Client, streamID string) { testEvent := createTestEvent() - pushEventsToStream(t, clientInstance, streamID, []esdb.EventData{testEvent}) + pushEventsToStream(t, clientInstance, streamID, []kurrentdb.EventData{testEvent}) } func pushEventsToStream(t *testing.T, - clientInstance *esdb.Client, + clientInstance *kurrentdb.Client, streamID string, - events []esdb.EventData) { + events []kurrentdb.EventData) { - opts := esdb.AppendToStreamOptions{ - ExpectedRevision: esdb.NoStream{}, + opts := kurrentdb.AppendToStreamOptions{ + ExpectedRevision: kurrentdb.NoStream{}, } _, err := clientInstance.AppendToStream(context.Background(), streamID, opts, events...) require.NoError(t, err) } -func testPersistentSubscriptionClosing(db *esdb.Client) TestCall { +func testPersistentSubscriptionClosing(db *kurrentdb.Client) TestCall { return func(t *testing.T) { if db == nil { t.Skip() @@ -263,8 +263,8 @@ func testPersistentSubscriptionClosing(db *esdb.Client) TestCall { streamID := "dataset20M-0" groupName := "Group 1" - err := db.CreatePersistentSubscription(context.Background(), streamID, groupName, esdb.PersistentStreamSubscriptionOptions{ - StartFrom: esdb.Start{}, + err := db.CreatePersistentSubscription(context.Background(), streamID, groupName, kurrentdb.PersistentStreamSubscriptionOptions{ + StartFrom: kurrentdb.Start{}, }) require.NoError(t, err) @@ -273,7 +273,7 @@ func testPersistentSubscriptionClosing(db *esdb.Client) TestCall { var droppedEvent sync.WaitGroup subscription, err := db.SubscribeToPersistentSubscription( - context.Background(), streamID, groupName, esdb.SubscribeToPersistentSubscriptionOptions{ + context.Background(), streamID, groupName, kurrentdb.SubscribeToPersistentSubscriptionOptions{ BufferSize: 2, }) @@ -314,18 +314,18 @@ func testPersistentSubscriptionClosing(db *esdb.Client) TestCall { } } -func persistentAllCreate(client *esdb.Client) TestCall { +func persistentAllCreate(client *kurrentdb.Client) TestCall { return func(t *testing.T) { groupName := NAME_GENERATOR.Generate() err := client.CreatePersistentSubscriptionToAll( context.Background(), groupName, - esdb.PersistentAllSubscriptionOptions{}, + kurrentdb.PersistentAllSubscriptionOptions{}, ) - if err, ok := esdb.FromError(err); !ok { - if err.Code() == esdb.ErrorCodeUnsupportedFeature && IsESDBVersion20() { + if err, ok := kurrentdb.FromError(err); !ok { + if err.Code() == kurrentdb.ErrorCodeUnsupportedFeature && IsESDBVersion20() { t.Skip() } } @@ -334,28 +334,28 @@ func persistentAllCreate(client *esdb.Client) TestCall { } } -func persistentAllUpdate(client *esdb.Client) TestCall { +func persistentAllUpdate(client *kurrentdb.Client) TestCall { return func(t *testing.T) { groupName := NAME_GENERATOR.Generate() err := client.CreatePersistentSubscriptionToAll( context.Background(), groupName, - esdb.PersistentAllSubscriptionOptions{}, + kurrentdb.PersistentAllSubscriptionOptions{}, ) - if err, ok := esdb.FromError(err); !ok { - if err.Code() == esdb.ErrorCodeUnsupportedFeature && IsESDBVersion20() { + if err, ok := kurrentdb.FromError(err); !ok { + if err.Code() == kurrentdb.ErrorCodeUnsupportedFeature && IsESDBVersion20() { t.Skip() } } require.NoError(t, err) - setts := esdb.SubscriptionSettingsDefault() + setts := kurrentdb.SubscriptionSettingsDefault() setts.ResolveLinkTos = true - err = client.UpdatePersistentSubscriptionToAll(context.Background(), groupName, esdb.PersistentAllSubscriptionOptions{ + err = client.UpdatePersistentSubscriptionToAll(context.Background(), groupName, kurrentdb.PersistentAllSubscriptionOptions{ Settings: &setts, }) @@ -363,48 +363,48 @@ func persistentAllUpdate(client *esdb.Client) TestCall { } } -func persistentAllDelete(client *esdb.Client) TestCall { +func persistentAllDelete(client *kurrentdb.Client) TestCall { return func(t *testing.T) { groupName := NAME_GENERATOR.Generate() err := client.CreatePersistentSubscriptionToAll( context.Background(), groupName, - esdb.PersistentAllSubscriptionOptions{}, + kurrentdb.PersistentAllSubscriptionOptions{}, ) - if err, ok := esdb.FromError(err); !ok { - if err.Code() == esdb.ErrorCodeUnsupportedFeature && IsESDBVersion20() { + if err, ok := kurrentdb.FromError(err); !ok { + if err.Code() == kurrentdb.ErrorCodeUnsupportedFeature && IsESDBVersion20() { t.Skip() } } require.NoError(t, err) - err = client.DeletePersistentSubscriptionToAll(context.Background(), groupName, esdb.DeletePersistentSubscriptionOptions{}) + err = client.DeletePersistentSubscriptionToAll(context.Background(), groupName, kurrentdb.DeletePersistentSubscriptionOptions{}) require.NoError(t, err) } } -func persistentReplayParkedMessages(client *esdb.Client) TestCall { +func persistentReplayParkedMessages(client *kurrentdb.Client) TestCall { return func(t *testing.T) { groupName := NAME_GENERATOR.Generate() streamName := NAME_GENERATOR.Generate() eventCount := 2 - err := client.CreatePersistentSubscription(context.Background(), streamName, groupName, esdb.PersistentStreamSubscriptionOptions{}) + err := client.CreatePersistentSubscription(context.Background(), streamName, groupName, kurrentdb.PersistentStreamSubscriptionOptions{}) require.NoError(t, err) - sub, err := client.SubscribeToPersistentSubscription(context.Background(), streamName, groupName, esdb.SubscribeToPersistentSubscriptionOptions{}) + sub, err := client.SubscribeToPersistentSubscription(context.Background(), streamName, groupName, kurrentdb.SubscribeToPersistentSubscriptionOptions{}) defer sub.Close() require.NoError(t, err) events := testCreateEvents(uint32(eventCount)) - _, err = client.AppendToStream(context.Background(), streamName, esdb.AppendToStreamOptions{}, events...) + _, err = client.AppendToStream(context.Background(), streamName, kurrentdb.AppendToStreamOptions{}, events...) require.NoError(t, err) @@ -417,7 +417,7 @@ func persistentReplayParkedMessages(client *esdb.Client) TestCall { } if event.EventAppeared != nil { - err = sub.Nack("because reasons", esdb.NackActionPark, event.EventAppeared.Event) + err = sub.Nack("because reasons", kurrentdb.NackActionPark, event.EventAppeared.Event) require.NoError(t, err) i++ } @@ -426,7 +426,7 @@ func persistentReplayParkedMessages(client *esdb.Client) TestCall { // We let the server the time to park those events. time.Sleep(5 * time.Second) - err = client.ReplayParkedMessages(context.Background(), streamName, groupName, esdb.ReplayParkedMessagesOptions{}) + err = client.ReplayParkedMessages(context.Background(), streamName, groupName, kurrentdb.ReplayParkedMessagesOptions{}) require.NoError(t, err) @@ -449,24 +449,24 @@ func persistentReplayParkedMessages(client *esdb.Client) TestCall { } } -func persistentReplayParkedMessagesWithCredentialsOverride(client *esdb.Client) TestCall { +func persistentReplayParkedMessagesWithCredentialsOverride(client *kurrentdb.Client) TestCall { return func(t *testing.T) { groupName := NAME_GENERATOR.Generate() streamName := NAME_GENERATOR.Generate() eventCount := 2 - err := client.CreatePersistentSubscription(context.Background(), streamName, groupName, esdb.PersistentStreamSubscriptionOptions{}) + err := client.CreatePersistentSubscription(context.Background(), streamName, groupName, kurrentdb.PersistentStreamSubscriptionOptions{}) require.NoError(t, err) - sub, err := client.SubscribeToPersistentSubscription(context.Background(), streamName, groupName, esdb.SubscribeToPersistentSubscriptionOptions{}) + sub, err := client.SubscribeToPersistentSubscription(context.Background(), streamName, groupName, kurrentdb.SubscribeToPersistentSubscriptionOptions{}) defer sub.Close() require.NoError(t, err) events := testCreateEvents(uint32(eventCount)) - _, err = client.AppendToStream(context.Background(), streamName, esdb.AppendToStreamOptions{}, events...) + _, err = client.AppendToStream(context.Background(), streamName, kurrentdb.AppendToStreamOptions{}, events...) require.NoError(t, err) @@ -479,7 +479,7 @@ func persistentReplayParkedMessagesWithCredentialsOverride(client *esdb.Client) } if event.EventAppeared != nil { - err = sub.Nack("because reasons", esdb.NackActionPark, event.EventAppeared.Event) + err = sub.Nack("because reasons", kurrentdb.NackActionPark, event.EventAppeared.Event) require.NoError(t, err) i++ } @@ -488,8 +488,8 @@ func persistentReplayParkedMessagesWithCredentialsOverride(client *esdb.Client) // We let the server the time to park those events. time.Sleep(5 * time.Second) - opts := esdb.ReplayParkedMessagesOptions{ - Authenticated: &esdb.Credentials{ + opts := kurrentdb.ReplayParkedMessagesOptions{ + Authenticated: &kurrentdb.Credentials{ Login: "admin", Password: "changeit", }, @@ -500,30 +500,30 @@ func persistentReplayParkedMessagesWithCredentialsOverride(client *esdb.Client) } } -func persistentReplayParkedMessagesToAll(client *esdb.Client) TestCall { +func persistentReplayParkedMessagesToAll(client *kurrentdb.Client) TestCall { return func(t *testing.T) { streamName := NAME_GENERATOR.Generate() groupName := NAME_GENERATOR.Generate() eventCount := 2 - err := client.CreatePersistentSubscriptionToAll(context.Background(), groupName, esdb.PersistentAllSubscriptionOptions{}) + err := client.CreatePersistentSubscriptionToAll(context.Background(), groupName, kurrentdb.PersistentAllSubscriptionOptions{}) - if err, ok := esdb.FromError(err); !ok { - if err.Code() == esdb.ErrorCodeUnsupportedFeature { + if err, ok := kurrentdb.FromError(err); !ok { + if err.Code() == kurrentdb.ErrorCodeUnsupportedFeature { t.Skip() } } require.NoError(t, err) - sub, err := client.SubscribeToPersistentSubscriptionToAll(context.Background(), groupName, esdb.SubscribeToPersistentSubscriptionOptions{}) + sub, err := client.SubscribeToPersistentSubscriptionToAll(context.Background(), groupName, kurrentdb.SubscribeToPersistentSubscriptionOptions{}) defer sub.Close() require.NoError(t, err) events := testCreateEvents(uint32(eventCount)) - _, err = client.AppendToStream(context.Background(), streamName, esdb.AppendToStreamOptions{}, events...) + _, err = client.AppendToStream(context.Background(), streamName, kurrentdb.AppendToStreamOptions{}, events...) require.NoError(t, err) @@ -537,7 +537,7 @@ func persistentReplayParkedMessagesToAll(client *esdb.Client) TestCall { if event.EventAppeared != nil { if event.EventAppeared.Event.OriginalEvent().StreamID == streamName { - err = sub.Nack("because reasons", esdb.NackActionPark, event.EventAppeared.Event) + err = sub.Nack("because reasons", kurrentdb.NackActionPark, event.EventAppeared.Event) require.NoError(t, err) i++ } else { @@ -550,7 +550,7 @@ func persistentReplayParkedMessagesToAll(client *esdb.Client) TestCall { // We let the server the time to park those events. time.Sleep(5 * time.Second) - err = client.ReplayParkedMessagesToAll(context.Background(), groupName, esdb.ReplayParkedMessagesOptions{}) + err = client.ReplayParkedMessagesToAll(context.Background(), groupName, kurrentdb.ReplayParkedMessagesOptions{}) require.NoError(t, err) @@ -576,16 +576,16 @@ func persistentReplayParkedMessagesToAll(client *esdb.Client) TestCall { } } -func persistentListAllSubs(client *esdb.Client) TestCall { +func persistentListAllSubs(client *kurrentdb.Client) TestCall { return func(t *testing.T) { groupName := NAME_GENERATOR.Generate() streamName := NAME_GENERATOR.Generate() - err := client.CreatePersistentSubscription(context.Background(), streamName, groupName, esdb.PersistentStreamSubscriptionOptions{}) + err := client.CreatePersistentSubscription(context.Background(), streamName, groupName, kurrentdb.PersistentStreamSubscriptionOptions{}) require.NoError(t, err) - subs, err := client.ListAllPersistentSubscriptions(context.Background(), esdb.ListPersistentSubscriptionsOptions{}) + subs, err := client.ListAllPersistentSubscriptions(context.Background(), kurrentdb.ListPersistentSubscriptionsOptions{}) require.NoError(t, err) require.NotNil(t, subs) @@ -603,17 +603,17 @@ func persistentListAllSubs(client *esdb.Client) TestCall { } } -func persistentListAllSubsWithCredentialsOverride(client *esdb.Client) TestCall { +func persistentListAllSubsWithCredentialsOverride(client *kurrentdb.Client) TestCall { return func(t *testing.T) { groupName := NAME_GENERATOR.Generate() streamName := NAME_GENERATOR.Generate() - err := client.CreatePersistentSubscription(context.Background(), streamName, groupName, esdb.PersistentStreamSubscriptionOptions{}) + err := client.CreatePersistentSubscription(context.Background(), streamName, groupName, kurrentdb.PersistentStreamSubscriptionOptions{}) require.NoError(t, err) - opts := esdb.ListPersistentSubscriptionsOptions{ - Authenticated: &esdb.Credentials{ + opts := kurrentdb.ListPersistentSubscriptionsOptions{ + Authenticated: &kurrentdb.Credentials{ Login: "admin", Password: "changeit", }, @@ -624,7 +624,7 @@ func persistentListAllSubsWithCredentialsOverride(client *esdb.Client) TestCall } } -func persistentListSubsForStream(client *esdb.Client) TestCall { +func persistentListSubsForStream(client *kurrentdb.Client) TestCall { return func(t *testing.T) { streamName := NAME_GENERATOR.Generate() groupNames := make(map[string]int) @@ -633,14 +633,14 @@ func persistentListSubsForStream(client *esdb.Client) TestCall { for i := 0; i < count; i++ { name := NAME_GENERATOR.Generate() - err = client.CreatePersistentSubscription(context.Background(), streamName, name, esdb.PersistentStreamSubscriptionOptions{}) + err = client.CreatePersistentSubscription(context.Background(), streamName, name, kurrentdb.PersistentStreamSubscriptionOptions{}) require.NoError(t, err) groupNames[name] = 0 } require.NoError(t, err) - subs, err := client.ListPersistentSubscriptionsForStream(context.Background(), streamName, esdb.ListPersistentSubscriptionsOptions{}) + subs, err := client.ListPersistentSubscriptionsForStream(context.Background(), streamName, kurrentdb.ListPersistentSubscriptionsOptions{}) require.NoError(t, err) require.NotNil(t, subs) @@ -659,7 +659,7 @@ func persistentListSubsForStream(client *esdb.Client) TestCall { } } -func persistentListSubsToAll(client *esdb.Client) TestCall { +func persistentListSubsToAll(client *kurrentdb.Client) TestCall { return func(t *testing.T) { groupNames := make(map[string]int) var err error @@ -667,10 +667,10 @@ func persistentListSubsToAll(client *esdb.Client) TestCall { for i := 0; i < count; i++ { name := NAME_GENERATOR.Generate() - err = client.CreatePersistentSubscriptionToAll(context.Background(), name, esdb.PersistentAllSubscriptionOptions{}) + err = client.CreatePersistentSubscriptionToAll(context.Background(), name, kurrentdb.PersistentAllSubscriptionOptions{}) - if err, ok := esdb.FromError(err); !ok { - if err.Code() == esdb.ErrorCodeUnsupportedFeature { + if err, ok := kurrentdb.FromError(err); !ok { + if err.Code() == kurrentdb.ErrorCodeUnsupportedFeature { t.Skip() } } @@ -681,7 +681,7 @@ func persistentListSubsToAll(client *esdb.Client) TestCall { require.NoError(t, err) - subs, err := client.ListPersistentSubscriptionsToAll(context.Background(), esdb.ListPersistentSubscriptionsOptions{}) + subs, err := client.ListPersistentSubscriptionsToAll(context.Background(), kurrentdb.ListPersistentSubscriptionsOptions{}) require.NoError(t, err) require.NotNil(t, subs) @@ -698,27 +698,27 @@ func persistentListSubsToAll(client *esdb.Client) TestCall { } } -func persistentGetInfo(client *esdb.Client) TestCall { +func persistentGetInfo(client *kurrentdb.Client) TestCall { return func(t *testing.T) { streamName := NAME_GENERATOR.Generate() groupName := NAME_GENERATOR.Generate() - setts := esdb.SubscriptionSettingsDefault() + setts := kurrentdb.SubscriptionSettingsDefault() setts.CheckpointLowerBound = 1 setts.CheckpointUpperBound = 1 - var events []esdb.EventData + var events []kurrentdb.EventData for i := 0; i < 50; i++ { events = append(events, createTestEvent()) } - _, err := client.AppendToStream(context.Background(), streamName, esdb.AppendToStreamOptions{}, events...) + _, err := client.AppendToStream(context.Background(), streamName, kurrentdb.AppendToStreamOptions{}, events...) require.NoError(t, err) - err = client.CreatePersistentSubscription(context.Background(), streamName, groupName, esdb.PersistentStreamSubscriptionOptions{ - StartFrom: esdb.Start{}, + err = client.CreatePersistentSubscription(context.Background(), streamName, groupName, kurrentdb.PersistentStreamSubscriptionOptions{ + StartFrom: kurrentdb.Start{}, Settings: &setts, }) @@ -727,7 +727,7 @@ func persistentGetInfo(client *esdb.Client) TestCall { var receivedEvents sync.WaitGroup subscription, err := client.SubscribeToPersistentSubscription( - context.Background(), streamName, groupName, esdb.SubscribeToPersistentSubscriptionOptions{ + context.Background(), streamName, groupName, kurrentdb.SubscribeToPersistentSubscriptionOptions{ BufferSize: 2, }) @@ -758,7 +758,7 @@ func persistentGetInfo(client *esdb.Client) TestCall { receivedEvents.Add(1) timedOut := waitWithTimeout(&receivedEvents, time.Duration(5)*time.Second) require.False(t, timedOut, "Timed out waiting for initial set of events") - info, err := client.GetPersistentSubscriptionInfo(context.Background(), streamName, groupName, esdb.GetPersistentSubscriptionOptions{}) + info, err := client.GetPersistentSubscriptionInfo(context.Background(), streamName, groupName, kurrentdb.GetPersistentSubscriptionOptions{}) require.NoError(t, err) require.Equal(t, streamName, info.EventSource) require.Equal(t, groupName, info.GroupName) @@ -766,17 +766,17 @@ func persistentGetInfo(client *esdb.Client) TestCall { } } -func persistentGetInfoWithCredentialsOverride(client *esdb.Client) TestCall { +func persistentGetInfoWithCredentialsOverride(client *kurrentdb.Client) TestCall { return func(t *testing.T) { streamName := NAME_GENERATOR.Generate() groupName := NAME_GENERATOR.Generate() - err := client.CreatePersistentSubscription(context.Background(), streamName, groupName, esdb.PersistentStreamSubscriptionOptions{}) + err := client.CreatePersistentSubscription(context.Background(), streamName, groupName, kurrentdb.PersistentStreamSubscriptionOptions{}) require.NoError(t, err) - opts := esdb.GetPersistentSubscriptionOptions{ - Authenticated: &esdb.Credentials{ + opts := kurrentdb.GetPersistentSubscriptionOptions{ + Authenticated: &kurrentdb.Credentials{ Login: "admin", Password: "changeit", }, @@ -790,21 +790,21 @@ func persistentGetInfoWithCredentialsOverride(client *esdb.Client) TestCall { } } -func persistentGetInfoToAll(client *esdb.Client) TestCall { +func persistentGetInfoToAll(client *kurrentdb.Client) TestCall { return func(t *testing.T) { groupName := NAME_GENERATOR.Generate() - err := client.CreatePersistentSubscriptionToAll(context.Background(), groupName, esdb.PersistentAllSubscriptionOptions{}) + err := client.CreatePersistentSubscriptionToAll(context.Background(), groupName, kurrentdb.PersistentAllSubscriptionOptions{}) - if err, ok := esdb.FromError(err); !ok { - if err.Code() == esdb.ErrorCodeUnsupportedFeature { + if err, ok := kurrentdb.FromError(err); !ok { + if err.Code() == kurrentdb.ErrorCodeUnsupportedFeature { t.Skip() } } require.NoError(t, err) - sub, err := client.GetPersistentSubscriptionInfoToAll(context.Background(), groupName, esdb.GetPersistentSubscriptionOptions{}) + sub, err := client.GetPersistentSubscriptionInfoToAll(context.Background(), groupName, kurrentdb.GetPersistentSubscriptionOptions{}) require.NoError(t, err) @@ -812,16 +812,16 @@ func persistentGetInfoToAll(client *esdb.Client) TestCall { } } -func persistentGetInfoEncoding(client *esdb.Client) TestCall { +func persistentGetInfoEncoding(client *kurrentdb.Client) TestCall { return func(t *testing.T) { streamName := fmt.Sprintf("/%s/foo", NAME_GENERATOR.Generate()) groupName := fmt.Sprintf("/%s/foo", NAME_GENERATOR.Generate()) - err := client.CreatePersistentSubscription(context.Background(), streamName, groupName, esdb.PersistentStreamSubscriptionOptions{}) + err := client.CreatePersistentSubscription(context.Background(), streamName, groupName, kurrentdb.PersistentStreamSubscriptionOptions{}) require.NoError(t, err) - sub, err := client.GetPersistentSubscriptionInfo(context.Background(), streamName, groupName, esdb.GetPersistentSubscriptionOptions{}) + sub, err := client.GetPersistentSubscriptionInfo(context.Background(), streamName, groupName, kurrentdb.GetPersistentSubscriptionOptions{}) require.NoError(t, err) @@ -830,9 +830,9 @@ func persistentGetInfoEncoding(client *esdb.Client) TestCall { } } -func persistentRestartSubsystem(client *esdb.Client) TestCall { +func persistentRestartSubsystem(client *kurrentdb.Client) TestCall { return func(t *testing.T) { - err := client.RestartPersistentSubscriptionSubsystem(context.Background(), esdb.RestartPersistentSubscriptionSubsystemOptions{}) + err := client.RestartPersistentSubscriptionSubsystem(context.Background(), kurrentdb.RestartPersistentSubscriptionSubsystemOptions{}) require.NoError(t, err) } } diff --git a/esdb/position.go b/kurrentdb/position.go similarity index 98% rename from esdb/position.go rename to kurrentdb/position.go index 254785d2..ed200f6c 100644 --- a/esdb/position.go +++ b/kurrentdb/position.go @@ -1,4 +1,4 @@ -package esdb +package kurrentdb // StreamRevision returns a stream position at a specific event revision. type StreamRevision struct { diff --git a/kurrentdb/position_parsing_test.go b/kurrentdb/position_parsing_test.go new file mode 100644 index 00000000..9db132a0 --- /dev/null +++ b/kurrentdb/position_parsing_test.go @@ -0,0 +1,46 @@ +package kurrentdb_test + +import ( + "github.com/EventStore/EventStore-Client-Go/v1/kurrentdb" + "github.com/stretchr/testify/assert" + "testing" +) + +func TestPositionParsing(t *testing.T) { + t.Run("StreamPositionTests", func(t *testing.T) { + pos, err := kurrentdb.ParseStreamPosition("C:123/P:456") + assert.NoError(t, err) + assert.NotNil(t, pos) + + obj, err := kurrentdb.ParseStreamPosition("C:-1/P:-1") + assert.NoError(t, err) + + _, ok := obj.(kurrentdb.End) + assert.True(t, ok) + + obj, err = kurrentdb.ParseStreamPosition("C:0/P:0") + assert.NoError(t, err) + + _, ok = obj.(kurrentdb.Start) + assert.True(t, ok) + + obj, err = kurrentdb.ParseStreamPosition("-1") + assert.NoError(t, err) + + _, ok = obj.(kurrentdb.End) + assert.True(t, ok) + + obj, err = kurrentdb.ParseStreamPosition("0") + assert.NoError(t, err) + + _, ok = obj.(kurrentdb.Start) + assert.True(t, ok) + + obj, err = kurrentdb.ParseStreamPosition("42") + assert.NoError(t, err) + + value, ok := obj.(kurrentdb.StreamRevision) + assert.True(t, ok) + assert.Equal(t, uint64(42), value.Value) + }) +} diff --git a/esdb/projection_client.go b/kurrentdb/projection_client.go similarity index 98% rename from esdb/projection_client.go rename to kurrentdb/projection_client.go index 506097c8..369bdd4b 100644 --- a/esdb/projection_client.go +++ b/kurrentdb/projection_client.go @@ -1,12 +1,12 @@ -package esdb +package kurrentdb import ( "context" "errors" "io" - "github.com/EventStore/EventStore-Client-Go/v4/protos/projections" - "github.com/EventStore/EventStore-Client-Go/v4/protos/shared" + "github.com/EventStore/EventStore-Client-Go/v1/protos/projections" + "github.com/EventStore/EventStore-Client-Go/v1/protos/shared" "google.golang.org/grpc" "google.golang.org/grpc/metadata" "google.golang.org/protobuf/types/known/structpb" diff --git a/esdb/projection_options.go b/kurrentdb/projection_options.go similarity index 99% rename from esdb/projection_options.go rename to kurrentdb/projection_options.go index a07219dc..2bee0c7b 100644 --- a/esdb/projection_options.go +++ b/kurrentdb/projection_options.go @@ -1,4 +1,4 @@ -package esdb +package kurrentdb import "time" diff --git a/esdb/projection_test.go b/kurrentdb/projection_test.go similarity index 72% rename from esdb/projection_test.go rename to kurrentdb/projection_test.go index bb610852..75cdfc61 100644 --- a/esdb/projection_test.go +++ b/kurrentdb/projection_test.go @@ -1,4 +1,4 @@ -package esdb_test +package kurrentdb_test import ( "context" @@ -8,13 +8,13 @@ import ( "testing" "time" - "github.com/EventStore/EventStore-Client-Go/v4/esdb" + "github.com/EventStore/EventStore-Client-Go/v1/kurrentdb" "github.com/stretchr/testify/require" ) -func ProjectionTests(t *testing.T, emptyDBClient *esdb.Client) { +func ProjectionTests(t *testing.T, emptyDBClient *kurrentdb.Client) { t.Run("ProjectionTests", func(t *testing.T) { - projClient := esdb.NewProjectionClientFromExistingClient(emptyDBClient) + projClient := kurrentdb.NewProjectionClientFromExistingClient(emptyDBClient) t.Run("createProjection", createProjection(projClient)) t.Run("deleteProjection", deleteProjection(projClient)) @@ -27,31 +27,31 @@ func ProjectionTests(t *testing.T, emptyDBClient *esdb.Client) { }) } -func createProjection(client *esdb.ProjectionClient) TestCall { +func createProjection(client *kurrentdb.ProjectionClient) TestCall { return func(t *testing.T) { script, err := os.ReadFile("../resources/test/projection.js") require.NoError(t, err) name := NAME_GENERATOR.Generate() - err = client.Create(context.Background(), name, string(script), esdb.CreateProjectionOptions{}) + err = client.Create(context.Background(), name, string(script), kurrentdb.CreateProjectionOptions{}) require.NoError(t, err) waitUntilProjectionStatusIs(t, 5*time.Minute, client, name, "Running") } } -func deleteProjection(client *esdb.ProjectionClient) TestCall { +func deleteProjection(client *kurrentdb.ProjectionClient) TestCall { return func(t *testing.T) { script, err := os.ReadFile("../resources/test/projection.js") require.NoError(t, err) name := NAME_GENERATOR.Generate() - err = client.Create(context.Background(), name, string(script), esdb.CreateProjectionOptions{}) + err = client.Create(context.Background(), name, string(script), kurrentdb.CreateProjectionOptions{}) require.NoError(t, err) waitUntilProjectionStatusIs(t, 5*time.Minute, client, name, "Running") - err = client.Disable(context.Background(), name, esdb.GenericProjectionOptions{}) + err = client.Disable(context.Background(), name, kurrentdb.GenericProjectionOptions{}) require.NoError(t, err) waitUntilProjectionStatusIs(t, 5*time.Minute, client, name, "Stopped") @@ -62,10 +62,10 @@ func deleteProjection(client *esdb.ProjectionClient) TestCall { done := make(chan bool) go func() { for { - err = client.Delete(context.Background(), name, esdb.DeleteProjectionOptions{}) + err = client.Delete(context.Background(), name, kurrentdb.DeleteProjectionOptions{}) - if esdbErr, ok := esdb.FromError(err); !ok { - if !esdbErr.IsErrorCode(esdb.ErrorCodeUnknown) { + if esdbErr, ok := kurrentdb.FromError(err); !ok { + if !esdbErr.IsErrorCode(kurrentdb.ErrorCodeUnknown) { t.Errorf("error when deleting projection '%s': %v", name, esdbErr) } @@ -88,22 +88,22 @@ func deleteProjection(client *esdb.ProjectionClient) TestCall { } } -func updateProjection(client *esdb.ProjectionClient) TestCall { +func updateProjection(client *kurrentdb.ProjectionClient) TestCall { return func(t *testing.T) { script, err := os.ReadFile("../resources/test/projection.js") require.NoError(t, err) name := NAME_GENERATOR.Generate() - err = client.Create(context.Background(), name, string(script), esdb.CreateProjectionOptions{}) + err = client.Create(context.Background(), name, string(script), kurrentdb.CreateProjectionOptions{}) // It seems we experience some flakiness on previous-lts version when running in secure mode. // It's most likely https://github.com/EventStore/EventStore/issues/2938 acting up again. // Date 2024-02-21 for i := 0; i < 100; i++ { - if esdbErr, ok := esdb.FromError(err); !ok { - if esdbErr.IsErrorCode(esdb.ErrorCodeUnknown) { + if esdbErr, ok := kurrentdb.FromError(err); !ok { + if esdbErr.IsErrorCode(kurrentdb.ErrorCodeUnknown) { time.Sleep(1 * time.Second) - err = client.Create(context.Background(), name, string(script), esdb.CreateProjectionOptions{}) + err = client.Create(context.Background(), name, string(script), kurrentdb.CreateProjectionOptions{}) continue } } @@ -117,10 +117,10 @@ func updateProjection(client *esdb.ProjectionClient) TestCall { scriptUpdated, err := os.ReadFile("../resources/test/projection-updated.js") - err = client.Update(context.Background(), name, string(scriptUpdated), esdb.UpdateProjectionOptions{}) + err = client.Update(context.Background(), name, string(scriptUpdated), kurrentdb.UpdateProjectionOptions{}) require.NoError(t, err) - status, err := client.GetStatus(context.Background(), name, esdb.GenericProjectionOptions{}) + status, err := client.GetStatus(context.Background(), name, kurrentdb.GenericProjectionOptions{}) require.NoError(t, err) require.Equal(t, status.Name, name) @@ -129,69 +129,69 @@ func updateProjection(client *esdb.ProjectionClient) TestCall { } } -func enableProjection(client *esdb.ProjectionClient) TestCall { +func enableProjection(client *kurrentdb.ProjectionClient) TestCall { return func(t *testing.T) { script, err := os.ReadFile("../resources/test/projection.js") require.NoError(t, err) name := NAME_GENERATOR.Generate() - err = client.Create(context.Background(), name, string(script), esdb.CreateProjectionOptions{}) + err = client.Create(context.Background(), name, string(script), kurrentdb.CreateProjectionOptions{}) require.NoError(t, err) waitUntilProjectionStatusIs(t, 5*time.Minute, client, name, "Running") - err = client.Enable(context.Background(), name, esdb.GenericProjectionOptions{}) + err = client.Enable(context.Background(), name, kurrentdb.GenericProjectionOptions{}) require.NoError(t, err) waitUntilProjectionStatusIs(t, 5*time.Minute, client, name, "Running") } } -func disableProjection(client *esdb.ProjectionClient) TestCall { +func disableProjection(client *kurrentdb.ProjectionClient) TestCall { return func(t *testing.T) { script, err := os.ReadFile("../resources/test/projection.js") require.NoError(t, err) name := NAME_GENERATOR.Generate() - err = client.Create(context.Background(), name, string(script), esdb.CreateProjectionOptions{}) + err = client.Create(context.Background(), name, string(script), kurrentdb.CreateProjectionOptions{}) require.NoError(t, err) waitUntilProjectionStatusIs(t, 5*time.Minute, client, name, "Running") - err = client.Enable(context.Background(), name, esdb.GenericProjectionOptions{}) + err = client.Enable(context.Background(), name, kurrentdb.GenericProjectionOptions{}) require.NoError(t, err) waitUntilProjectionStatusIs(t, 5*time.Minute, client, name, "Running") - err = client.Abort(context.Background(), name, esdb.GenericProjectionOptions{}) + err = client.Abort(context.Background(), name, kurrentdb.GenericProjectionOptions{}) require.NoError(t, err) waitUntilProjectionStatusIs(t, 5*time.Minute, client, name, "Stopped") } } -func resetProjection(client *esdb.ProjectionClient) TestCall { +func resetProjection(client *kurrentdb.ProjectionClient) TestCall { return func(t *testing.T) { script, err := os.ReadFile("../resources/test/projection.js") require.NoError(t, err) name := NAME_GENERATOR.Generate() - err = client.Create(context.Background(), name, string(script), esdb.CreateProjectionOptions{}) + err = client.Create(context.Background(), name, string(script), kurrentdb.CreateProjectionOptions{}) require.NoError(t, err) waitUntilProjectionStatusIs(t, 5*time.Minute, client, name, "Running") - err = client.Enable(context.Background(), name, esdb.GenericProjectionOptions{}) + err = client.Enable(context.Background(), name, kurrentdb.GenericProjectionOptions{}) require.NoError(t, err) - err = client.Reset(context.Background(), name, esdb.ResetProjectionOptions{}) + err = client.Reset(context.Background(), name, kurrentdb.ResetProjectionOptions{}) require.NoError(t, err) } } -func getStateProjection(client *esdb.ProjectionClient) TestCall { +func getStateProjection(client *kurrentdb.ProjectionClient) TestCall { return func(t *testing.T) { - var events []esdb.EventData + var events []kurrentdb.EventData for i := 0; i < 10; i++ { events = append(events, createTestEvent()) @@ -200,23 +200,23 @@ func getStateProjection(client *esdb.ProjectionClient) TestCall { streamName := NAME_GENERATOR.Generate() script, err := os.ReadFile("../resources/test/projection.js") projName := NAME_GENERATOR.Generate() - _, err = client.Client().AppendToStream(context.Background(), streamName, esdb.AppendToStreamOptions{}, events...) + _, err = client.Client().AppendToStream(context.Background(), streamName, kurrentdb.AppendToStreamOptions{}, events...) require.NoError(t, err) - err = client.Create(context.Background(), projName, string(script), esdb.CreateProjectionOptions{}) + err = client.Create(context.Background(), projName, string(script), kurrentdb.CreateProjectionOptions{}) require.NoError(t, err) waitUntilProjectionStatusIs(t, 5*time.Minute, client, projName, "Running") - err = client.Enable(context.Background(), projName, esdb.GenericProjectionOptions{}) + err = client.Enable(context.Background(), projName, kurrentdb.GenericProjectionOptions{}) require.NoError(t, err) waitUntilStateReady(t, 5*time.Minute, client, projName) } } -func getResultProjection(client *esdb.ProjectionClient) TestCall { +func getResultProjection(client *kurrentdb.ProjectionClient) TestCall { return func(t *testing.T) { - var events []esdb.EventData + var events []kurrentdb.EventData for i := 0; i < 10; i++ { events = append(events, createTestEvent()) @@ -225,26 +225,26 @@ func getResultProjection(client *esdb.ProjectionClient) TestCall { streamName := NAME_GENERATOR.Generate() script, err := os.ReadFile("../resources/test/projection.js") projName := NAME_GENERATOR.Generate() - _, err = client.Client().AppendToStream(context.Background(), streamName, esdb.AppendToStreamOptions{}, events...) + _, err = client.Client().AppendToStream(context.Background(), streamName, kurrentdb.AppendToStreamOptions{}, events...) require.NoError(t, err) - err = client.Create(context.Background(), projName, string(script), esdb.CreateProjectionOptions{}) + err = client.Create(context.Background(), projName, string(script), kurrentdb.CreateProjectionOptions{}) require.NoError(t, err) waitUntilProjectionStatusIs(t, 5*time.Minute, client, projName, "Running") - err = client.Enable(context.Background(), projName, esdb.GenericProjectionOptions{}) + err = client.Enable(context.Background(), projName, kurrentdb.GenericProjectionOptions{}) require.NoError(t, err) waitUntilResultReady(t, 5*time.Minute, client, projName) } } -func waitUntilProjectionStatusIs(t *testing.T, duration time.Duration, client *esdb.ProjectionClient, name string, status string) { +func waitUntilProjectionStatusIs(t *testing.T, duration time.Duration, client *kurrentdb.ProjectionClient, name string, status string) { done := make(chan bool) go func() { for { - stats, err := client.GetStatus(context.Background(), name, esdb.GenericProjectionOptions{}) + stats, err := client.GetStatus(context.Background(), name, kurrentdb.GenericProjectionOptions{}) if err != nil { t.Errorf("error when reading projection '%s' stats: %v", name, err) } @@ -268,11 +268,11 @@ func waitUntilProjectionStatusIs(t *testing.T, duration time.Duration, client *e } } -func waitUntilStateReady(t *testing.T, duration time.Duration, client *esdb.ProjectionClient, name string) { +func waitUntilStateReady(t *testing.T, duration time.Duration, client *kurrentdb.ProjectionClient, name string) { done := make(chan *state) go func() { for { - result, err := client.GetState(context.Background(), name, esdb.GetStateProjectionOptions{}) + result, err := client.GetState(context.Background(), name, kurrentdb.GetStateProjectionOptions{}) if err != nil { time.Sleep(100 * time.Millisecond) @@ -304,11 +304,11 @@ func waitUntilStateReady(t *testing.T, duration time.Duration, client *esdb.Proj } } -func waitUntilResultReady(t *testing.T, duration time.Duration, client *esdb.ProjectionClient, name string) { +func waitUntilResultReady(t *testing.T, duration time.Duration, client *kurrentdb.ProjectionClient, name string) { done := make(chan *state) go func() { for { - result, err := client.GetResult(context.Background(), name, esdb.GetResultProjectionOptions{}) + result, err := client.GetResult(context.Background(), name, kurrentdb.GetResultProjectionOptions{}) if err != nil { time.Sleep(100 * time.Millisecond) diff --git a/esdb/protobuf_utils.go b/kurrentdb/protobuf_utils.go similarity index 99% rename from esdb/protobuf_utils.go rename to kurrentdb/protobuf_utils.go index 05986612..0648152a 100644 --- a/esdb/protobuf_utils.go +++ b/kurrentdb/protobuf_utils.go @@ -1,4 +1,4 @@ -package esdb +package kurrentdb import ( "encoding/binary" @@ -8,9 +8,9 @@ import ( "strconv" "time" - "github.com/EventStore/EventStore-Client-Go/v4/protos/persistent" - "github.com/EventStore/EventStore-Client-Go/v4/protos/shared" - api "github.com/EventStore/EventStore-Client-Go/v4/protos/streams" + "github.com/EventStore/EventStore-Client-Go/v1/protos/persistent" + "github.com/EventStore/EventStore-Client-Go/v1/protos/shared" + api "github.com/EventStore/EventStore-Client-Go/v1/protos/streams" ) type SubscriptionFilterOptions struct { diff --git a/esdb/read_all_test.go b/kurrentdb/read_all_test.go similarity index 87% rename from esdb/read_all_test.go rename to kurrentdb/read_all_test.go index bdbc4748..eda043b6 100644 --- a/esdb/read_all_test.go +++ b/kurrentdb/read_all_test.go @@ -1,18 +1,18 @@ -package esdb_test +package kurrentdb_test import ( "context" "encoding/json" + "github.com/EventStore/EventStore-Client-Go/v1/kurrentdb" "os" "testing" "time" - "github.com/EventStore/EventStore-Client-Go/v4/esdb" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) -func ReadAllTests(t *testing.T, populatedDBClient *esdb.Client) { +func ReadAllTests(t *testing.T, populatedDBClient *kurrentdb.Client) { t.Run("ReadAllTests", func(t *testing.T) { t.Run("readAllEventsForwardsFromZeroPosition(", readAllEventsForwardsFromZeroPosition(populatedDBClient)) t.Run("readAllEventsForwardsFromNonZeroPosition", readAllEventsForwardsFromNonZeroPosition(populatedDBClient)) @@ -22,7 +22,7 @@ func ReadAllTests(t *testing.T, populatedDBClient *esdb.Client) { }) } -func readAllEventsForwardsFromZeroPosition(db *esdb.Client) TestCall { +func readAllEventsForwardsFromZeroPosition(db *kurrentdb.Client) TestCall { return func(t *testing.T) { eventsContent, err := os.ReadFile("../resources/test/all-e0-e10.json") require.NoError(t, err) @@ -37,9 +37,9 @@ func readAllEventsForwardsFromZeroPosition(db *esdb.Client) TestCall { numberOfEventsToRead := 10 numberOfEvents := uint64(numberOfEventsToRead) - opts := esdb.ReadAllOptions{ - Direction: esdb.Forwards, - From: esdb.Start{}, + opts := kurrentdb.ReadAllOptions{ + Direction: kurrentdb.Forwards, + From: kurrentdb.Start{}, ResolveLinkTos: true, } stream, err := db.ReadAll(context, opts, numberOfEvents) @@ -68,7 +68,7 @@ func readAllEventsForwardsFromZeroPosition(db *esdb.Client) TestCall { } } -func readAllEventsForwardsFromNonZeroPosition(db *esdb.Client) TestCall { +func readAllEventsForwardsFromNonZeroPosition(db *kurrentdb.Client) TestCall { return func(t *testing.T) { eventsContent, err := os.ReadFile("../resources/test/all-c1788-p1788.json") require.NoError(t, err) @@ -83,8 +83,8 @@ func readAllEventsForwardsFromNonZeroPosition(db *esdb.Client) TestCall { numberOfEventsToRead := 10 numberOfEvents := uint64(numberOfEventsToRead) - opts := esdb.ReadAllOptions{ - From: esdb.Position{Commit: 1_788, Prepare: 1_788}, + opts := kurrentdb.ReadAllOptions{ + From: kurrentdb.Position{Commit: 1_788, Prepare: 1_788}, ResolveLinkTos: true, } @@ -114,7 +114,7 @@ func readAllEventsForwardsFromNonZeroPosition(db *esdb.Client) TestCall { } } -func readAllEventsBackwardsFromZeroPosition(db *esdb.Client) TestCall { +func readAllEventsBackwardsFromZeroPosition(db *kurrentdb.Client) TestCall { return func(t *testing.T) { eventsContent, err := os.ReadFile("../resources/test/all-back-e0-e10.json") require.NoError(t, err) @@ -129,9 +129,9 @@ func readAllEventsBackwardsFromZeroPosition(db *esdb.Client) TestCall { numberOfEventsToRead := 10 numberOfEvents := uint64(numberOfEventsToRead) - opts := esdb.ReadAllOptions{ - From: esdb.End{}, - Direction: esdb.Backwards, + opts := kurrentdb.ReadAllOptions{ + From: kurrentdb.End{}, + Direction: kurrentdb.Backwards, ResolveLinkTos: true, } @@ -174,7 +174,7 @@ func readAllEventsBackwardsFromZeroPosition(db *esdb.Client) TestCall { } } -func readAllEventsBackwardsFromNonZeroPosition(db *esdb.Client) TestCall { +func readAllEventsBackwardsFromNonZeroPosition(db *kurrentdb.Client) TestCall { return func(t *testing.T) { eventsContent, err := os.ReadFile("../resources/test/all-back-c3386-p3386.json") require.NoError(t, err) @@ -189,9 +189,9 @@ func readAllEventsBackwardsFromNonZeroPosition(db *esdb.Client) TestCall { numberOfEventsToRead := 10 numberOfEvents := uint64(numberOfEventsToRead) - opts := esdb.ReadAllOptions{ - From: esdb.Position{Commit: 3_386, Prepare: 3_386}, - Direction: esdb.Backwards, + opts := kurrentdb.ReadAllOptions{ + From: kurrentdb.Position{Commit: 3_386, Prepare: 3_386}, + Direction: kurrentdb.Backwards, ResolveLinkTos: true, } @@ -223,7 +223,7 @@ func readAllEventsBackwardsFromNonZeroPosition(db *esdb.Client) TestCall { } } -func readAllEventsWithCredentialOverride(db *esdb.Client) TestCall { +func readAllEventsWithCredentialOverride(db *kurrentdb.Client) TestCall { return func(t *testing.T) { eventsContent, err := os.ReadFile("../resources/test/all-back-c3386-p3386.json") require.NoError(t, err) @@ -238,13 +238,13 @@ func readAllEventsWithCredentialOverride(db *esdb.Client) TestCall { numberOfEventsToRead := 10 numberOfEvents := uint64(numberOfEventsToRead) - opts := esdb.ReadAllOptions{ - Authenticated: &esdb.Credentials{ + opts := kurrentdb.ReadAllOptions{ + Authenticated: &kurrentdb.Credentials{ Login: "admin", Password: "changeit", }, - From: esdb.Position{Commit: 3_386, Prepare: 3_386}, - Direction: esdb.Forwards, + From: kurrentdb.Position{Commit: 3_386, Prepare: 3_386}, + Direction: kurrentdb.Forwards, ResolveLinkTos: false, } diff --git a/esdb/read_options.go b/kurrentdb/read_options.go similarity index 99% rename from esdb/read_options.go rename to kurrentdb/read_options.go index edf7d0c7..fbdf2e93 100644 --- a/esdb/read_options.go +++ b/kurrentdb/read_options.go @@ -1,4 +1,4 @@ -package esdb +package kurrentdb import ( "time" diff --git a/esdb/read_stream_test.go b/kurrentdb/read_stream_test.go similarity index 84% rename from esdb/read_stream_test.go rename to kurrentdb/read_stream_test.go index f7a085ba..98ae2503 100644 --- a/esdb/read_stream_test.go +++ b/kurrentdb/read_stream_test.go @@ -1,17 +1,17 @@ -package esdb_test +package kurrentdb_test import ( "context" "encoding/json" "errors" + "github.com/EventStore/EventStore-Client-Go/v1/kurrentdb" "github.com/google/uuid" "io" - "os" "math" + "os" "testing" "time" - "github.com/EventStore/EventStore-Client-Go/v4/esdb" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) @@ -41,7 +41,7 @@ type Event struct { Created Created `json:"created"` } -func ReadStreamTests(t *testing.T, emptyDBClient *esdb.Client, populatedDBClient *esdb.Client) { +func ReadStreamTests(t *testing.T, emptyDBClient *kurrentdb.Client, populatedDBClient *kurrentdb.Client) { t.Run("ReadStreamTests", func(t *testing.T) { t.Run("readStreamEventsForwardsFromZeroPosition", readStreamEventsForwardsFromZeroPosition(populatedDBClient)) t.Run("readStreamEventsBackwardsFromEndPosition", readStreamEventsBackwardsFromEndPosition(populatedDBClient)) @@ -52,7 +52,7 @@ func ReadStreamTests(t *testing.T, emptyDBClient *esdb.Client, populatedDBClient }) } -func readStreamEventsForwardsFromZeroPosition(db *esdb.Client) TestCall { +func readStreamEventsForwardsFromZeroPosition(db *kurrentdb.Client) TestCall { return func(t *testing.T) { if db == nil { t.Skip() @@ -73,8 +73,8 @@ func readStreamEventsForwardsFromZeroPosition(db *esdb.Client) TestCall { streamId := "dataset20M-1800" - opts := esdb.ReadStreamOptions{ - Direction: esdb.Forwards, + opts := kurrentdb.ReadStreamOptions{ + Direction: kurrentdb.Forwards, ResolveLinkTos: true, } @@ -121,7 +121,7 @@ func readStreamEventsForwardsFromZeroPosition(db *esdb.Client) TestCall { } } -func readStreamEventsBackwardsFromEndPosition(db *esdb.Client) TestCall { +func readStreamEventsBackwardsFromEndPosition(db *kurrentdb.Client) TestCall { return func(t *testing.T) { if db == nil { t.Skip() @@ -142,9 +142,9 @@ func readStreamEventsBackwardsFromEndPosition(db *esdb.Client) TestCall { numberOfEvents := uint64(numberOfEventsToRead) streamId := "dataset20M-1800" - opts := esdb.ReadStreamOptions{ - Direction: esdb.Backwards, - From: esdb.End{}, + opts := kurrentdb.ReadStreamOptions{ + Direction: kurrentdb.Backwards, + From: kurrentdb.End{}, ResolveLinkTos: true, } @@ -190,16 +190,16 @@ func readStreamEventsBackwardsFromEndPosition(db *esdb.Client) TestCall { } } -func readStreamReturnsEOFAfterCompletion(db *esdb.Client) TestCall { +func readStreamReturnsEOFAfterCompletion(db *kurrentdb.Client) TestCall { return func(t *testing.T) { - proposedEvents := []esdb.EventData{} + proposedEvents := []kurrentdb.EventData{} for i := 1; i <= 10; i++ { proposedEvents = append(proposedEvents, createTestEvent()) } - opts := esdb.AppendToStreamOptions{ - ExpectedRevision: esdb.NoStream{}, + opts := kurrentdb.AppendToStreamOptions{ + ExpectedRevision: kurrentdb.NoStream{}, } streamID := NAME_GENERATOR.Generate() @@ -207,7 +207,7 @@ func readStreamReturnsEOFAfterCompletion(db *esdb.Client) TestCall { _, err := db.AppendToStream(context.Background(), streamID, opts, proposedEvents...) require.NoError(t, err) - stream, err := db.ReadStream(context.Background(), streamID, esdb.ReadStreamOptions{}, 1_024) + stream, err := db.ReadStream(context.Background(), streamID, kurrentdb.ReadStreamOptions{}, 1_024) require.NoError(t, err) defer stream.Close() @@ -220,9 +220,9 @@ func readStreamReturnsEOFAfterCompletion(db *esdb.Client) TestCall { } } -func readStreamNotFound(db *esdb.Client) TestCall { +func readStreamNotFound(db *kurrentdb.Client) TestCall { return func(t *testing.T) { - stream, err := db.ReadStream(context.Background(), NAME_GENERATOR.Generate(), esdb.ReadStreamOptions{}, 1) + stream, err := db.ReadStream(context.Background(), NAME_GENERATOR.Generate(), kurrentdb.ReadStreamOptions{}, 1) require.NoError(t, err) defer stream.Close() @@ -230,30 +230,30 @@ func readStreamNotFound(db *esdb.Client) TestCall { evt, err := stream.Recv() require.Nil(t, evt) - esdbErr, ok := esdb.FromError(err) + esdbErr, ok := kurrentdb.FromError(err) require.False(t, ok) - require.Equal(t, esdbErr.Code(), esdb.ErrorCodeResourceNotFound) + require.Equal(t, esdbErr.Code(), kurrentdb.ErrorCodeResourceNotFound) } } -func readStreamWithMaxAge(db *esdb.Client) TestCall { +func readStreamWithMaxAge(db *kurrentdb.Client) TestCall { return func(t *testing.T) { streamName := NAME_GENERATOR.Generate() - _, err := db.AppendToStream(context.Background(), streamName, esdb.AppendToStreamOptions{}, createTestEvent()) + _, err := db.AppendToStream(context.Background(), streamName, kurrentdb.AppendToStreamOptions{}, createTestEvent()) assert.NoError(t, err) - metadata := esdb.StreamMetadata{} + metadata := kurrentdb.StreamMetadata{} metadata.SetMaxAge(time.Second) - _, err = db.SetStreamMetadata(context.Background(), streamName, esdb.AppendToStreamOptions{}, metadata) + _, err = db.SetStreamMetadata(context.Background(), streamName, kurrentdb.AppendToStreamOptions{}, metadata) assert.NoError(t, err) time.Sleep(2 * time.Second) - stream, err := db.ReadStream(context.Background(), streamName, esdb.ReadStreamOptions{}, 10) + stream, err := db.ReadStream(context.Background(), streamName, kurrentdb.ReadStreamOptions{}, 10) require.NoError(t, err) defer stream.Close() @@ -264,7 +264,7 @@ func readStreamWithMaxAge(db *esdb.Client) TestCall { } } -func readStreamWithCredentialsOverride(db *esdb.Client) TestCall { +func readStreamWithCredentialsOverride(db *kurrentdb.Client) TestCall { return func(t *testing.T) { isInsecure := GetEnvOrDefault("EVENTSTORE_INSECURE", "true") == "true" @@ -273,8 +273,8 @@ func readStreamWithCredentialsOverride(db *esdb.Client) TestCall { } streamName := NAME_GENERATOR.Generate() - opts := esdb.AppendToStreamOptions{ - Authenticated: &esdb.Credentials{ + opts := kurrentdb.AppendToStreamOptions{ + Authenticated: &kurrentdb.Credentials{ Login: "admin", Password: "changeit", }, diff --git a/esdb/reads.go b/kurrentdb/reads.go similarity index 95% rename from esdb/reads.go rename to kurrentdb/reads.go index da137c91..5400918b 100644 --- a/esdb/reads.go +++ b/kurrentdb/reads.go @@ -1,4 +1,4 @@ -package esdb +package kurrentdb import ( "context" @@ -8,7 +8,7 @@ import ( "sync" "sync/atomic" - api "github.com/EventStore/EventStore-Client-Go/v4/protos/streams" + api "github.com/EventStore/EventStore-Client-Go/v1/protos/streams" "google.golang.org/grpc/metadata" ) diff --git a/esdb/recorded_event.go b/kurrentdb/recorded_event.go similarity index 97% rename from esdb/recorded_event.go rename to kurrentdb/recorded_event.go index 05483a7f..86f87f53 100644 --- a/esdb/recorded_event.go +++ b/kurrentdb/recorded_event.go @@ -1,4 +1,4 @@ -package esdb +package kurrentdb import ( "github.com/google/uuid" diff --git a/esdb/resolved_event.go b/kurrentdb/resolved_event.go similarity index 97% rename from esdb/resolved_event.go rename to kurrentdb/resolved_event.go index 966c3c32..7378c418 100644 --- a/esdb/resolved_event.go +++ b/kurrentdb/resolved_event.go @@ -1,4 +1,4 @@ -package esdb +package kurrentdb // ResolvedEvent represents an event with a potential link. type ResolvedEvent struct { diff --git a/esdb/revision.go b/kurrentdb/revision.go similarity index 73% rename from esdb/revision.go rename to kurrentdb/revision.go index e7ea6309..af4d7699 100644 --- a/esdb/revision.go +++ b/kurrentdb/revision.go @@ -1,4 +1,4 @@ -package esdb +package kurrentdb // Any means the write should not conflict with anything and should always succeed. type Any struct{} @@ -10,8 +10,8 @@ type StreamExists struct{} type NoStream struct{} // ExpectedRevision the use of expected revision can be a bit tricky especially when discussing guaranties given by -// EventStoreDB server. The EventStoreDB server will assure idempotency for all requests using any value in -// ExpectedRevision except Any. When using Any, the EventStoreDB server will do its best to assure idempotency but +// KurrentDB server. The KurrentDB server will assure idempotency for all requests using any value in +// ExpectedRevision except Any. When using Any, the KurrentDB server will do its best to assure idempotency but // will not guarantee it. type ExpectedRevision interface { isExpectedRevision() diff --git a/esdb/subscribe_options.go b/kurrentdb/subscribe_options.go similarity index 99% rename from esdb/subscribe_options.go rename to kurrentdb/subscribe_options.go index d20b7a79..da018f11 100644 --- a/esdb/subscribe_options.go +++ b/kurrentdb/subscribe_options.go @@ -1,4 +1,4 @@ -package esdb +package kurrentdb import ( "time" diff --git a/esdb/subscription_event.go b/kurrentdb/subscription_event.go similarity index 81% rename from esdb/subscription_event.go rename to kurrentdb/subscription_event.go index 93c2e631..31698b2e 100644 --- a/esdb/subscription_event.go +++ b/kurrentdb/subscription_event.go @@ -1,8 +1,8 @@ -package esdb +package kurrentdb // SubscriptionEvent used to handle catch-up subscription notifications raised throughout its lifecycle. type SubscriptionEvent struct { - // When EventStoreDB sends an event to the subscription. + // When KurrentDB sends an event to the subscription. EventAppeared *ResolvedEvent // When the subscription is dropped. SubscriptionDropped *SubscriptionDropped @@ -16,7 +16,7 @@ type SubscriptionEvent struct { // PersistentSubscriptionEvent used to handle persistent subscription notifications raised throughout its lifecycle. type PersistentSubscriptionEvent struct { - // When EventStoreDB sends an event to the subscription. + // When KurrentDB sends an event to the subscription. EventAppeared *EventAppeared // When the subscription is dropped. SubscriptionDropped *SubscriptionDropped @@ -30,9 +30,9 @@ type SubscriptionDropped struct { Error error } -// EventAppeared when EventStoreDB sends an event to a persistent subscription. +// EventAppeared when KurrentDB sends an event to a persistent subscription. type EventAppeared struct { - // Event sent by EventStoreDB. + // Event sent by KurrentDB. Event *ResolvedEvent // How many times that event was sent to the persistent subscription. RetryCount int diff --git a/esdb/subscriptions.go b/kurrentdb/subscriptions.go similarity index 96% rename from esdb/subscriptions.go rename to kurrentdb/subscriptions.go index 0cc2a98b..ae3a3fdf 100644 --- a/esdb/subscriptions.go +++ b/kurrentdb/subscriptions.go @@ -1,4 +1,4 @@ -package esdb +package kurrentdb import ( "context" @@ -6,7 +6,7 @@ import ( "sync" "sync/atomic" - api "github.com/EventStore/EventStore-Client-Go/v4/protos/streams" + api "github.com/EventStore/EventStore-Client-Go/v1/protos/streams" ) // Subscription is a subscription's handle. diff --git a/esdb/subscriptions_test.go b/kurrentdb/subscriptions_test.go similarity index 82% rename from esdb/subscriptions_test.go rename to kurrentdb/subscriptions_test.go index b4c0d7a3..9a985545 100644 --- a/esdb/subscriptions_test.go +++ b/kurrentdb/subscriptions_test.go @@ -1,8 +1,9 @@ -package esdb_test +package kurrentdb_test import ( "context" "encoding/json" + "github.com/EventStore/EventStore-Client-Go/v1/kurrentdb" "github.com/google/uuid" "os" "strings" @@ -10,11 +11,10 @@ import ( "testing" "time" - "github.com/EventStore/EventStore-Client-Go/v4/esdb" "github.com/stretchr/testify/require" ) -func SubscriptionTests(t *testing.T, emptyDBClient *esdb.Client, populatedDBClient *esdb.Client) { +func SubscriptionTests(t *testing.T, emptyDBClient *kurrentdb.Client, populatedDBClient *kurrentdb.Client) { t.Run("SubscriptionTests", func(t *testing.T) { t.Run("streamSubscriptionDeliversAllEventsInStreamAndListensForNewEvents", streamSubscriptionDeliversAllEventsInStreamAndListensForNewEvents(populatedDBClient)) t.Run("allSubscriptionWithFilterDeliversCorrectEvents", allSubscriptionWithFilterDeliversCorrectEvents(populatedDBClient)) @@ -25,7 +25,7 @@ func SubscriptionTests(t *testing.T, emptyDBClient *esdb.Client, populatedDBClie }) } -func subscriptionToStreamCaughtUpMessage(db *esdb.Client) TestCall { +func subscriptionToStreamCaughtUpMessage(db *kurrentdb.Client) TestCall { const minSupportedVersion = 23 const expectedEventCount = 6_000 const testTimeout = 1 * time.Minute @@ -39,14 +39,14 @@ func subscriptionToStreamCaughtUpMessage(db *esdb.Client) TestCall { require.NoError(t, err, "Error getting server version") if esdbVersion.Major < minSupportedVersion { - t.Skip("CaughtUp message is not supported in this version of EventStoreDB") + t.Skip("CaughtUp message is not supported in this version of KurrentDB") } ctx, cancel := context.WithTimeout(context.Background(), testTimeout) defer cancel() streamID := "dataset20M-0" - subscription, err := db.SubscribeToStream(ctx, streamID, esdb.SubscribeToStreamOptions{From: esdb.Start{}}) + subscription, err := db.SubscribeToStream(ctx, streamID, kurrentdb.SubscribeToStreamOptions{From: kurrentdb.Start{}}) require.NoError(t, err) defer subscription.Close() @@ -89,7 +89,7 @@ func subscriptionToStreamCaughtUpMessage(db *esdb.Client) TestCall { } } -func streamSubscriptionDeliversAllEventsInStreamAndListensForNewEvents(db *esdb.Client) TestCall { +func streamSubscriptionDeliversAllEventsInStreamAndListensForNewEvents(db *kurrentdb.Client) TestCall { return func(t *testing.T) { if db == nil { t.Skip() @@ -102,8 +102,8 @@ func streamSubscriptionDeliversAllEventsInStreamAndListensForNewEvents(db *esdb. var receivedEvents sync.WaitGroup var appendedEvents sync.WaitGroup - subscription, err := db.SubscribeToStream(context.Background(), "dataset20M-0", esdb.SubscribeToStreamOptions{ - From: esdb.Start{}, + subscription, err := db.SubscribeToStream(context.Background(), "dataset20M-0", kurrentdb.SubscribeToStreamOptions{ + From: kurrentdb.Start{}, }) require.NoError(t, err) @@ -139,8 +139,8 @@ func streamSubscriptionDeliversAllEventsInStreamAndListensForNewEvents(db *esdb. require.False(t, timedOut, "Timed out waiting for initial set of events") // Write a new event - opts2 := esdb.AppendToStreamOptions{ - ExpectedRevision: esdb.Revision(5_999), + opts2 := kurrentdb.AppendToStreamOptions{ + ExpectedRevision: kurrentdb.Revision(5_999), } writeResult, err := db.AppendToStream(context.Background(), streamID, opts2, testEvent) require.NoError(t, err) @@ -157,7 +157,7 @@ type Position struct { Commit uint64 `json:"commit"` } -func allSubscriptionWithFilterDeliversCorrectEvents(db *esdb.Client) TestCall { +func allSubscriptionWithFilterDeliversCorrectEvents(db *kurrentdb.Client) TestCall { return func(t *testing.T) { if db == nil { t.Skip() @@ -177,10 +177,10 @@ func allSubscriptionWithFilterDeliversCorrectEvents(db *esdb.Client) TestCall { var receivedEvents sync.WaitGroup receivedEvents.Add(1) - subscription, err := db.SubscribeToAll(context.Background(), esdb.SubscribeToAllOptions{ - From: esdb.Start{}, - Filter: &esdb.SubscriptionFilter{ - Type: esdb.EventFilterType, + subscription, err := db.SubscribeToAll(context.Background(), kurrentdb.SubscribeToAllOptions{ + From: kurrentdb.Start{}, + Filter: &kurrentdb.SubscriptionFilter{ + Type: kurrentdb.EventFilterType, Prefixes: []string{"eventType-194"}, }, }) @@ -217,9 +217,9 @@ func allSubscriptionWithFilterDeliversCorrectEvents(db *esdb.Client) TestCall { } } -func subscriptionAllFilter(db *esdb.Client) TestCall { +func subscriptionAllFilter(db *kurrentdb.Client) TestCall { return func(t *testing.T) { - sub, err := db.SubscribeToAll(context.Background(), esdb.SubscribeToAllOptions{From: esdb.Start{}, Filter: esdb.ExcludeSystemEventsFilter()}) + sub, err := db.SubscribeToAll(context.Background(), kurrentdb.SubscribeToAllOptions{From: kurrentdb.Start{}, Filter: kurrentdb.ExcludeSystemEventsFilter()}) if err != nil { t.Error(err) @@ -248,7 +248,7 @@ func subscriptionAllFilter(db *esdb.Client) TestCall { } } -func connectionClosing(db *esdb.Client) TestCall { +func connectionClosing(db *kurrentdb.Client) TestCall { return func(t *testing.T) { if db == nil { t.Skip() @@ -256,8 +256,8 @@ func connectionClosing(db *esdb.Client) TestCall { var droppedEvent sync.WaitGroup - subscription, err := db.SubscribeToStream(context.Background(), "dataset20M-0", esdb.SubscribeToStreamOptions{ - From: esdb.Start{}, + subscription, err := db.SubscribeToStream(context.Background(), "dataset20M-0", kurrentdb.SubscribeToStreamOptions{ + From: kurrentdb.Start{}, }) go func() { @@ -291,19 +291,19 @@ func connectionClosing(db *esdb.Client) TestCall { } } -func subscriptionAllWithCredentialsOverride(db *esdb.Client) TestCall { +func subscriptionAllWithCredentialsOverride(db *kurrentdb.Client) TestCall { return func(t *testing.T) { if db == nil { t.Skip() } - opts := esdb.SubscribeToAllOptions{ - Authenticated: &esdb.Credentials{ + opts := kurrentdb.SubscribeToAllOptions{ + Authenticated: &kurrentdb.Credentials{ Login: "admin", Password: "changeit", }, - From: esdb.Start{}, - Filter: esdb.ExcludeSystemEventsFilter(), + From: kurrentdb.Start{}, + Filter: kurrentdb.ExcludeSystemEventsFilter(), } _, err := db.SubscribeToAll(context.Background(), opts) diff --git a/esdb/tls_test.go b/kurrentdb/tls_test.go similarity index 74% rename from esdb/tls_test.go rename to kurrentdb/tls_test.go index 0f5ba215..8be72721 100644 --- a/esdb/tls_test.go +++ b/kurrentdb/tls_test.go @@ -1,10 +1,11 @@ -package esdb_test +package kurrentdb_test import ( "context" "crypto/x509" "errors" "fmt" + "github.com/EventStore/EventStore-Client-Go/v1/kurrentdb" "io" "os" "path/filepath" @@ -12,8 +13,6 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - - "github.com/EventStore/EventStore-Client-Go/v4/esdb" ) func TLSTests(t *testing.T, emptyDBContainer *Container) { @@ -31,12 +30,12 @@ func TLSTests(t *testing.T, emptyDBContainer *Container) { func testTLSDefaults(container *Container) TestCall { return func(t *testing.T) { - config, err := esdb.ParseConnectionString(fmt.Sprintf("esdb://admin:changeit@%s", container.Endpoint)) + config, err := kurrentdb.ParseConnectionString(fmt.Sprintf("esdb://admin:changeit@%s", container.Endpoint)) if err != nil { t.Fatalf("Unexpected configuration error: %s", err.Error()) } - c, err := esdb.NewClient(config) + c, err := kurrentdb.NewClient(config) if err != nil { t.Fatalf("Unexpected error: %s", err.Error()) } @@ -44,9 +43,9 @@ func testTLSDefaults(container *Container) TestCall { numberOfEventsToRead := 1 numberOfEvents := uint64(numberOfEventsToRead) - opts := esdb.ReadAllOptions{ - From: esdb.Start{}, - Direction: esdb.Backwards, + opts := kurrentdb.ReadAllOptions{ + From: kurrentdb.Start{}, + Direction: kurrentdb.Backwards, ResolveLinkTos: true, } @@ -58,7 +57,7 @@ func testTLSDefaults(container *Container) TestCall { func testTLSDefaultsWithCertificate(container *Container) TestCall { return func(t *testing.T) { - config, err := esdb.ParseConnectionString(fmt.Sprintf("esdb://admin:changeit@%s", container.Endpoint)) + config, err := kurrentdb.ParseConnectionString(fmt.Sprintf("esdb://admin:changeit@%s", container.Endpoint)) if err != nil { t.Fatalf("Unexpected configuration error: %s", err.Error()) } @@ -73,7 +72,7 @@ func testTLSDefaultsWithCertificate(container *Container) TestCall { } config.RootCAs = cp - c, err := esdb.NewClient(config) + c, err := kurrentdb.NewClient(config) if err != nil { t.Fatalf("Unexpected error: %s", err.Error()) } @@ -82,9 +81,9 @@ func testTLSDefaultsWithCertificate(container *Container) TestCall { numberOfEventsToRead := 1 numberOfEvents := uint64(numberOfEventsToRead) - opts := esdb.ReadAllOptions{ - From: esdb.Start{}, - Direction: esdb.Backwards, + opts := kurrentdb.ReadAllOptions{ + From: kurrentdb.Start{}, + Direction: kurrentdb.Backwards, ResolveLinkTos: true, } stream, err := c.ReadAll(context.Background(), opts, numberOfEvents) @@ -98,12 +97,12 @@ func testTLSDefaultsWithCertificate(container *Container) TestCall { func testTLSWithoutCertificateAndVerify(container *Container) TestCall { return func(t *testing.T) { - config, err := esdb.ParseConnectionString(fmt.Sprintf("esdb://admin:changeit@%s?tls=true&tlsverifycert=false", container.Endpoint)) + config, err := kurrentdb.ParseConnectionString(fmt.Sprintf("esdb://admin:changeit@%s?tls=true&tlsverifycert=false", container.Endpoint)) if err != nil { t.Fatalf("Unexpected configuration error: %s", err.Error()) } - c, err := esdb.NewClient(config) + c, err := kurrentdb.NewClient(config) if err != nil { t.Fatalf("Unexpected error: %s", err.Error()) } @@ -112,9 +111,9 @@ func testTLSWithoutCertificateAndVerify(container *Container) TestCall { numberOfEventsToRead := 1 numberOfEvents := uint64(numberOfEventsToRead) - opts := esdb.ReadAllOptions{ - From: esdb.Start{}, - Direction: esdb.Backwards, + opts := kurrentdb.ReadAllOptions{ + From: kurrentdb.Start{}, + Direction: kurrentdb.Backwards, ResolveLinkTos: true, } stream, err := c.ReadAll(context.Background(), opts, numberOfEvents) @@ -129,12 +128,12 @@ func testTLSWithoutCertificateAndVerify(container *Container) TestCall { func testTLSWithoutCertificate(container *Container) TestCall { return func(t *testing.T) { - config, err := esdb.ParseConnectionString(fmt.Sprintf("esdb://admin:changeit@%s?tls=true&tlsverifycert=true", container.Endpoint)) + config, err := kurrentdb.ParseConnectionString(fmt.Sprintf("esdb://admin:changeit@%s?tls=true&tlsverifycert=true", container.Endpoint)) if err != nil { t.Fatalf("Unexpected configuration error: %s", err.Error()) } - c, err := esdb.NewClient(config) + c, err := kurrentdb.NewClient(config) if err != nil { t.Fatalf("Unexpected error: %s", err.Error()) } @@ -143,9 +142,9 @@ func testTLSWithoutCertificate(container *Container) TestCall { numberOfEventsToRead := 1 numberOfEvents := uint64(numberOfEventsToRead) - opts := esdb.ReadAllOptions{ - From: esdb.Start{}, - Direction: esdb.Backwards, + opts := kurrentdb.ReadAllOptions{ + From: kurrentdb.Start{}, + Direction: kurrentdb.Backwards, ResolveLinkTos: true, } _, err = c.ReadAll(context.Background(), opts, numberOfEvents) @@ -156,7 +155,7 @@ func testTLSWithoutCertificate(container *Container) TestCall { func testTLSWithCertificate(container *Container) TestCall { return func(t *testing.T) { - config, err := esdb.ParseConnectionString(fmt.Sprintf("esdb://admin:changeit@%s?tls=true&tlsverifycert=true", container.Endpoint)) + config, err := kurrentdb.ParseConnectionString(fmt.Sprintf("esdb://admin:changeit@%s?tls=true&tlsverifycert=true", container.Endpoint)) if err != nil { t.Fatalf("Unexpected configuration error: %s", err.Error()) } @@ -171,7 +170,7 @@ func testTLSWithCertificate(container *Container) TestCall { } config.RootCAs = cp - c, err := esdb.NewClient(config) + c, err := kurrentdb.NewClient(config) if err != nil { t.Fatalf("Unexpected error: %s", err.Error()) } @@ -180,9 +179,9 @@ func testTLSWithCertificate(container *Container) TestCall { numberOfEventsToRead := 1 numberOfEvents := uint64(numberOfEventsToRead) - opts := esdb.ReadAllOptions{ - From: esdb.Start{}, - Direction: esdb.Backwards, + opts := kurrentdb.ReadAllOptions{ + From: kurrentdb.Start{}, + Direction: kurrentdb.Backwards, ResolveLinkTos: true, } stream, err := c.ReadAll(context.Background(), opts, numberOfEvents) @@ -202,12 +201,12 @@ func testTLSWithCertificateFromAbsoluteFile(container *Container) TestCall { } s := fmt.Sprintf("esdb://admin:changeit@%s?tls=true&tlsverifycert=true&tlsCAFile=%s", container.Endpoint, absPath) - config, err := esdb.ParseConnectionString(s) + config, err := kurrentdb.ParseConnectionString(s) if err != nil { t.Fatalf("Unexpected configuration error: %s", err.Error()) } - c, err := esdb.NewClient(config) + c, err := kurrentdb.NewClient(config) if err != nil { t.Fatalf("Unexpected error: %s", err.Error()) } @@ -216,9 +215,9 @@ func testTLSWithCertificateFromAbsoluteFile(container *Container) TestCall { numberOfEventsToRead := 1 numberOfEvents := uint64(numberOfEventsToRead) - opts := esdb.ReadAllOptions{ - From: esdb.Start{}, - Direction: esdb.Backwards, + opts := kurrentdb.ReadAllOptions{ + From: kurrentdb.Start{}, + Direction: kurrentdb.Backwards, ResolveLinkTos: true, } stream, err := c.ReadAll(context.Background(), opts, numberOfEvents) @@ -233,12 +232,12 @@ func testTLSWithCertificateFromAbsoluteFile(container *Container) TestCall { func testTLSWithCertificateFromRelativeFile(container *Container) TestCall { return func(t *testing.T) { - config, err := esdb.ParseConnectionString(fmt.Sprintf("esdb://admin:changeit@%s?tls=true&tlsverifycert=true&tlsCAFile=../certs/node/node.crt", container.Endpoint)) + config, err := kurrentdb.ParseConnectionString(fmt.Sprintf("esdb://admin:changeit@%s?tls=true&tlsverifycert=true&tlsCAFile=../certs/node/node.crt", container.Endpoint)) if err != nil { t.Fatalf("Unexpected configuration error: %s", err.Error()) } - c, err := esdb.NewClient(config) + c, err := kurrentdb.NewClient(config) if err != nil { t.Fatalf("Unexpected error: %s", err.Error()) } @@ -248,9 +247,9 @@ func testTLSWithCertificateFromRelativeFile(container *Container) TestCall { WaitForAdminToBeAvailable(t, c) numberOfEventsToRead := 1 numberOfEvents := uint64(numberOfEventsToRead) - opts := esdb.ReadAllOptions{ - From: esdb.Start{}, - Direction: esdb.Backwards, + opts := kurrentdb.ReadAllOptions{ + From: kurrentdb.Start{}, + Direction: kurrentdb.Backwards, ResolveLinkTos: true, } stream, err := c.ReadAll(context.Background(), opts, numberOfEvents) @@ -264,7 +263,7 @@ func testTLSWithCertificateFromRelativeFile(container *Container) TestCall { func testTLSWithInvalidCertificate(container *Container) TestCall { return func(t *testing.T) { - config, err := esdb.ParseConnectionString(fmt.Sprintf("esdb://admin:changeit@%s?tls=true&tlsverifycert=true", container.Endpoint)) + config, err := kurrentdb.ParseConnectionString(fmt.Sprintf("esdb://admin:changeit@%s?tls=true&tlsverifycert=true", container.Endpoint)) if err != nil { t.Fatalf("Unexpected configuration error: %s", err.Error()) } @@ -279,7 +278,7 @@ func testTLSWithInvalidCertificate(container *Container) TestCall { } config.RootCAs = cp - c, err := esdb.NewClient(config) + c, err := kurrentdb.NewClient(config) if err != nil { t.Fatalf("Unexpected error: %s", err.Error()) } @@ -288,13 +287,13 @@ func testTLSWithInvalidCertificate(container *Container) TestCall { numberOfEventsToRead := 1 numberOfEvents := uint64(numberOfEventsToRead) - opts := esdb.ReadAllOptions{ - From: esdb.Start{}, - Direction: esdb.Backwards, + opts := kurrentdb.ReadAllOptions{ + From: kurrentdb.Start{}, + Direction: kurrentdb.Backwards, ResolveLinkTos: true, } _, err = c.ReadAll(context.Background(), opts, numberOfEvents) - esdbErr, ok := esdb.FromError(err) + esdbErr, ok := kurrentdb.FromError(err) require.False(t, ok) require.NotNil(t, esdbErr) assert.Contains(t, esdbErr.Error(), "certificate signed by unknown authority") diff --git a/esdb/tombstone_options.go b/kurrentdb/tombstone_options.go similarity index 98% rename from esdb/tombstone_options.go rename to kurrentdb/tombstone_options.go index 7a231f12..ef0a5f28 100644 --- a/esdb/tombstone_options.go +++ b/kurrentdb/tombstone_options.go @@ -1,4 +1,4 @@ -package esdb +package kurrentdb import "time" diff --git a/esdb/types.go b/kurrentdb/types.go similarity index 99% rename from esdb/types.go rename to kurrentdb/types.go index 321bd160..de79db52 100644 --- a/esdb/types.go +++ b/kurrentdb/types.go @@ -1,4 +1,4 @@ -package esdb +package kurrentdb import ( "encoding/json" @@ -22,7 +22,7 @@ const ( ConsumerStrategyDispatchToSingle ConsumerStrategy = "DispatchToSingle" // ConsumerStrategyPinned For use with an indexing projection such as the system '$by_category' projection. - // EventStoreDB inspects event for its source stream id, hashing the id to one of 1024 buckets assigned to + // KurrentDB inspects event for its source stream id, hashing the id to one of 1024 buckets assigned to // individual clients. When a client disconnects, its buckets are assigned to other clients. When a client connects, // it is assigned some existing buckets. This naively attempts to maintain a balanced workload. The main goal of // this strategy is to decrease the likelihood of concurrency and ordering issues while maintaining load balancing. @@ -540,7 +540,7 @@ func streamMetadataFromMap(props map[string]interface{}) (*StreamMetadata, error return &meta, nil } -// FilterType represents the type filters supported by EventStoreDB. +// FilterType represents the type filters supported by KurrentDB. type FilterType int const ( diff --git a/esdb/types_test.go b/kurrentdb/types_test.go similarity index 80% rename from esdb/types_test.go rename to kurrentdb/types_test.go index 5bc2e4da..7c5e9cd1 100644 --- a/esdb/types_test.go +++ b/kurrentdb/types_test.go @@ -1,22 +1,22 @@ -package esdb_test +package kurrentdb_test import ( + "github.com/EventStore/EventStore-Client-Go/v1/kurrentdb" "testing" "time" - "github.com/EventStore/EventStore-Client-Go/v4/esdb" "github.com/stretchr/testify/assert" ) func TestConsistentMetadataSerializationStreamAcl(t *testing.T) { - acl := esdb.Acl{} + acl := kurrentdb.Acl{} acl.AddReadRoles("admin") acl.AddWriteRoles("admin") acl.AddDeleteRoles("admin") acl.AddMetaReadRoles("admin") acl.AddMetaWriteRoles("admin") - expected := esdb.StreamMetadata{} + expected := kurrentdb.StreamMetadata{} expected.SetMaxAge(2 * time.Second) expected.SetCacheControl(15 * time.Second) expected.SetTruncateBefore(1) @@ -28,7 +28,7 @@ func TestConsistentMetadataSerializationStreamAcl(t *testing.T) { assert.NoError(t, err, "failed to serialize in JSON") - meta, err := esdb.StreamMetadataFromJson(bytes) + meta, err := kurrentdb.StreamMetadataFromJson(bytes) assert.NoError(t, err, "failed to parse Metadata from props") @@ -36,19 +36,19 @@ func TestConsistentMetadataSerializationStreamAcl(t *testing.T) { } func TestConsistentMetadataSerializationUserStreamAcl(t *testing.T) { - expected := esdb.StreamMetadata{} + expected := kurrentdb.StreamMetadata{} expected.SetMaxAge(2 * time.Second) expected.SetCacheControl(15 * time.Second) expected.SetTruncateBefore(1) expected.SetMaxCount(12) - expected.SetAcl(esdb.UserStreamAcl) + expected.SetAcl(kurrentdb.UserStreamAcl) expected.AddCustomProperty("foo", "bar") bytes, err := expected.ToJson() assert.NoError(t, err, "failed to serialize in JSON") - meta, err := esdb.StreamMetadataFromJson(bytes) + meta, err := kurrentdb.StreamMetadataFromJson(bytes) assert.NoError(t, err, "failed to parse Metadata from props") @@ -56,19 +56,19 @@ func TestConsistentMetadataSerializationUserStreamAcl(t *testing.T) { } func TestConsistentMetadataSerializationSystemStreamAcl(t *testing.T) { - expected := esdb.StreamMetadata{} + expected := kurrentdb.StreamMetadata{} expected.SetMaxAge(2 * time.Second) expected.SetCacheControl(15 * time.Second) expected.SetTruncateBefore(1) expected.SetMaxCount(12) - expected.SetAcl(esdb.SystemStreamAcl) + expected.SetAcl(kurrentdb.SystemStreamAcl) expected.AddCustomProperty("foo", "bar") bytes, err := expected.ToJson() assert.NoError(t, err, "failed to serialize in JSON") - meta, err := esdb.StreamMetadataFromJson(bytes) + meta, err := kurrentdb.StreamMetadataFromJson(bytes) assert.NoError(t, err, "failed to parse Metadata from props") @@ -76,7 +76,7 @@ func TestConsistentMetadataSerializationSystemStreamAcl(t *testing.T) { } func TestCustomPropertyRetrievalFromStreamMetadata(t *testing.T) { - expected := esdb.StreamMetadata{} + expected := kurrentdb.StreamMetadata{} expected.AddCustomProperty("foo", "bar") foo := expected.CustomProperty("foo") @@ -85,7 +85,7 @@ func TestCustomPropertyRetrievalFromStreamMetadata(t *testing.T) { } func TestUnknownCustomPropertyRetrievalFromStreamMetadata(t *testing.T) { - expected := esdb.StreamMetadata{} + expected := kurrentdb.StreamMetadata{} expected.AddCustomProperty("foo", "bar") foo := expected.CustomProperty("foes") @@ -94,7 +94,7 @@ func TestUnknownCustomPropertyRetrievalFromStreamMetadata(t *testing.T) { } func TestGetAllCustomPropertiesFromStreamMetadata(t *testing.T) { - expected := esdb.StreamMetadata{} + expected := kurrentdb.StreamMetadata{} expected.AddCustomProperty("foo", 123) expected.AddCustomProperty("foes", "baz") diff --git a/esdb/uuid_parsing_test.go b/kurrentdb/uuid_parsing_test.go similarity index 61% rename from esdb/uuid_parsing_test.go rename to kurrentdb/uuid_parsing_test.go index 14bd5175..c30206ab 100644 --- a/esdb/uuid_parsing_test.go +++ b/kurrentdb/uuid_parsing_test.go @@ -1,7 +1,7 @@ -package esdb_test +package kurrentdb_test import ( - "github.com/EventStore/EventStore-Client-Go/v4/esdb" + "github.com/EventStore/EventStore-Client-Go/v1/kurrentdb" "github.com/google/uuid" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" @@ -11,8 +11,8 @@ import ( func UUIDParsingTests(t *testing.T) { t.Run("UUIDParsingTests", func(t *testing.T) { expected := uuid.New() - most, least := esdb.UUIDAsInt64(expected) - actual, err := esdb.ParseUUIDFromInt64(most, least) + most, least := kurrentdb.UUIDAsInt64(expected) + actual, err := kurrentdb.ParseUUIDFromInt64(most, least) require.NoError(t, err) assert.Equal(t, expected, actual) diff --git a/esdb/write_result.go b/kurrentdb/write_result.go similarity index 88% rename from esdb/write_result.go rename to kurrentdb/write_result.go index be8c17ed..261f4870 100644 --- a/esdb/write_result.go +++ b/kurrentdb/write_result.go @@ -1,4 +1,4 @@ -package esdb +package kurrentdb // WriteResult ... type WriteResult struct { diff --git a/protos/code/code.pb.go b/protos/code/code.pb.go index fc4da4d6..8f2a5609 100644 --- a/protos/code/code.pb.go +++ b/protos/code/code.pb.go @@ -14,8 +14,8 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.33.0 -// protoc v3.20.0 +// protoc-gen-go v1.36.5 +// protoc v5.26.0 // source: code.proto package code @@ -25,6 +25,7 @@ import ( protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" sync "sync" + unsafe "unsafe" ) const ( @@ -254,7 +255,7 @@ func (Code) EnumDescriptor() ([]byte, []int) { var File_code_proto protoreflect.FileDescriptor -var file_code_proto_rawDesc = []byte{ +var file_code_proto_rawDesc = string([]byte{ 0x0a, 0x0a, 0x63, 0x6f, 0x64, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0a, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x72, 0x70, 0x63, 0x2a, 0xb7, 0x02, 0x0a, 0x04, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x06, 0x0a, 0x02, 0x4f, 0x4b, 0x10, 0x00, 0x12, 0x0d, 0x0a, 0x09, 0x43, 0x41, 0x4e, @@ -283,22 +284,22 @@ var file_code_proto_rawDesc = []byte{ 0x6f, 0x67, 0x6c, 0x65, 0x61, 0x70, 0x69, 0x73, 0x2f, 0x72, 0x70, 0x63, 0x2f, 0x63, 0x6f, 0x64, 0x65, 0x3b, 0x63, 0x6f, 0x64, 0x65, 0xa2, 0x02, 0x03, 0x52, 0x50, 0x43, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} +}) var ( file_code_proto_rawDescOnce sync.Once - file_code_proto_rawDescData = file_code_proto_rawDesc + file_code_proto_rawDescData []byte ) func file_code_proto_rawDescGZIP() []byte { file_code_proto_rawDescOnce.Do(func() { - file_code_proto_rawDescData = protoimpl.X.CompressGZIP(file_code_proto_rawDescData) + file_code_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_code_proto_rawDesc), len(file_code_proto_rawDesc))) }) return file_code_proto_rawDescData } var file_code_proto_enumTypes = make([]protoimpl.EnumInfo, 1) -var file_code_proto_goTypes = []interface{}{ +var file_code_proto_goTypes = []any{ (Code)(0), // 0: google.rpc.Code } var file_code_proto_depIdxs = []int32{ @@ -318,7 +319,7 @@ func file_code_proto_init() { out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_code_proto_rawDesc, + RawDescriptor: unsafe.Slice(unsafe.StringData(file_code_proto_rawDesc), len(file_code_proto_rawDesc)), NumEnums: 1, NumMessages: 0, NumExtensions: 0, @@ -329,7 +330,6 @@ func file_code_proto_init() { EnumInfos: file_code_proto_enumTypes, }.Build() File_code_proto = out.File - file_code_proto_rawDesc = nil file_code_proto_goTypes = nil file_code_proto_depIdxs = nil } diff --git a/protos/gossip.proto b/protos/gossip.proto index 8340763a..f0402ca4 100644 --- a/protos/gossip.proto +++ b/protos/gossip.proto @@ -1,7 +1,7 @@ syntax = "proto3"; package event_store.client.gossip; option java_package = "com.eventstore.dbclient.proto.gossip"; -option go_package = "github.com/EventStore/EventStore-Client-Go/v4/protos/gossip"; +option go_package = "github.com/EventStore/EventStore-Client-Go/v1/protos/gossip"; import "shared.proto"; diff --git a/protos/gossip/gossip.pb.go b/protos/gossip/gossip.pb.go index fd7c991d..755e2c48 100644 --- a/protos/gossip/gossip.pb.go +++ b/protos/gossip/gossip.pb.go @@ -1,17 +1,18 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.33.0 -// protoc v3.20.0 +// protoc-gen-go v1.36.5 +// protoc v5.26.0 // source: gossip.proto package gossip import ( - shared "github.com/EventStore/EventStore-Client-Go/v4/protos/shared" + shared "github.com/EventStore/EventStore-Client-Go/v1/protos/shared" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" sync "sync" + unsafe "unsafe" ) const ( @@ -110,20 +111,17 @@ func (MemberInfo_VNodeState) EnumDescriptor() ([]byte, []int) { } type ClusterInfo struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Members []*MemberInfo `protobuf:"bytes,1,rep,name=members,proto3" json:"members,omitempty"` unknownFields protoimpl.UnknownFields - - Members []*MemberInfo `protobuf:"bytes,1,rep,name=members,proto3" json:"members,omitempty"` + sizeCache protoimpl.SizeCache } func (x *ClusterInfo) Reset() { *x = ClusterInfo{} - if protoimpl.UnsafeEnabled { - mi := &file_gossip_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_gossip_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *ClusterInfo) String() string { @@ -134,7 +132,7 @@ func (*ClusterInfo) ProtoMessage() {} func (x *ClusterInfo) ProtoReflect() protoreflect.Message { mi := &file_gossip_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -157,21 +155,18 @@ func (x *ClusterInfo) GetMembers() []*MemberInfo { } type EndPoint struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` + Port uint32 `protobuf:"varint,2,opt,name=port,proto3" json:"port,omitempty"` unknownFields protoimpl.UnknownFields - - Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` - Port uint32 `protobuf:"varint,2,opt,name=port,proto3" json:"port,omitempty"` + sizeCache protoimpl.SizeCache } func (x *EndPoint) Reset() { *x = EndPoint{} - if protoimpl.UnsafeEnabled { - mi := &file_gossip_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_gossip_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *EndPoint) String() string { @@ -182,7 +177,7 @@ func (*EndPoint) ProtoMessage() {} func (x *EndPoint) ProtoReflect() protoreflect.Message { mi := &file_gossip_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -212,24 +207,21 @@ func (x *EndPoint) GetPort() uint32 { } type MemberInfo struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + InstanceId *shared.UUID `protobuf:"bytes,1,opt,name=instance_id,json=instanceId,proto3" json:"instance_id,omitempty"` + TimeStamp int64 `protobuf:"varint,2,opt,name=time_stamp,json=timeStamp,proto3" json:"time_stamp,omitempty"` + State MemberInfo_VNodeState `protobuf:"varint,3,opt,name=state,proto3,enum=event_store.client.gossip.MemberInfo_VNodeState" json:"state,omitempty"` + IsAlive bool `protobuf:"varint,4,opt,name=is_alive,json=isAlive,proto3" json:"is_alive,omitempty"` + HttpEndPoint *EndPoint `protobuf:"bytes,5,opt,name=http_end_point,json=httpEndPoint,proto3" json:"http_end_point,omitempty"` unknownFields protoimpl.UnknownFields - - InstanceId *shared.UUID `protobuf:"bytes,1,opt,name=instance_id,json=instanceId,proto3" json:"instance_id,omitempty"` - TimeStamp int64 `protobuf:"varint,2,opt,name=time_stamp,json=timeStamp,proto3" json:"time_stamp,omitempty"` - State MemberInfo_VNodeState `protobuf:"varint,3,opt,name=state,proto3,enum=event_store.client.gossip.MemberInfo_VNodeState" json:"state,omitempty"` - IsAlive bool `protobuf:"varint,4,opt,name=is_alive,json=isAlive,proto3" json:"is_alive,omitempty"` - HttpEndPoint *EndPoint `protobuf:"bytes,5,opt,name=http_end_point,json=httpEndPoint,proto3" json:"http_end_point,omitempty"` + sizeCache protoimpl.SizeCache } func (x *MemberInfo) Reset() { *x = MemberInfo{} - if protoimpl.UnsafeEnabled { - mi := &file_gossip_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_gossip_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *MemberInfo) String() string { @@ -240,7 +232,7 @@ func (*MemberInfo) ProtoMessage() {} func (x *MemberInfo) ProtoReflect() protoreflect.Message { mi := &file_gossip_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -292,7 +284,7 @@ func (x *MemberInfo) GetHttpEndPoint() *EndPoint { var File_gossip_proto protoreflect.FileDescriptor -var file_gossip_proto_rawDesc = []byte{ +var file_gossip_proto_rawDesc = string([]byte{ 0x0a, 0x0c, 0x67, 0x6f, 0x73, 0x73, 0x69, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x19, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x5f, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x2e, 0x67, 0x6f, 0x73, 0x73, 0x69, 0x70, 0x1a, 0x0c, 0x73, 0x68, 0x61, 0x72, 0x65, @@ -351,25 +343,25 @@ var file_gossip_proto_rawDesc = []byte{ 0x69, 0x70, 0x5a, 0x3b, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x2f, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x2d, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x2d, 0x47, 0x6f, 0x2f, 0x76, - 0x34, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2f, 0x67, 0x6f, 0x73, 0x73, 0x69, 0x70, 0x62, + 0x31, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2f, 0x67, 0x6f, 0x73, 0x73, 0x69, 0x70, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} +}) var ( file_gossip_proto_rawDescOnce sync.Once - file_gossip_proto_rawDescData = file_gossip_proto_rawDesc + file_gossip_proto_rawDescData []byte ) func file_gossip_proto_rawDescGZIP() []byte { file_gossip_proto_rawDescOnce.Do(func() { - file_gossip_proto_rawDescData = protoimpl.X.CompressGZIP(file_gossip_proto_rawDescData) + file_gossip_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_gossip_proto_rawDesc), len(file_gossip_proto_rawDesc))) }) return file_gossip_proto_rawDescData } var file_gossip_proto_enumTypes = make([]protoimpl.EnumInfo, 1) var file_gossip_proto_msgTypes = make([]protoimpl.MessageInfo, 3) -var file_gossip_proto_goTypes = []interface{}{ +var file_gossip_proto_goTypes = []any{ (MemberInfo_VNodeState)(0), // 0: event_store.client.gossip.MemberInfo.VNodeState (*ClusterInfo)(nil), // 1: event_store.client.gossip.ClusterInfo (*EndPoint)(nil), // 2: event_store.client.gossip.EndPoint @@ -396,49 +388,11 @@ func file_gossip_proto_init() { if File_gossip_proto != nil { return } - if !protoimpl.UnsafeEnabled { - file_gossip_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ClusterInfo); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_gossip_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*EndPoint); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_gossip_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MemberInfo); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_gossip_proto_rawDesc, + RawDescriptor: unsafe.Slice(unsafe.StringData(file_gossip_proto_rawDesc), len(file_gossip_proto_rawDesc)), NumEnums: 1, NumMessages: 3, NumExtensions: 0, @@ -450,7 +404,6 @@ func file_gossip_proto_init() { MessageInfos: file_gossip_proto_msgTypes, }.Build() File_gossip_proto = out.File - file_gossip_proto_rawDesc = nil file_gossip_proto_goTypes = nil file_gossip_proto_depIdxs = nil } diff --git a/protos/gossip/gossip_grpc.pb.go b/protos/gossip/gossip_grpc.pb.go index 28077a2a..4292cf25 100644 --- a/protos/gossip/gossip_grpc.pb.go +++ b/protos/gossip/gossip_grpc.pb.go @@ -1,14 +1,14 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.3.0 -// - protoc v3.20.0 +// - protoc-gen-go-grpc v1.5.1 +// - protoc v5.26.0 // source: gossip.proto package gossip import ( context "context" - shared "github.com/EventStore/EventStore-Client-Go/v4/protos/shared" + shared "github.com/EventStore/EventStore-Client-Go/v1/protos/shared" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" @@ -16,8 +16,8 @@ import ( // This is a compile-time assertion to ensure that this generated file // is compatible with the grpc package it is being compiled against. -// Requires gRPC-Go v1.32.0 or later. -const _ = grpc.SupportPackageIsVersion7 +// Requires gRPC-Go v1.64.0 or later. +const _ = grpc.SupportPackageIsVersion9 const ( Gossip_Read_FullMethodName = "/event_store.client.gossip.Gossip/Read" @@ -39,8 +39,9 @@ func NewGossipClient(cc grpc.ClientConnInterface) GossipClient { } func (c *gossipClient) Read(ctx context.Context, in *shared.Empty, opts ...grpc.CallOption) (*ClusterInfo, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(ClusterInfo) - err := c.cc.Invoke(ctx, Gossip_Read_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, Gossip_Read_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } @@ -49,20 +50,24 @@ func (c *gossipClient) Read(ctx context.Context, in *shared.Empty, opts ...grpc. // GossipServer is the server API for Gossip service. // All implementations must embed UnimplementedGossipServer -// for forward compatibility +// for forward compatibility. type GossipServer interface { Read(context.Context, *shared.Empty) (*ClusterInfo, error) mustEmbedUnimplementedGossipServer() } -// UnimplementedGossipServer must be embedded to have forward compatible implementations. -type UnimplementedGossipServer struct { -} +// UnimplementedGossipServer must be embedded to have +// forward compatible implementations. +// +// NOTE: this should be embedded by value instead of pointer to avoid a nil +// pointer dereference when methods are called. +type UnimplementedGossipServer struct{} func (UnimplementedGossipServer) Read(context.Context, *shared.Empty) (*ClusterInfo, error) { return nil, status.Errorf(codes.Unimplemented, "method Read not implemented") } func (UnimplementedGossipServer) mustEmbedUnimplementedGossipServer() {} +func (UnimplementedGossipServer) testEmbeddedByValue() {} // UnsafeGossipServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to GossipServer will @@ -72,6 +77,13 @@ type UnsafeGossipServer interface { } func RegisterGossipServer(s grpc.ServiceRegistrar, srv GossipServer) { + // If the following call pancis, it indicates UnimplementedGossipServer was + // embedded by pointer and is nil. This will cause panics if an + // unimplemented method is ever invoked, so we test this at initialization + // time to prevent it from happening at runtime later due to I/O. + if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { + t.testEmbeddedByValue() + } s.RegisterService(&Gossip_ServiceDesc, srv) } diff --git a/protos/persistent.proto b/protos/persistent.proto index 6fa6afae..6e634d2d 100644 --- a/protos/persistent.proto +++ b/protos/persistent.proto @@ -1,7 +1,7 @@ syntax = "proto3"; package event_store.client.persistent_subscriptions; option java_package = "com.eventstore.dbclient.proto.persistentsubscriptions"; -option go_package = "github.com/EventStore/EventStore-Client-Go/v4/protos/persistent"; +option go_package = "github.com/EventStore/EventStore-Client-Go/v1/protos/persistent"; import "shared.proto"; diff --git a/protos/persistent/persistent.pb.go b/protos/persistent/persistent.pb.go index 518d6301..4bf78b6e 100644 --- a/protos/persistent/persistent.pb.go +++ b/protos/persistent/persistent.pb.go @@ -1,17 +1,18 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.33.0 -// protoc v3.20.0 +// protoc-gen-go v1.36.5 +// protoc v5.26.0 // source: persistent.proto package persistent import ( - shared "github.com/EventStore/EventStore-Client-Go/v4/protos/shared" + shared "github.com/EventStore/EventStore-Client-Go/v1/protos/shared" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" sync "sync" + unsafe "unsafe" ) const ( @@ -175,25 +176,22 @@ func (UpdateReq_ConsumerStrategy) EnumDescriptor() ([]byte, []int) { } type ReadReq struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Types that are assignable to Content: + state protoimpl.MessageState `protogen:"open.v1"` + // Types that are valid to be assigned to Content: // // *ReadReq_Options_ // *ReadReq_Ack_ // *ReadReq_Nack_ - Content isReadReq_Content `protobuf_oneof:"content"` + Content isReadReq_Content `protobuf_oneof:"content"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *ReadReq) Reset() { *x = ReadReq{} - if protoimpl.UnsafeEnabled { - mi := &file_persistent_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_persistent_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *ReadReq) String() string { @@ -204,7 +202,7 @@ func (*ReadReq) ProtoMessage() {} func (x *ReadReq) ProtoReflect() protoreflect.Message { mi := &file_persistent_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -219,30 +217,36 @@ func (*ReadReq) Descriptor() ([]byte, []int) { return file_persistent_proto_rawDescGZIP(), []int{0} } -func (m *ReadReq) GetContent() isReadReq_Content { - if m != nil { - return m.Content +func (x *ReadReq) GetContent() isReadReq_Content { + if x != nil { + return x.Content } return nil } func (x *ReadReq) GetOptions() *ReadReq_Options { - if x, ok := x.GetContent().(*ReadReq_Options_); ok { - return x.Options + if x != nil { + if x, ok := x.Content.(*ReadReq_Options_); ok { + return x.Options + } } return nil } func (x *ReadReq) GetAck() *ReadReq_Ack { - if x, ok := x.GetContent().(*ReadReq_Ack_); ok { - return x.Ack + if x != nil { + if x, ok := x.Content.(*ReadReq_Ack_); ok { + return x.Ack + } } return nil } func (x *ReadReq) GetNack() *ReadReq_Nack { - if x, ok := x.GetContent().(*ReadReq_Nack_); ok { - return x.Nack + if x != nil { + if x, ok := x.Content.(*ReadReq_Nack_); ok { + return x.Nack + } } return nil } @@ -270,24 +274,21 @@ func (*ReadReq_Ack_) isReadReq_Content() {} func (*ReadReq_Nack_) isReadReq_Content() {} type ReadResp struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Types that are assignable to Content: + state protoimpl.MessageState `protogen:"open.v1"` + // Types that are valid to be assigned to Content: // // *ReadResp_Event // *ReadResp_SubscriptionConfirmation_ - Content isReadResp_Content `protobuf_oneof:"content"` + Content isReadResp_Content `protobuf_oneof:"content"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *ReadResp) Reset() { *x = ReadResp{} - if protoimpl.UnsafeEnabled { - mi := &file_persistent_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_persistent_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *ReadResp) String() string { @@ -298,7 +299,7 @@ func (*ReadResp) ProtoMessage() {} func (x *ReadResp) ProtoReflect() protoreflect.Message { mi := &file_persistent_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -313,23 +314,27 @@ func (*ReadResp) Descriptor() ([]byte, []int) { return file_persistent_proto_rawDescGZIP(), []int{1} } -func (m *ReadResp) GetContent() isReadResp_Content { - if m != nil { - return m.Content +func (x *ReadResp) GetContent() isReadResp_Content { + if x != nil { + return x.Content } return nil } func (x *ReadResp) GetEvent() *ReadResp_ReadEvent { - if x, ok := x.GetContent().(*ReadResp_Event); ok { - return x.Event + if x != nil { + if x, ok := x.Content.(*ReadResp_Event); ok { + return x.Event + } } return nil } func (x *ReadResp) GetSubscriptionConfirmation() *ReadResp_SubscriptionConfirmation { - if x, ok := x.GetContent().(*ReadResp_SubscriptionConfirmation_); ok { - return x.SubscriptionConfirmation + if x != nil { + if x, ok := x.Content.(*ReadResp_SubscriptionConfirmation_); ok { + return x.SubscriptionConfirmation + } } return nil } @@ -351,20 +356,17 @@ func (*ReadResp_Event) isReadResp_Content() {} func (*ReadResp_SubscriptionConfirmation_) isReadResp_Content() {} type CreateReq struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Options *CreateReq_Options `protobuf:"bytes,1,opt,name=options,proto3" json:"options,omitempty"` unknownFields protoimpl.UnknownFields - - Options *CreateReq_Options `protobuf:"bytes,1,opt,name=options,proto3" json:"options,omitempty"` + sizeCache protoimpl.SizeCache } func (x *CreateReq) Reset() { *x = CreateReq{} - if protoimpl.UnsafeEnabled { - mi := &file_persistent_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_persistent_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *CreateReq) String() string { @@ -375,7 +377,7 @@ func (*CreateReq) ProtoMessage() {} func (x *CreateReq) ProtoReflect() protoreflect.Message { mi := &file_persistent_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -398,18 +400,16 @@ func (x *CreateReq) GetOptions() *CreateReq_Options { } type CreateResp struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *CreateResp) Reset() { *x = CreateResp{} - if protoimpl.UnsafeEnabled { - mi := &file_persistent_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_persistent_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *CreateResp) String() string { @@ -420,7 +420,7 @@ func (*CreateResp) ProtoMessage() {} func (x *CreateResp) ProtoReflect() protoreflect.Message { mi := &file_persistent_proto_msgTypes[3] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -436,20 +436,17 @@ func (*CreateResp) Descriptor() ([]byte, []int) { } type UpdateReq struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Options *UpdateReq_Options `protobuf:"bytes,1,opt,name=options,proto3" json:"options,omitempty"` unknownFields protoimpl.UnknownFields - - Options *UpdateReq_Options `protobuf:"bytes,1,opt,name=options,proto3" json:"options,omitempty"` + sizeCache protoimpl.SizeCache } func (x *UpdateReq) Reset() { *x = UpdateReq{} - if protoimpl.UnsafeEnabled { - mi := &file_persistent_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_persistent_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *UpdateReq) String() string { @@ -460,7 +457,7 @@ func (*UpdateReq) ProtoMessage() {} func (x *UpdateReq) ProtoReflect() protoreflect.Message { mi := &file_persistent_proto_msgTypes[4] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -483,18 +480,16 @@ func (x *UpdateReq) GetOptions() *UpdateReq_Options { } type UpdateResp struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *UpdateResp) Reset() { *x = UpdateResp{} - if protoimpl.UnsafeEnabled { - mi := &file_persistent_proto_msgTypes[5] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_persistent_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *UpdateResp) String() string { @@ -505,7 +500,7 @@ func (*UpdateResp) ProtoMessage() {} func (x *UpdateResp) ProtoReflect() protoreflect.Message { mi := &file_persistent_proto_msgTypes[5] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -521,20 +516,17 @@ func (*UpdateResp) Descriptor() ([]byte, []int) { } type DeleteReq struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Options *DeleteReq_Options `protobuf:"bytes,1,opt,name=options,proto3" json:"options,omitempty"` unknownFields protoimpl.UnknownFields - - Options *DeleteReq_Options `protobuf:"bytes,1,opt,name=options,proto3" json:"options,omitempty"` + sizeCache protoimpl.SizeCache } func (x *DeleteReq) Reset() { *x = DeleteReq{} - if protoimpl.UnsafeEnabled { - mi := &file_persistent_proto_msgTypes[6] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_persistent_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *DeleteReq) String() string { @@ -545,7 +537,7 @@ func (*DeleteReq) ProtoMessage() {} func (x *DeleteReq) ProtoReflect() protoreflect.Message { mi := &file_persistent_proto_msgTypes[6] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -568,18 +560,16 @@ func (x *DeleteReq) GetOptions() *DeleteReq_Options { } type DeleteResp struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *DeleteResp) Reset() { *x = DeleteResp{} - if protoimpl.UnsafeEnabled { - mi := &file_persistent_proto_msgTypes[7] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_persistent_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *DeleteResp) String() string { @@ -590,7 +580,7 @@ func (*DeleteResp) ProtoMessage() {} func (x *DeleteResp) ProtoReflect() protoreflect.Message { mi := &file_persistent_proto_msgTypes[7] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -606,20 +596,17 @@ func (*DeleteResp) Descriptor() ([]byte, []int) { } type GetInfoReq struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Options *GetInfoReq_Options `protobuf:"bytes,1,opt,name=options,proto3" json:"options,omitempty"` unknownFields protoimpl.UnknownFields - - Options *GetInfoReq_Options `protobuf:"bytes,1,opt,name=options,proto3" json:"options,omitempty"` + sizeCache protoimpl.SizeCache } func (x *GetInfoReq) Reset() { *x = GetInfoReq{} - if protoimpl.UnsafeEnabled { - mi := &file_persistent_proto_msgTypes[8] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_persistent_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *GetInfoReq) String() string { @@ -630,7 +617,7 @@ func (*GetInfoReq) ProtoMessage() {} func (x *GetInfoReq) ProtoReflect() protoreflect.Message { mi := &file_persistent_proto_msgTypes[8] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -653,20 +640,17 @@ func (x *GetInfoReq) GetOptions() *GetInfoReq_Options { } type GetInfoResp struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - SubscriptionInfo *SubscriptionInfo `protobuf:"bytes,1,opt,name=subscription_info,json=subscriptionInfo,proto3" json:"subscription_info,omitempty"` + state protoimpl.MessageState `protogen:"open.v1"` + SubscriptionInfo *SubscriptionInfo `protobuf:"bytes,1,opt,name=subscription_info,json=subscriptionInfo,proto3" json:"subscription_info,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *GetInfoResp) Reset() { *x = GetInfoResp{} - if protoimpl.UnsafeEnabled { - mi := &file_persistent_proto_msgTypes[9] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_persistent_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *GetInfoResp) String() string { @@ -677,7 +661,7 @@ func (*GetInfoResp) ProtoMessage() {} func (x *GetInfoResp) ProtoReflect() protoreflect.Message { mi := &file_persistent_proto_msgTypes[9] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -700,10 +684,7 @@ func (x *GetInfoResp) GetSubscriptionInfo() *SubscriptionInfo { } type SubscriptionInfo struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - + state protoimpl.MessageState `protogen:"open.v1"` EventSource string `protobuf:"bytes,1,opt,name=event_source,json=eventSource,proto3" json:"event_source,omitempty"` GroupName string `protobuf:"bytes,2,opt,name=group_name,json=groupName,proto3" json:"group_name,omitempty"` Status string `protobuf:"bytes,3,opt,name=status,proto3" json:"status,omitempty"` @@ -732,15 +713,15 @@ type SubscriptionInfo struct { NamedConsumerStrategy string `protobuf:"bytes,26,opt,name=named_consumer_strategy,json=namedConsumerStrategy,proto3" json:"named_consumer_strategy,omitempty"` MaxSubscriberCount int32 `protobuf:"varint,27,opt,name=max_subscriber_count,json=maxSubscriberCount,proto3" json:"max_subscriber_count,omitempty"` ParkedMessageCount int64 `protobuf:"varint,28,opt,name=parked_message_count,json=parkedMessageCount,proto3" json:"parked_message_count,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *SubscriptionInfo) Reset() { *x = SubscriptionInfo{} - if protoimpl.UnsafeEnabled { - mi := &file_persistent_proto_msgTypes[10] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_persistent_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *SubscriptionInfo) String() string { @@ -751,7 +732,7 @@ func (*SubscriptionInfo) ProtoMessage() {} func (x *SubscriptionInfo) ProtoReflect() protoreflect.Message { mi := &file_persistent_proto_msgTypes[10] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -963,20 +944,17 @@ func (x *SubscriptionInfo) GetParkedMessageCount() int64 { } type ReplayParkedReq struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Options *ReplayParkedReq_Options `protobuf:"bytes,1,opt,name=options,proto3" json:"options,omitempty"` unknownFields protoimpl.UnknownFields - - Options *ReplayParkedReq_Options `protobuf:"bytes,1,opt,name=options,proto3" json:"options,omitempty"` + sizeCache protoimpl.SizeCache } func (x *ReplayParkedReq) Reset() { *x = ReplayParkedReq{} - if protoimpl.UnsafeEnabled { - mi := &file_persistent_proto_msgTypes[11] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_persistent_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *ReplayParkedReq) String() string { @@ -987,7 +965,7 @@ func (*ReplayParkedReq) ProtoMessage() {} func (x *ReplayParkedReq) ProtoReflect() protoreflect.Message { mi := &file_persistent_proto_msgTypes[11] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -1010,18 +988,16 @@ func (x *ReplayParkedReq) GetOptions() *ReplayParkedReq_Options { } type ReplayParkedResp struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *ReplayParkedResp) Reset() { *x = ReplayParkedResp{} - if protoimpl.UnsafeEnabled { - mi := &file_persistent_proto_msgTypes[12] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_persistent_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *ReplayParkedResp) String() string { @@ -1032,7 +1008,7 @@ func (*ReplayParkedResp) ProtoMessage() {} func (x *ReplayParkedResp) ProtoReflect() protoreflect.Message { mi := &file_persistent_proto_msgTypes[12] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -1048,20 +1024,17 @@ func (*ReplayParkedResp) Descriptor() ([]byte, []int) { } type ListReq struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Options *ListReq_Options `protobuf:"bytes,1,opt,name=options,proto3" json:"options,omitempty"` unknownFields protoimpl.UnknownFields - - Options *ListReq_Options `protobuf:"bytes,1,opt,name=options,proto3" json:"options,omitempty"` + sizeCache protoimpl.SizeCache } func (x *ListReq) Reset() { *x = ListReq{} - if protoimpl.UnsafeEnabled { - mi := &file_persistent_proto_msgTypes[13] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_persistent_proto_msgTypes[13] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *ListReq) String() string { @@ -1072,7 +1045,7 @@ func (*ListReq) ProtoMessage() {} func (x *ListReq) ProtoReflect() protoreflect.Message { mi := &file_persistent_proto_msgTypes[13] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -1095,20 +1068,17 @@ func (x *ListReq) GetOptions() *ListReq_Options { } type ListResp struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Subscriptions []*SubscriptionInfo `protobuf:"bytes,1,rep,name=subscriptions,proto3" json:"subscriptions,omitempty"` unknownFields protoimpl.UnknownFields - - Subscriptions []*SubscriptionInfo `protobuf:"bytes,1,rep,name=subscriptions,proto3" json:"subscriptions,omitempty"` + sizeCache protoimpl.SizeCache } func (x *ListResp) Reset() { *x = ListResp{} - if protoimpl.UnsafeEnabled { - mi := &file_persistent_proto_msgTypes[14] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_persistent_proto_msgTypes[14] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *ListResp) String() string { @@ -1119,7 +1089,7 @@ func (*ListResp) ProtoMessage() {} func (x *ListResp) ProtoReflect() protoreflect.Message { mi := &file_persistent_proto_msgTypes[14] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -1142,27 +1112,24 @@ func (x *ListResp) GetSubscriptions() []*SubscriptionInfo { } type ReadReq_Options struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Types that are assignable to StreamOption: + state protoimpl.MessageState `protogen:"open.v1"` + // Types that are valid to be assigned to StreamOption: // // *ReadReq_Options_StreamIdentifier // *ReadReq_Options_All - StreamOption isReadReq_Options_StreamOption `protobuf_oneof:"stream_option"` - GroupName string `protobuf:"bytes,2,opt,name=group_name,json=groupName,proto3" json:"group_name,omitempty"` - BufferSize int32 `protobuf:"varint,3,opt,name=buffer_size,json=bufferSize,proto3" json:"buffer_size,omitempty"` - UuidOption *ReadReq_Options_UUIDOption `protobuf:"bytes,4,opt,name=uuid_option,json=uuidOption,proto3" json:"uuid_option,omitempty"` + StreamOption isReadReq_Options_StreamOption `protobuf_oneof:"stream_option"` + GroupName string `protobuf:"bytes,2,opt,name=group_name,json=groupName,proto3" json:"group_name,omitempty"` + BufferSize int32 `protobuf:"varint,3,opt,name=buffer_size,json=bufferSize,proto3" json:"buffer_size,omitempty"` + UuidOption *ReadReq_Options_UUIDOption `protobuf:"bytes,4,opt,name=uuid_option,json=uuidOption,proto3" json:"uuid_option,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *ReadReq_Options) Reset() { *x = ReadReq_Options{} - if protoimpl.UnsafeEnabled { - mi := &file_persistent_proto_msgTypes[15] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_persistent_proto_msgTypes[15] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *ReadReq_Options) String() string { @@ -1173,7 +1140,7 @@ func (*ReadReq_Options) ProtoMessage() {} func (x *ReadReq_Options) ProtoReflect() protoreflect.Message { mi := &file_persistent_proto_msgTypes[15] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -1188,23 +1155,27 @@ func (*ReadReq_Options) Descriptor() ([]byte, []int) { return file_persistent_proto_rawDescGZIP(), []int{0, 0} } -func (m *ReadReq_Options) GetStreamOption() isReadReq_Options_StreamOption { - if m != nil { - return m.StreamOption +func (x *ReadReq_Options) GetStreamOption() isReadReq_Options_StreamOption { + if x != nil { + return x.StreamOption } return nil } func (x *ReadReq_Options) GetStreamIdentifier() *shared.StreamIdentifier { - if x, ok := x.GetStreamOption().(*ReadReq_Options_StreamIdentifier); ok { - return x.StreamIdentifier + if x != nil { + if x, ok := x.StreamOption.(*ReadReq_Options_StreamIdentifier); ok { + return x.StreamIdentifier + } } return nil } func (x *ReadReq_Options) GetAll() *shared.Empty { - if x, ok := x.GetStreamOption().(*ReadReq_Options_All); ok { - return x.All + if x != nil { + if x, ok := x.StreamOption.(*ReadReq_Options_All); ok { + return x.All + } } return nil } @@ -1247,21 +1218,18 @@ func (*ReadReq_Options_StreamIdentifier) isReadReq_Options_StreamOption() {} func (*ReadReq_Options_All) isReadReq_Options_StreamOption() {} type ReadReq_Ack struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Id []byte `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + Ids []*shared.UUID `protobuf:"bytes,2,rep,name=ids,proto3" json:"ids,omitempty"` unknownFields protoimpl.UnknownFields - - Id []byte `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` - Ids []*shared.UUID `protobuf:"bytes,2,rep,name=ids,proto3" json:"ids,omitempty"` + sizeCache protoimpl.SizeCache } func (x *ReadReq_Ack) Reset() { *x = ReadReq_Ack{} - if protoimpl.UnsafeEnabled { - mi := &file_persistent_proto_msgTypes[16] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_persistent_proto_msgTypes[16] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *ReadReq_Ack) String() string { @@ -1272,7 +1240,7 @@ func (*ReadReq_Ack) ProtoMessage() {} func (x *ReadReq_Ack) ProtoReflect() protoreflect.Message { mi := &file_persistent_proto_msgTypes[16] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -1302,23 +1270,20 @@ func (x *ReadReq_Ack) GetIds() []*shared.UUID { } type ReadReq_Nack struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Id []byte `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + Ids []*shared.UUID `protobuf:"bytes,2,rep,name=ids,proto3" json:"ids,omitempty"` + Action ReadReq_Nack_Action `protobuf:"varint,3,opt,name=action,proto3,enum=event_store.client.persistent_subscriptions.ReadReq_Nack_Action" json:"action,omitempty"` + Reason string `protobuf:"bytes,4,opt,name=reason,proto3" json:"reason,omitempty"` unknownFields protoimpl.UnknownFields - - Id []byte `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` - Ids []*shared.UUID `protobuf:"bytes,2,rep,name=ids,proto3" json:"ids,omitempty"` - Action ReadReq_Nack_Action `protobuf:"varint,3,opt,name=action,proto3,enum=event_store.client.persistent_subscriptions.ReadReq_Nack_Action" json:"action,omitempty"` - Reason string `protobuf:"bytes,4,opt,name=reason,proto3" json:"reason,omitempty"` + sizeCache protoimpl.SizeCache } func (x *ReadReq_Nack) Reset() { *x = ReadReq_Nack{} - if protoimpl.UnsafeEnabled { - mi := &file_persistent_proto_msgTypes[17] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_persistent_proto_msgTypes[17] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *ReadReq_Nack) String() string { @@ -1329,7 +1294,7 @@ func (*ReadReq_Nack) ProtoMessage() {} func (x *ReadReq_Nack) ProtoReflect() protoreflect.Message { mi := &file_persistent_proto_msgTypes[17] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -1373,24 +1338,21 @@ func (x *ReadReq_Nack) GetReason() string { } type ReadReq_Options_UUIDOption struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Types that are assignable to Content: + state protoimpl.MessageState `protogen:"open.v1"` + // Types that are valid to be assigned to Content: // // *ReadReq_Options_UUIDOption_Structured // *ReadReq_Options_UUIDOption_String_ - Content isReadReq_Options_UUIDOption_Content `protobuf_oneof:"content"` + Content isReadReq_Options_UUIDOption_Content `protobuf_oneof:"content"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *ReadReq_Options_UUIDOption) Reset() { *x = ReadReq_Options_UUIDOption{} - if protoimpl.UnsafeEnabled { - mi := &file_persistent_proto_msgTypes[18] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_persistent_proto_msgTypes[18] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *ReadReq_Options_UUIDOption) String() string { @@ -1401,7 +1363,7 @@ func (*ReadReq_Options_UUIDOption) ProtoMessage() {} func (x *ReadReq_Options_UUIDOption) ProtoReflect() protoreflect.Message { mi := &file_persistent_proto_msgTypes[18] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -1416,23 +1378,27 @@ func (*ReadReq_Options_UUIDOption) Descriptor() ([]byte, []int) { return file_persistent_proto_rawDescGZIP(), []int{0, 0, 0} } -func (m *ReadReq_Options_UUIDOption) GetContent() isReadReq_Options_UUIDOption_Content { - if m != nil { - return m.Content +func (x *ReadReq_Options_UUIDOption) GetContent() isReadReq_Options_UUIDOption_Content { + if x != nil { + return x.Content } return nil } func (x *ReadReq_Options_UUIDOption) GetStructured() *shared.Empty { - if x, ok := x.GetContent().(*ReadReq_Options_UUIDOption_Structured); ok { - return x.Structured + if x != nil { + if x, ok := x.Content.(*ReadReq_Options_UUIDOption_Structured); ok { + return x.Structured + } } return nil } func (x *ReadReq_Options_UUIDOption) GetString_() *shared.Empty { - if x, ok := x.GetContent().(*ReadReq_Options_UUIDOption_String_); ok { - return x.String_ + if x != nil { + if x, ok := x.Content.(*ReadReq_Options_UUIDOption_String_); ok { + return x.String_ + } } return nil } @@ -1454,31 +1420,28 @@ func (*ReadReq_Options_UUIDOption_Structured) isReadReq_Options_UUIDOption_Conte func (*ReadReq_Options_UUIDOption_String_) isReadReq_Options_UUIDOption_Content() {} type ReadResp_ReadEvent struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - + state protoimpl.MessageState `protogen:"open.v1"` Event *ReadResp_ReadEvent_RecordedEvent `protobuf:"bytes,1,opt,name=event,proto3" json:"event,omitempty"` Link *ReadResp_ReadEvent_RecordedEvent `protobuf:"bytes,2,opt,name=link,proto3" json:"link,omitempty"` - // Types that are assignable to Position: + // Types that are valid to be assigned to Position: // // *ReadResp_ReadEvent_CommitPosition // *ReadResp_ReadEvent_NoPosition Position isReadResp_ReadEvent_Position `protobuf_oneof:"position"` - // Types that are assignable to Count: + // Types that are valid to be assigned to Count: // // *ReadResp_ReadEvent_RetryCount // *ReadResp_ReadEvent_NoRetryCount - Count isReadResp_ReadEvent_Count `protobuf_oneof:"count"` + Count isReadResp_ReadEvent_Count `protobuf_oneof:"count"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *ReadResp_ReadEvent) Reset() { *x = ReadResp_ReadEvent{} - if protoimpl.UnsafeEnabled { - mi := &file_persistent_proto_msgTypes[19] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_persistent_proto_msgTypes[19] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *ReadResp_ReadEvent) String() string { @@ -1489,7 +1452,7 @@ func (*ReadResp_ReadEvent) ProtoMessage() {} func (x *ReadResp_ReadEvent) ProtoReflect() protoreflect.Message { mi := &file_persistent_proto_msgTypes[19] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -1518,44 +1481,52 @@ func (x *ReadResp_ReadEvent) GetLink() *ReadResp_ReadEvent_RecordedEvent { return nil } -func (m *ReadResp_ReadEvent) GetPosition() isReadResp_ReadEvent_Position { - if m != nil { - return m.Position +func (x *ReadResp_ReadEvent) GetPosition() isReadResp_ReadEvent_Position { + if x != nil { + return x.Position } return nil } func (x *ReadResp_ReadEvent) GetCommitPosition() uint64 { - if x, ok := x.GetPosition().(*ReadResp_ReadEvent_CommitPosition); ok { - return x.CommitPosition + if x != nil { + if x, ok := x.Position.(*ReadResp_ReadEvent_CommitPosition); ok { + return x.CommitPosition + } } return 0 } func (x *ReadResp_ReadEvent) GetNoPosition() *shared.Empty { - if x, ok := x.GetPosition().(*ReadResp_ReadEvent_NoPosition); ok { - return x.NoPosition + if x != nil { + if x, ok := x.Position.(*ReadResp_ReadEvent_NoPosition); ok { + return x.NoPosition + } } return nil } -func (m *ReadResp_ReadEvent) GetCount() isReadResp_ReadEvent_Count { - if m != nil { - return m.Count +func (x *ReadResp_ReadEvent) GetCount() isReadResp_ReadEvent_Count { + if x != nil { + return x.Count } return nil } func (x *ReadResp_ReadEvent) GetRetryCount() int32 { - if x, ok := x.GetCount().(*ReadResp_ReadEvent_RetryCount); ok { - return x.RetryCount + if x != nil { + if x, ok := x.Count.(*ReadResp_ReadEvent_RetryCount); ok { + return x.RetryCount + } } return 0 } func (x *ReadResp_ReadEvent) GetNoRetryCount() *shared.Empty { - if x, ok := x.GetCount().(*ReadResp_ReadEvent_NoRetryCount); ok { - return x.NoRetryCount + if x != nil { + if x, ok := x.Count.(*ReadResp_ReadEvent_NoRetryCount); ok { + return x.NoRetryCount + } } return nil } @@ -1593,20 +1564,17 @@ func (*ReadResp_ReadEvent_RetryCount) isReadResp_ReadEvent_Count() {} func (*ReadResp_ReadEvent_NoRetryCount) isReadResp_ReadEvent_Count() {} type ReadResp_SubscriptionConfirmation struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - SubscriptionId string `protobuf:"bytes,1,opt,name=subscription_id,json=subscriptionId,proto3" json:"subscription_id,omitempty"` + state protoimpl.MessageState `protogen:"open.v1"` + SubscriptionId string `protobuf:"bytes,1,opt,name=subscription_id,json=subscriptionId,proto3" json:"subscription_id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *ReadResp_SubscriptionConfirmation) Reset() { *x = ReadResp_SubscriptionConfirmation{} - if protoimpl.UnsafeEnabled { - mi := &file_persistent_proto_msgTypes[20] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_persistent_proto_msgTypes[20] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *ReadResp_SubscriptionConfirmation) String() string { @@ -1617,7 +1585,7 @@ func (*ReadResp_SubscriptionConfirmation) ProtoMessage() {} func (x *ReadResp_SubscriptionConfirmation) ProtoReflect() protoreflect.Message { mi := &file_persistent_proto_msgTypes[20] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -1640,27 +1608,24 @@ func (x *ReadResp_SubscriptionConfirmation) GetSubscriptionId() string { } type ReadResp_ReadEvent_RecordedEvent struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - + state protoimpl.MessageState `protogen:"open.v1"` Id *shared.UUID `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` StreamIdentifier *shared.StreamIdentifier `protobuf:"bytes,2,opt,name=stream_identifier,json=streamIdentifier,proto3" json:"stream_identifier,omitempty"` StreamRevision uint64 `protobuf:"varint,3,opt,name=stream_revision,json=streamRevision,proto3" json:"stream_revision,omitempty"` PreparePosition uint64 `protobuf:"varint,4,opt,name=prepare_position,json=preparePosition,proto3" json:"prepare_position,omitempty"` CommitPosition uint64 `protobuf:"varint,5,opt,name=commit_position,json=commitPosition,proto3" json:"commit_position,omitempty"` - Metadata map[string]string `protobuf:"bytes,6,rep,name=metadata,proto3" json:"metadata,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + Metadata map[string]string `protobuf:"bytes,6,rep,name=metadata,proto3" json:"metadata,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` CustomMetadata []byte `protobuf:"bytes,7,opt,name=custom_metadata,json=customMetadata,proto3" json:"custom_metadata,omitempty"` Data []byte `protobuf:"bytes,8,opt,name=data,proto3" json:"data,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *ReadResp_ReadEvent_RecordedEvent) Reset() { *x = ReadResp_ReadEvent_RecordedEvent{} - if protoimpl.UnsafeEnabled { - mi := &file_persistent_proto_msgTypes[21] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_persistent_proto_msgTypes[21] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *ReadResp_ReadEvent_RecordedEvent) String() string { @@ -1671,7 +1636,7 @@ func (*ReadResp_ReadEvent_RecordedEvent) ProtoMessage() {} func (x *ReadResp_ReadEvent_RecordedEvent) ProtoReflect() protoreflect.Message { mi := &file_persistent_proto_msgTypes[21] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -1743,11 +1708,8 @@ func (x *ReadResp_ReadEvent_RecordedEvent) GetData() []byte { } type CreateReq_Options struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Types that are assignable to StreamOption: + state protoimpl.MessageState `protogen:"open.v1"` + // Types that are valid to be assigned to StreamOption: // // *CreateReq_Options_Stream // *CreateReq_Options_All @@ -1756,15 +1718,15 @@ type CreateReq_Options struct { StreamIdentifier *shared.StreamIdentifier `protobuf:"bytes,1,opt,name=stream_identifier,json=streamIdentifier,proto3" json:"stream_identifier,omitempty"` GroupName string `protobuf:"bytes,2,opt,name=group_name,json=groupName,proto3" json:"group_name,omitempty"` Settings *CreateReq_Settings `protobuf:"bytes,3,opt,name=settings,proto3" json:"settings,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *CreateReq_Options) Reset() { *x = CreateReq_Options{} - if protoimpl.UnsafeEnabled { - mi := &file_persistent_proto_msgTypes[23] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_persistent_proto_msgTypes[23] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *CreateReq_Options) String() string { @@ -1775,7 +1737,7 @@ func (*CreateReq_Options) ProtoMessage() {} func (x *CreateReq_Options) ProtoReflect() protoreflect.Message { mi := &file_persistent_proto_msgTypes[23] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -1790,23 +1752,27 @@ func (*CreateReq_Options) Descriptor() ([]byte, []int) { return file_persistent_proto_rawDescGZIP(), []int{2, 0} } -func (m *CreateReq_Options) GetStreamOption() isCreateReq_Options_StreamOption { - if m != nil { - return m.StreamOption +func (x *CreateReq_Options) GetStreamOption() isCreateReq_Options_StreamOption { + if x != nil { + return x.StreamOption } return nil } func (x *CreateReq_Options) GetStream() *CreateReq_StreamOptions { - if x, ok := x.GetStreamOption().(*CreateReq_Options_Stream); ok { - return x.Stream + if x != nil { + if x, ok := x.StreamOption.(*CreateReq_Options_Stream); ok { + return x.Stream + } } return nil } func (x *CreateReq_Options) GetAll() *CreateReq_AllOptions { - if x, ok := x.GetStreamOption().(*CreateReq_Options_All); ok { - return x.All + if x != nil { + if x, ok := x.StreamOption.(*CreateReq_Options_All); ok { + return x.All + } } return nil } @@ -1850,26 +1816,23 @@ func (*CreateReq_Options_Stream) isCreateReq_Options_StreamOption() {} func (*CreateReq_Options_All) isCreateReq_Options_StreamOption() {} type CreateReq_StreamOptions struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - + state protoimpl.MessageState `protogen:"open.v1"` StreamIdentifier *shared.StreamIdentifier `protobuf:"bytes,1,opt,name=stream_identifier,json=streamIdentifier,proto3" json:"stream_identifier,omitempty"` - // Types that are assignable to RevisionOption: + // Types that are valid to be assigned to RevisionOption: // // *CreateReq_StreamOptions_Revision // *CreateReq_StreamOptions_Start // *CreateReq_StreamOptions_End RevisionOption isCreateReq_StreamOptions_RevisionOption `protobuf_oneof:"revision_option"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *CreateReq_StreamOptions) Reset() { *x = CreateReq_StreamOptions{} - if protoimpl.UnsafeEnabled { - mi := &file_persistent_proto_msgTypes[24] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_persistent_proto_msgTypes[24] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *CreateReq_StreamOptions) String() string { @@ -1880,7 +1843,7 @@ func (*CreateReq_StreamOptions) ProtoMessage() {} func (x *CreateReq_StreamOptions) ProtoReflect() protoreflect.Message { mi := &file_persistent_proto_msgTypes[24] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -1902,30 +1865,36 @@ func (x *CreateReq_StreamOptions) GetStreamIdentifier() *shared.StreamIdentifier return nil } -func (m *CreateReq_StreamOptions) GetRevisionOption() isCreateReq_StreamOptions_RevisionOption { - if m != nil { - return m.RevisionOption +func (x *CreateReq_StreamOptions) GetRevisionOption() isCreateReq_StreamOptions_RevisionOption { + if x != nil { + return x.RevisionOption } return nil } func (x *CreateReq_StreamOptions) GetRevision() uint64 { - if x, ok := x.GetRevisionOption().(*CreateReq_StreamOptions_Revision); ok { - return x.Revision + if x != nil { + if x, ok := x.RevisionOption.(*CreateReq_StreamOptions_Revision); ok { + return x.Revision + } } return 0 } func (x *CreateReq_StreamOptions) GetStart() *shared.Empty { - if x, ok := x.GetRevisionOption().(*CreateReq_StreamOptions_Start); ok { - return x.Start + if x != nil { + if x, ok := x.RevisionOption.(*CreateReq_StreamOptions_Start); ok { + return x.Start + } } return nil } func (x *CreateReq_StreamOptions) GetEnd() *shared.Empty { - if x, ok := x.GetRevisionOption().(*CreateReq_StreamOptions_End); ok { - return x.End + if x != nil { + if x, ok := x.RevisionOption.(*CreateReq_StreamOptions_End); ok { + return x.End + } } return nil } @@ -1953,30 +1922,27 @@ func (*CreateReq_StreamOptions_Start) isCreateReq_StreamOptions_RevisionOption() func (*CreateReq_StreamOptions_End) isCreateReq_StreamOptions_RevisionOption() {} type CreateReq_AllOptions struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Types that are assignable to AllOption: + state protoimpl.MessageState `protogen:"open.v1"` + // Types that are valid to be assigned to AllOption: // // *CreateReq_AllOptions_Position // *CreateReq_AllOptions_Start // *CreateReq_AllOptions_End AllOption isCreateReq_AllOptions_AllOption `protobuf_oneof:"all_option"` - // Types that are assignable to FilterOption: + // Types that are valid to be assigned to FilterOption: // // *CreateReq_AllOptions_Filter // *CreateReq_AllOptions_NoFilter - FilterOption isCreateReq_AllOptions_FilterOption `protobuf_oneof:"filter_option"` + FilterOption isCreateReq_AllOptions_FilterOption `protobuf_oneof:"filter_option"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *CreateReq_AllOptions) Reset() { *x = CreateReq_AllOptions{} - if protoimpl.UnsafeEnabled { - mi := &file_persistent_proto_msgTypes[25] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_persistent_proto_msgTypes[25] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *CreateReq_AllOptions) String() string { @@ -1987,7 +1953,7 @@ func (*CreateReq_AllOptions) ProtoMessage() {} func (x *CreateReq_AllOptions) ProtoReflect() protoreflect.Message { mi := &file_persistent_proto_msgTypes[25] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -2002,51 +1968,61 @@ func (*CreateReq_AllOptions) Descriptor() ([]byte, []int) { return file_persistent_proto_rawDescGZIP(), []int{2, 2} } -func (m *CreateReq_AllOptions) GetAllOption() isCreateReq_AllOptions_AllOption { - if m != nil { - return m.AllOption +func (x *CreateReq_AllOptions) GetAllOption() isCreateReq_AllOptions_AllOption { + if x != nil { + return x.AllOption } return nil } func (x *CreateReq_AllOptions) GetPosition() *CreateReq_Position { - if x, ok := x.GetAllOption().(*CreateReq_AllOptions_Position); ok { - return x.Position + if x != nil { + if x, ok := x.AllOption.(*CreateReq_AllOptions_Position); ok { + return x.Position + } } return nil } func (x *CreateReq_AllOptions) GetStart() *shared.Empty { - if x, ok := x.GetAllOption().(*CreateReq_AllOptions_Start); ok { - return x.Start + if x != nil { + if x, ok := x.AllOption.(*CreateReq_AllOptions_Start); ok { + return x.Start + } } return nil } func (x *CreateReq_AllOptions) GetEnd() *shared.Empty { - if x, ok := x.GetAllOption().(*CreateReq_AllOptions_End); ok { - return x.End + if x != nil { + if x, ok := x.AllOption.(*CreateReq_AllOptions_End); ok { + return x.End + } } return nil } -func (m *CreateReq_AllOptions) GetFilterOption() isCreateReq_AllOptions_FilterOption { - if m != nil { - return m.FilterOption +func (x *CreateReq_AllOptions) GetFilterOption() isCreateReq_AllOptions_FilterOption { + if x != nil { + return x.FilterOption } return nil } func (x *CreateReq_AllOptions) GetFilter() *CreateReq_AllOptions_FilterOptions { - if x, ok := x.GetFilterOption().(*CreateReq_AllOptions_Filter); ok { - return x.Filter + if x != nil { + if x, ok := x.FilterOption.(*CreateReq_AllOptions_Filter); ok { + return x.Filter + } } return nil } func (x *CreateReq_AllOptions) GetNoFilter() *shared.Empty { - if x, ok := x.GetFilterOption().(*CreateReq_AllOptions_NoFilter); ok { - return x.NoFilter + if x != nil { + if x, ok := x.FilterOption.(*CreateReq_AllOptions_NoFilter); ok { + return x.NoFilter + } } return nil } @@ -2090,21 +2066,18 @@ func (*CreateReq_AllOptions_Filter) isCreateReq_AllOptions_FilterOption() {} func (*CreateReq_AllOptions_NoFilter) isCreateReq_AllOptions_FilterOption() {} type CreateReq_Position struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - CommitPosition uint64 `protobuf:"varint,1,opt,name=commit_position,json=commitPosition,proto3" json:"commit_position,omitempty"` - PreparePosition uint64 `protobuf:"varint,2,opt,name=prepare_position,json=preparePosition,proto3" json:"prepare_position,omitempty"` + state protoimpl.MessageState `protogen:"open.v1"` + CommitPosition uint64 `protobuf:"varint,1,opt,name=commit_position,json=commitPosition,proto3" json:"commit_position,omitempty"` + PreparePosition uint64 `protobuf:"varint,2,opt,name=prepare_position,json=preparePosition,proto3" json:"prepare_position,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *CreateReq_Position) Reset() { *x = CreateReq_Position{} - if protoimpl.UnsafeEnabled { - mi := &file_persistent_proto_msgTypes[26] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_persistent_proto_msgTypes[26] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *CreateReq_Position) String() string { @@ -2115,7 +2088,7 @@ func (*CreateReq_Position) ProtoMessage() {} func (x *CreateReq_Position) ProtoReflect() protoreflect.Message { mi := &file_persistent_proto_msgTypes[26] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -2145,11 +2118,8 @@ func (x *CreateReq_Position) GetPreparePosition() uint64 { } type CreateReq_Settings struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - ResolveLinks bool `protobuf:"varint,1,opt,name=resolve_links,json=resolveLinks,proto3" json:"resolve_links,omitempty"` + state protoimpl.MessageState `protogen:"open.v1"` + ResolveLinks bool `protobuf:"varint,1,opt,name=resolve_links,json=resolveLinks,proto3" json:"resolve_links,omitempty"` // Deprecated: Marked as deprecated in persistent.proto. Revision uint64 `protobuf:"varint,2,opt,name=revision,proto3" json:"revision,omitempty"` ExtraStatistics bool `protobuf:"varint,3,opt,name=extra_statistics,json=extraStatistics,proto3" json:"extra_statistics,omitempty"` @@ -2162,26 +2132,26 @@ type CreateReq_Settings struct { HistoryBufferSize int32 `protobuf:"varint,12,opt,name=history_buffer_size,json=historyBufferSize,proto3" json:"history_buffer_size,omitempty"` // Deprecated: Marked as deprecated in persistent.proto. NamedConsumerStrategy CreateReq_ConsumerStrategy `protobuf:"varint,13,opt,name=named_consumer_strategy,json=namedConsumerStrategy,proto3,enum=event_store.client.persistent_subscriptions.CreateReq_ConsumerStrategy" json:"named_consumer_strategy,omitempty"` - // Types that are assignable to MessageTimeout: + // Types that are valid to be assigned to MessageTimeout: // // *CreateReq_Settings_MessageTimeoutTicks // *CreateReq_Settings_MessageTimeoutMs MessageTimeout isCreateReq_Settings_MessageTimeout `protobuf_oneof:"message_timeout"` - // Types that are assignable to CheckpointAfter: + // Types that are valid to be assigned to CheckpointAfter: // // *CreateReq_Settings_CheckpointAfterTicks // *CreateReq_Settings_CheckpointAfterMs CheckpointAfter isCreateReq_Settings_CheckpointAfter `protobuf_oneof:"checkpoint_after"` ConsumerStrategy string `protobuf:"bytes,16,opt,name=consumer_strategy,json=consumerStrategy,proto3" json:"consumer_strategy,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *CreateReq_Settings) Reset() { *x = CreateReq_Settings{} - if protoimpl.UnsafeEnabled { - mi := &file_persistent_proto_msgTypes[27] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_persistent_proto_msgTypes[27] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *CreateReq_Settings) String() string { @@ -2192,7 +2162,7 @@ func (*CreateReq_Settings) ProtoMessage() {} func (x *CreateReq_Settings) ProtoReflect() protoreflect.Message { mi := &file_persistent_proto_msgTypes[27] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -2286,44 +2256,52 @@ func (x *CreateReq_Settings) GetNamedConsumerStrategy() CreateReq_ConsumerStrate return CreateReq_DispatchToSingle } -func (m *CreateReq_Settings) GetMessageTimeout() isCreateReq_Settings_MessageTimeout { - if m != nil { - return m.MessageTimeout +func (x *CreateReq_Settings) GetMessageTimeout() isCreateReq_Settings_MessageTimeout { + if x != nil { + return x.MessageTimeout } return nil } func (x *CreateReq_Settings) GetMessageTimeoutTicks() int64 { - if x, ok := x.GetMessageTimeout().(*CreateReq_Settings_MessageTimeoutTicks); ok { - return x.MessageTimeoutTicks + if x != nil { + if x, ok := x.MessageTimeout.(*CreateReq_Settings_MessageTimeoutTicks); ok { + return x.MessageTimeoutTicks + } } return 0 } func (x *CreateReq_Settings) GetMessageTimeoutMs() int32 { - if x, ok := x.GetMessageTimeout().(*CreateReq_Settings_MessageTimeoutMs); ok { - return x.MessageTimeoutMs + if x != nil { + if x, ok := x.MessageTimeout.(*CreateReq_Settings_MessageTimeoutMs); ok { + return x.MessageTimeoutMs + } } return 0 } -func (m *CreateReq_Settings) GetCheckpointAfter() isCreateReq_Settings_CheckpointAfter { - if m != nil { - return m.CheckpointAfter +func (x *CreateReq_Settings) GetCheckpointAfter() isCreateReq_Settings_CheckpointAfter { + if x != nil { + return x.CheckpointAfter } return nil } func (x *CreateReq_Settings) GetCheckpointAfterTicks() int64 { - if x, ok := x.GetCheckpointAfter().(*CreateReq_Settings_CheckpointAfterTicks); ok { - return x.CheckpointAfterTicks + if x != nil { + if x, ok := x.CheckpointAfter.(*CreateReq_Settings_CheckpointAfterTicks); ok { + return x.CheckpointAfterTicks + } } return 0 } func (x *CreateReq_Settings) GetCheckpointAfterMs() int32 { - if x, ok := x.GetCheckpointAfter().(*CreateReq_Settings_CheckpointAfterMs); ok { - return x.CheckpointAfterMs + if x != nil { + if x, ok := x.CheckpointAfter.(*CreateReq_Settings_CheckpointAfterMs); ok { + return x.CheckpointAfterMs + } } return 0 } @@ -2368,30 +2346,27 @@ func (*CreateReq_Settings_CheckpointAfterTicks) isCreateReq_Settings_CheckpointA func (*CreateReq_Settings_CheckpointAfterMs) isCreateReq_Settings_CheckpointAfter() {} type CreateReq_AllOptions_FilterOptions struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Types that are assignable to Filter: + state protoimpl.MessageState `protogen:"open.v1"` + // Types that are valid to be assigned to Filter: // // *CreateReq_AllOptions_FilterOptions_StreamIdentifier // *CreateReq_AllOptions_FilterOptions_EventType Filter isCreateReq_AllOptions_FilterOptions_Filter `protobuf_oneof:"filter"` - // Types that are assignable to Window: + // Types that are valid to be assigned to Window: // // *CreateReq_AllOptions_FilterOptions_Max // *CreateReq_AllOptions_FilterOptions_Count Window isCreateReq_AllOptions_FilterOptions_Window `protobuf_oneof:"window"` CheckpointIntervalMultiplier uint32 `protobuf:"varint,5,opt,name=checkpointIntervalMultiplier,proto3" json:"checkpointIntervalMultiplier,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *CreateReq_AllOptions_FilterOptions) Reset() { *x = CreateReq_AllOptions_FilterOptions{} - if protoimpl.UnsafeEnabled { - mi := &file_persistent_proto_msgTypes[28] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_persistent_proto_msgTypes[28] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *CreateReq_AllOptions_FilterOptions) String() string { @@ -2402,7 +2377,7 @@ func (*CreateReq_AllOptions_FilterOptions) ProtoMessage() {} func (x *CreateReq_AllOptions_FilterOptions) ProtoReflect() protoreflect.Message { mi := &file_persistent_proto_msgTypes[28] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -2417,44 +2392,52 @@ func (*CreateReq_AllOptions_FilterOptions) Descriptor() ([]byte, []int) { return file_persistent_proto_rawDescGZIP(), []int{2, 2, 0} } -func (m *CreateReq_AllOptions_FilterOptions) GetFilter() isCreateReq_AllOptions_FilterOptions_Filter { - if m != nil { - return m.Filter +func (x *CreateReq_AllOptions_FilterOptions) GetFilter() isCreateReq_AllOptions_FilterOptions_Filter { + if x != nil { + return x.Filter } return nil } func (x *CreateReq_AllOptions_FilterOptions) GetStreamIdentifier() *CreateReq_AllOptions_FilterOptions_Expression { - if x, ok := x.GetFilter().(*CreateReq_AllOptions_FilterOptions_StreamIdentifier); ok { - return x.StreamIdentifier + if x != nil { + if x, ok := x.Filter.(*CreateReq_AllOptions_FilterOptions_StreamIdentifier); ok { + return x.StreamIdentifier + } } return nil } func (x *CreateReq_AllOptions_FilterOptions) GetEventType() *CreateReq_AllOptions_FilterOptions_Expression { - if x, ok := x.GetFilter().(*CreateReq_AllOptions_FilterOptions_EventType); ok { - return x.EventType + if x != nil { + if x, ok := x.Filter.(*CreateReq_AllOptions_FilterOptions_EventType); ok { + return x.EventType + } } return nil } -func (m *CreateReq_AllOptions_FilterOptions) GetWindow() isCreateReq_AllOptions_FilterOptions_Window { - if m != nil { - return m.Window +func (x *CreateReq_AllOptions_FilterOptions) GetWindow() isCreateReq_AllOptions_FilterOptions_Window { + if x != nil { + return x.Window } return nil } func (x *CreateReq_AllOptions_FilterOptions) GetMax() uint32 { - if x, ok := x.GetWindow().(*CreateReq_AllOptions_FilterOptions_Max); ok { - return x.Max + if x != nil { + if x, ok := x.Window.(*CreateReq_AllOptions_FilterOptions_Max); ok { + return x.Max + } } return 0 } func (x *CreateReq_AllOptions_FilterOptions) GetCount() *shared.Empty { - if x, ok := x.GetWindow().(*CreateReq_AllOptions_FilterOptions_Count); ok { - return x.Count + if x != nil { + if x, ok := x.Window.(*CreateReq_AllOptions_FilterOptions_Count); ok { + return x.Count + } } return nil } @@ -2500,21 +2483,18 @@ func (*CreateReq_AllOptions_FilterOptions_Max) isCreateReq_AllOptions_FilterOpti func (*CreateReq_AllOptions_FilterOptions_Count) isCreateReq_AllOptions_FilterOptions_Window() {} type CreateReq_AllOptions_FilterOptions_Expression struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Regex string `protobuf:"bytes,1,opt,name=regex,proto3" json:"regex,omitempty"` + Prefix []string `protobuf:"bytes,2,rep,name=prefix,proto3" json:"prefix,omitempty"` unknownFields protoimpl.UnknownFields - - Regex string `protobuf:"bytes,1,opt,name=regex,proto3" json:"regex,omitempty"` - Prefix []string `protobuf:"bytes,2,rep,name=prefix,proto3" json:"prefix,omitempty"` + sizeCache protoimpl.SizeCache } func (x *CreateReq_AllOptions_FilterOptions_Expression) Reset() { *x = CreateReq_AllOptions_FilterOptions_Expression{} - if protoimpl.UnsafeEnabled { - mi := &file_persistent_proto_msgTypes[29] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_persistent_proto_msgTypes[29] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *CreateReq_AllOptions_FilterOptions_Expression) String() string { @@ -2525,7 +2505,7 @@ func (*CreateReq_AllOptions_FilterOptions_Expression) ProtoMessage() {} func (x *CreateReq_AllOptions_FilterOptions_Expression) ProtoReflect() protoreflect.Message { mi := &file_persistent_proto_msgTypes[29] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -2555,11 +2535,8 @@ func (x *CreateReq_AllOptions_FilterOptions_Expression) GetPrefix() []string { } type UpdateReq_Options struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Types that are assignable to StreamOption: + state protoimpl.MessageState `protogen:"open.v1"` + // Types that are valid to be assigned to StreamOption: // // *UpdateReq_Options_Stream // *UpdateReq_Options_All @@ -2568,15 +2545,15 @@ type UpdateReq_Options struct { StreamIdentifier *shared.StreamIdentifier `protobuf:"bytes,1,opt,name=stream_identifier,json=streamIdentifier,proto3" json:"stream_identifier,omitempty"` GroupName string `protobuf:"bytes,2,opt,name=group_name,json=groupName,proto3" json:"group_name,omitempty"` Settings *UpdateReq_Settings `protobuf:"bytes,3,opt,name=settings,proto3" json:"settings,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *UpdateReq_Options) Reset() { *x = UpdateReq_Options{} - if protoimpl.UnsafeEnabled { - mi := &file_persistent_proto_msgTypes[30] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_persistent_proto_msgTypes[30] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *UpdateReq_Options) String() string { @@ -2587,7 +2564,7 @@ func (*UpdateReq_Options) ProtoMessage() {} func (x *UpdateReq_Options) ProtoReflect() protoreflect.Message { mi := &file_persistent_proto_msgTypes[30] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -2602,23 +2579,27 @@ func (*UpdateReq_Options) Descriptor() ([]byte, []int) { return file_persistent_proto_rawDescGZIP(), []int{4, 0} } -func (m *UpdateReq_Options) GetStreamOption() isUpdateReq_Options_StreamOption { - if m != nil { - return m.StreamOption +func (x *UpdateReq_Options) GetStreamOption() isUpdateReq_Options_StreamOption { + if x != nil { + return x.StreamOption } return nil } func (x *UpdateReq_Options) GetStream() *UpdateReq_StreamOptions { - if x, ok := x.GetStreamOption().(*UpdateReq_Options_Stream); ok { - return x.Stream + if x != nil { + if x, ok := x.StreamOption.(*UpdateReq_Options_Stream); ok { + return x.Stream + } } return nil } func (x *UpdateReq_Options) GetAll() *UpdateReq_AllOptions { - if x, ok := x.GetStreamOption().(*UpdateReq_Options_All); ok { - return x.All + if x != nil { + if x, ok := x.StreamOption.(*UpdateReq_Options_All); ok { + return x.All + } } return nil } @@ -2662,26 +2643,23 @@ func (*UpdateReq_Options_Stream) isUpdateReq_Options_StreamOption() {} func (*UpdateReq_Options_All) isUpdateReq_Options_StreamOption() {} type UpdateReq_StreamOptions struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - + state protoimpl.MessageState `protogen:"open.v1"` StreamIdentifier *shared.StreamIdentifier `protobuf:"bytes,1,opt,name=stream_identifier,json=streamIdentifier,proto3" json:"stream_identifier,omitempty"` - // Types that are assignable to RevisionOption: + // Types that are valid to be assigned to RevisionOption: // // *UpdateReq_StreamOptions_Revision // *UpdateReq_StreamOptions_Start // *UpdateReq_StreamOptions_End RevisionOption isUpdateReq_StreamOptions_RevisionOption `protobuf_oneof:"revision_option"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *UpdateReq_StreamOptions) Reset() { *x = UpdateReq_StreamOptions{} - if protoimpl.UnsafeEnabled { - mi := &file_persistent_proto_msgTypes[31] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_persistent_proto_msgTypes[31] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *UpdateReq_StreamOptions) String() string { @@ -2692,7 +2670,7 @@ func (*UpdateReq_StreamOptions) ProtoMessage() {} func (x *UpdateReq_StreamOptions) ProtoReflect() protoreflect.Message { mi := &file_persistent_proto_msgTypes[31] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -2714,30 +2692,36 @@ func (x *UpdateReq_StreamOptions) GetStreamIdentifier() *shared.StreamIdentifier return nil } -func (m *UpdateReq_StreamOptions) GetRevisionOption() isUpdateReq_StreamOptions_RevisionOption { - if m != nil { - return m.RevisionOption +func (x *UpdateReq_StreamOptions) GetRevisionOption() isUpdateReq_StreamOptions_RevisionOption { + if x != nil { + return x.RevisionOption } return nil } func (x *UpdateReq_StreamOptions) GetRevision() uint64 { - if x, ok := x.GetRevisionOption().(*UpdateReq_StreamOptions_Revision); ok { - return x.Revision + if x != nil { + if x, ok := x.RevisionOption.(*UpdateReq_StreamOptions_Revision); ok { + return x.Revision + } } return 0 } func (x *UpdateReq_StreamOptions) GetStart() *shared.Empty { - if x, ok := x.GetRevisionOption().(*UpdateReq_StreamOptions_Start); ok { - return x.Start + if x != nil { + if x, ok := x.RevisionOption.(*UpdateReq_StreamOptions_Start); ok { + return x.Start + } } return nil } func (x *UpdateReq_StreamOptions) GetEnd() *shared.Empty { - if x, ok := x.GetRevisionOption().(*UpdateReq_StreamOptions_End); ok { - return x.End + if x != nil { + if x, ok := x.RevisionOption.(*UpdateReq_StreamOptions_End); ok { + return x.End + } } return nil } @@ -2765,25 +2749,22 @@ func (*UpdateReq_StreamOptions_Start) isUpdateReq_StreamOptions_RevisionOption() func (*UpdateReq_StreamOptions_End) isUpdateReq_StreamOptions_RevisionOption() {} type UpdateReq_AllOptions struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Types that are assignable to AllOption: + state protoimpl.MessageState `protogen:"open.v1"` + // Types that are valid to be assigned to AllOption: // // *UpdateReq_AllOptions_Position // *UpdateReq_AllOptions_Start // *UpdateReq_AllOptions_End - AllOption isUpdateReq_AllOptions_AllOption `protobuf_oneof:"all_option"` + AllOption isUpdateReq_AllOptions_AllOption `protobuf_oneof:"all_option"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *UpdateReq_AllOptions) Reset() { *x = UpdateReq_AllOptions{} - if protoimpl.UnsafeEnabled { - mi := &file_persistent_proto_msgTypes[32] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_persistent_proto_msgTypes[32] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *UpdateReq_AllOptions) String() string { @@ -2794,7 +2775,7 @@ func (*UpdateReq_AllOptions) ProtoMessage() {} func (x *UpdateReq_AllOptions) ProtoReflect() protoreflect.Message { mi := &file_persistent_proto_msgTypes[32] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -2809,30 +2790,36 @@ func (*UpdateReq_AllOptions) Descriptor() ([]byte, []int) { return file_persistent_proto_rawDescGZIP(), []int{4, 2} } -func (m *UpdateReq_AllOptions) GetAllOption() isUpdateReq_AllOptions_AllOption { - if m != nil { - return m.AllOption +func (x *UpdateReq_AllOptions) GetAllOption() isUpdateReq_AllOptions_AllOption { + if x != nil { + return x.AllOption } return nil } func (x *UpdateReq_AllOptions) GetPosition() *UpdateReq_Position { - if x, ok := x.GetAllOption().(*UpdateReq_AllOptions_Position); ok { - return x.Position + if x != nil { + if x, ok := x.AllOption.(*UpdateReq_AllOptions_Position); ok { + return x.Position + } } return nil } func (x *UpdateReq_AllOptions) GetStart() *shared.Empty { - if x, ok := x.GetAllOption().(*UpdateReq_AllOptions_Start); ok { - return x.Start + if x != nil { + if x, ok := x.AllOption.(*UpdateReq_AllOptions_Start); ok { + return x.Start + } } return nil } func (x *UpdateReq_AllOptions) GetEnd() *shared.Empty { - if x, ok := x.GetAllOption().(*UpdateReq_AllOptions_End); ok { - return x.End + if x != nil { + if x, ok := x.AllOption.(*UpdateReq_AllOptions_End); ok { + return x.End + } } return nil } @@ -2860,21 +2847,18 @@ func (*UpdateReq_AllOptions_Start) isUpdateReq_AllOptions_AllOption() {} func (*UpdateReq_AllOptions_End) isUpdateReq_AllOptions_AllOption() {} type UpdateReq_Position struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - CommitPosition uint64 `protobuf:"varint,1,opt,name=commit_position,json=commitPosition,proto3" json:"commit_position,omitempty"` - PreparePosition uint64 `protobuf:"varint,2,opt,name=prepare_position,json=preparePosition,proto3" json:"prepare_position,omitempty"` + state protoimpl.MessageState `protogen:"open.v1"` + CommitPosition uint64 `protobuf:"varint,1,opt,name=commit_position,json=commitPosition,proto3" json:"commit_position,omitempty"` + PreparePosition uint64 `protobuf:"varint,2,opt,name=prepare_position,json=preparePosition,proto3" json:"prepare_position,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *UpdateReq_Position) Reset() { *x = UpdateReq_Position{} - if protoimpl.UnsafeEnabled { - mi := &file_persistent_proto_msgTypes[33] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_persistent_proto_msgTypes[33] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *UpdateReq_Position) String() string { @@ -2885,7 +2869,7 @@ func (*UpdateReq_Position) ProtoMessage() {} func (x *UpdateReq_Position) ProtoReflect() protoreflect.Message { mi := &file_persistent_proto_msgTypes[33] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -2915,11 +2899,8 @@ func (x *UpdateReq_Position) GetPreparePosition() uint64 { } type UpdateReq_Settings struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - ResolveLinks bool `protobuf:"varint,1,opt,name=resolve_links,json=resolveLinks,proto3" json:"resolve_links,omitempty"` + state protoimpl.MessageState `protogen:"open.v1"` + ResolveLinks bool `protobuf:"varint,1,opt,name=resolve_links,json=resolveLinks,proto3" json:"resolve_links,omitempty"` // Deprecated: Marked as deprecated in persistent.proto. Revision uint64 `protobuf:"varint,2,opt,name=revision,proto3" json:"revision,omitempty"` ExtraStatistics bool `protobuf:"varint,3,opt,name=extra_statistics,json=extraStatistics,proto3" json:"extra_statistics,omitempty"` @@ -2931,25 +2912,25 @@ type UpdateReq_Settings struct { ReadBatchSize int32 `protobuf:"varint,11,opt,name=read_batch_size,json=readBatchSize,proto3" json:"read_batch_size,omitempty"` HistoryBufferSize int32 `protobuf:"varint,12,opt,name=history_buffer_size,json=historyBufferSize,proto3" json:"history_buffer_size,omitempty"` NamedConsumerStrategy UpdateReq_ConsumerStrategy `protobuf:"varint,13,opt,name=named_consumer_strategy,json=namedConsumerStrategy,proto3,enum=event_store.client.persistent_subscriptions.UpdateReq_ConsumerStrategy" json:"named_consumer_strategy,omitempty"` - // Types that are assignable to MessageTimeout: + // Types that are valid to be assigned to MessageTimeout: // // *UpdateReq_Settings_MessageTimeoutTicks // *UpdateReq_Settings_MessageTimeoutMs MessageTimeout isUpdateReq_Settings_MessageTimeout `protobuf_oneof:"message_timeout"` - // Types that are assignable to CheckpointAfter: + // Types that are valid to be assigned to CheckpointAfter: // // *UpdateReq_Settings_CheckpointAfterTicks // *UpdateReq_Settings_CheckpointAfterMs CheckpointAfter isUpdateReq_Settings_CheckpointAfter `protobuf_oneof:"checkpoint_after"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *UpdateReq_Settings) Reset() { *x = UpdateReq_Settings{} - if protoimpl.UnsafeEnabled { - mi := &file_persistent_proto_msgTypes[34] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_persistent_proto_msgTypes[34] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *UpdateReq_Settings) String() string { @@ -2960,7 +2941,7 @@ func (*UpdateReq_Settings) ProtoMessage() {} func (x *UpdateReq_Settings) ProtoReflect() protoreflect.Message { mi := &file_persistent_proto_msgTypes[34] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -3053,44 +3034,52 @@ func (x *UpdateReq_Settings) GetNamedConsumerStrategy() UpdateReq_ConsumerStrate return UpdateReq_DispatchToSingle } -func (m *UpdateReq_Settings) GetMessageTimeout() isUpdateReq_Settings_MessageTimeout { - if m != nil { - return m.MessageTimeout +func (x *UpdateReq_Settings) GetMessageTimeout() isUpdateReq_Settings_MessageTimeout { + if x != nil { + return x.MessageTimeout } return nil } func (x *UpdateReq_Settings) GetMessageTimeoutTicks() int64 { - if x, ok := x.GetMessageTimeout().(*UpdateReq_Settings_MessageTimeoutTicks); ok { - return x.MessageTimeoutTicks + if x != nil { + if x, ok := x.MessageTimeout.(*UpdateReq_Settings_MessageTimeoutTicks); ok { + return x.MessageTimeoutTicks + } } return 0 } func (x *UpdateReq_Settings) GetMessageTimeoutMs() int32 { - if x, ok := x.GetMessageTimeout().(*UpdateReq_Settings_MessageTimeoutMs); ok { - return x.MessageTimeoutMs + if x != nil { + if x, ok := x.MessageTimeout.(*UpdateReq_Settings_MessageTimeoutMs); ok { + return x.MessageTimeoutMs + } } return 0 } -func (m *UpdateReq_Settings) GetCheckpointAfter() isUpdateReq_Settings_CheckpointAfter { - if m != nil { - return m.CheckpointAfter +func (x *UpdateReq_Settings) GetCheckpointAfter() isUpdateReq_Settings_CheckpointAfter { + if x != nil { + return x.CheckpointAfter } return nil } func (x *UpdateReq_Settings) GetCheckpointAfterTicks() int64 { - if x, ok := x.GetCheckpointAfter().(*UpdateReq_Settings_CheckpointAfterTicks); ok { - return x.CheckpointAfterTicks + if x != nil { + if x, ok := x.CheckpointAfter.(*UpdateReq_Settings_CheckpointAfterTicks); ok { + return x.CheckpointAfterTicks + } } return 0 } func (x *UpdateReq_Settings) GetCheckpointAfterMs() int32 { - if x, ok := x.GetCheckpointAfter().(*UpdateReq_Settings_CheckpointAfterMs); ok { - return x.CheckpointAfterMs + if x != nil { + if x, ok := x.CheckpointAfter.(*UpdateReq_Settings_CheckpointAfterMs); ok { + return x.CheckpointAfterMs + } } return 0 } @@ -3128,25 +3117,22 @@ func (*UpdateReq_Settings_CheckpointAfterTicks) isUpdateReq_Settings_CheckpointA func (*UpdateReq_Settings_CheckpointAfterMs) isUpdateReq_Settings_CheckpointAfter() {} type DeleteReq_Options struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Types that are assignable to StreamOption: + state protoimpl.MessageState `protogen:"open.v1"` + // Types that are valid to be assigned to StreamOption: // // *DeleteReq_Options_StreamIdentifier // *DeleteReq_Options_All - StreamOption isDeleteReq_Options_StreamOption `protobuf_oneof:"stream_option"` - GroupName string `protobuf:"bytes,2,opt,name=group_name,json=groupName,proto3" json:"group_name,omitempty"` + StreamOption isDeleteReq_Options_StreamOption `protobuf_oneof:"stream_option"` + GroupName string `protobuf:"bytes,2,opt,name=group_name,json=groupName,proto3" json:"group_name,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *DeleteReq_Options) Reset() { *x = DeleteReq_Options{} - if protoimpl.UnsafeEnabled { - mi := &file_persistent_proto_msgTypes[35] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_persistent_proto_msgTypes[35] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *DeleteReq_Options) String() string { @@ -3157,7 +3143,7 @@ func (*DeleteReq_Options) ProtoMessage() {} func (x *DeleteReq_Options) ProtoReflect() protoreflect.Message { mi := &file_persistent_proto_msgTypes[35] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -3172,23 +3158,27 @@ func (*DeleteReq_Options) Descriptor() ([]byte, []int) { return file_persistent_proto_rawDescGZIP(), []int{6, 0} } -func (m *DeleteReq_Options) GetStreamOption() isDeleteReq_Options_StreamOption { - if m != nil { - return m.StreamOption +func (x *DeleteReq_Options) GetStreamOption() isDeleteReq_Options_StreamOption { + if x != nil { + return x.StreamOption } return nil } func (x *DeleteReq_Options) GetStreamIdentifier() *shared.StreamIdentifier { - if x, ok := x.GetStreamOption().(*DeleteReq_Options_StreamIdentifier); ok { - return x.StreamIdentifier + if x != nil { + if x, ok := x.StreamOption.(*DeleteReq_Options_StreamIdentifier); ok { + return x.StreamIdentifier + } } return nil } func (x *DeleteReq_Options) GetAll() *shared.Empty { - if x, ok := x.GetStreamOption().(*DeleteReq_Options_All); ok { - return x.All + if x != nil { + if x, ok := x.StreamOption.(*DeleteReq_Options_All); ok { + return x.All + } } return nil } @@ -3217,25 +3207,22 @@ func (*DeleteReq_Options_StreamIdentifier) isDeleteReq_Options_StreamOption() {} func (*DeleteReq_Options_All) isDeleteReq_Options_StreamOption() {} type GetInfoReq_Options struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Types that are assignable to StreamOption: + state protoimpl.MessageState `protogen:"open.v1"` + // Types that are valid to be assigned to StreamOption: // // *GetInfoReq_Options_StreamIdentifier // *GetInfoReq_Options_All - StreamOption isGetInfoReq_Options_StreamOption `protobuf_oneof:"stream_option"` - GroupName string `protobuf:"bytes,3,opt,name=group_name,json=groupName,proto3" json:"group_name,omitempty"` + StreamOption isGetInfoReq_Options_StreamOption `protobuf_oneof:"stream_option"` + GroupName string `protobuf:"bytes,3,opt,name=group_name,json=groupName,proto3" json:"group_name,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *GetInfoReq_Options) Reset() { *x = GetInfoReq_Options{} - if protoimpl.UnsafeEnabled { - mi := &file_persistent_proto_msgTypes[36] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_persistent_proto_msgTypes[36] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *GetInfoReq_Options) String() string { @@ -3246,7 +3233,7 @@ func (*GetInfoReq_Options) ProtoMessage() {} func (x *GetInfoReq_Options) ProtoReflect() protoreflect.Message { mi := &file_persistent_proto_msgTypes[36] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -3261,23 +3248,27 @@ func (*GetInfoReq_Options) Descriptor() ([]byte, []int) { return file_persistent_proto_rawDescGZIP(), []int{8, 0} } -func (m *GetInfoReq_Options) GetStreamOption() isGetInfoReq_Options_StreamOption { - if m != nil { - return m.StreamOption +func (x *GetInfoReq_Options) GetStreamOption() isGetInfoReq_Options_StreamOption { + if x != nil { + return x.StreamOption } return nil } func (x *GetInfoReq_Options) GetStreamIdentifier() *shared.StreamIdentifier { - if x, ok := x.GetStreamOption().(*GetInfoReq_Options_StreamIdentifier); ok { - return x.StreamIdentifier + if x != nil { + if x, ok := x.StreamOption.(*GetInfoReq_Options_StreamIdentifier); ok { + return x.StreamIdentifier + } } return nil } func (x *GetInfoReq_Options) GetAll() *shared.Empty { - if x, ok := x.GetStreamOption().(*GetInfoReq_Options_All); ok { - return x.All + if x != nil { + if x, ok := x.StreamOption.(*GetInfoReq_Options_All); ok { + return x.All + } } return nil } @@ -3306,10 +3297,7 @@ func (*GetInfoReq_Options_StreamIdentifier) isGetInfoReq_Options_StreamOption() func (*GetInfoReq_Options_All) isGetInfoReq_Options_StreamOption() {} type SubscriptionInfo_ConnectionInfo struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - + state protoimpl.MessageState `protogen:"open.v1"` From string `protobuf:"bytes,1,opt,name=from,proto3" json:"from,omitempty"` Username string `protobuf:"bytes,2,opt,name=username,proto3" json:"username,omitempty"` AverageItemsPerSecond int32 `protobuf:"varint,3,opt,name=average_items_per_second,json=averageItemsPerSecond,proto3" json:"average_items_per_second,omitempty"` @@ -3319,15 +3307,15 @@ type SubscriptionInfo_ConnectionInfo struct { AvailableSlots int32 `protobuf:"varint,7,opt,name=available_slots,json=availableSlots,proto3" json:"available_slots,omitempty"` InFlightMessages int32 `protobuf:"varint,8,opt,name=in_flight_messages,json=inFlightMessages,proto3" json:"in_flight_messages,omitempty"` ConnectionName string `protobuf:"bytes,9,opt,name=connection_name,json=connectionName,proto3" json:"connection_name,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *SubscriptionInfo_ConnectionInfo) Reset() { *x = SubscriptionInfo_ConnectionInfo{} - if protoimpl.UnsafeEnabled { - mi := &file_persistent_proto_msgTypes[37] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_persistent_proto_msgTypes[37] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *SubscriptionInfo_ConnectionInfo) String() string { @@ -3338,7 +3326,7 @@ func (*SubscriptionInfo_ConnectionInfo) ProtoMessage() {} func (x *SubscriptionInfo_ConnectionInfo) ProtoReflect() protoreflect.Message { mi := &file_persistent_proto_msgTypes[37] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -3417,21 +3405,18 @@ func (x *SubscriptionInfo_ConnectionInfo) GetConnectionName() string { } type SubscriptionInfo_Measurement struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` + Value int64 `protobuf:"varint,2,opt,name=value,proto3" json:"value,omitempty"` unknownFields protoimpl.UnknownFields - - Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` - Value int64 `protobuf:"varint,2,opt,name=value,proto3" json:"value,omitempty"` + sizeCache protoimpl.SizeCache } func (x *SubscriptionInfo_Measurement) Reset() { *x = SubscriptionInfo_Measurement{} - if protoimpl.UnsafeEnabled { - mi := &file_persistent_proto_msgTypes[38] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_persistent_proto_msgTypes[38] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *SubscriptionInfo_Measurement) String() string { @@ -3442,7 +3427,7 @@ func (*SubscriptionInfo_Measurement) ProtoMessage() {} func (x *SubscriptionInfo_Measurement) ProtoReflect() protoreflect.Message { mi := &file_persistent_proto_msgTypes[38] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -3472,30 +3457,27 @@ func (x *SubscriptionInfo_Measurement) GetValue() int64 { } type ReplayParkedReq_Options struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - GroupName string `protobuf:"bytes,1,opt,name=group_name,json=groupName,proto3" json:"group_name,omitempty"` - // Types that are assignable to StreamOption: + state protoimpl.MessageState `protogen:"open.v1"` + GroupName string `protobuf:"bytes,1,opt,name=group_name,json=groupName,proto3" json:"group_name,omitempty"` + // Types that are valid to be assigned to StreamOption: // // *ReplayParkedReq_Options_StreamIdentifier // *ReplayParkedReq_Options_All StreamOption isReplayParkedReq_Options_StreamOption `protobuf_oneof:"stream_option"` - // Types that are assignable to StopAtOption: + // Types that are valid to be assigned to StopAtOption: // // *ReplayParkedReq_Options_StopAt // *ReplayParkedReq_Options_NoLimit - StopAtOption isReplayParkedReq_Options_StopAtOption `protobuf_oneof:"stop_at_option"` + StopAtOption isReplayParkedReq_Options_StopAtOption `protobuf_oneof:"stop_at_option"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *ReplayParkedReq_Options) Reset() { *x = ReplayParkedReq_Options{} - if protoimpl.UnsafeEnabled { - mi := &file_persistent_proto_msgTypes[39] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_persistent_proto_msgTypes[39] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *ReplayParkedReq_Options) String() string { @@ -3506,7 +3488,7 @@ func (*ReplayParkedReq_Options) ProtoMessage() {} func (x *ReplayParkedReq_Options) ProtoReflect() protoreflect.Message { mi := &file_persistent_proto_msgTypes[39] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -3528,44 +3510,52 @@ func (x *ReplayParkedReq_Options) GetGroupName() string { return "" } -func (m *ReplayParkedReq_Options) GetStreamOption() isReplayParkedReq_Options_StreamOption { - if m != nil { - return m.StreamOption +func (x *ReplayParkedReq_Options) GetStreamOption() isReplayParkedReq_Options_StreamOption { + if x != nil { + return x.StreamOption } return nil } func (x *ReplayParkedReq_Options) GetStreamIdentifier() *shared.StreamIdentifier { - if x, ok := x.GetStreamOption().(*ReplayParkedReq_Options_StreamIdentifier); ok { - return x.StreamIdentifier + if x != nil { + if x, ok := x.StreamOption.(*ReplayParkedReq_Options_StreamIdentifier); ok { + return x.StreamIdentifier + } } return nil } func (x *ReplayParkedReq_Options) GetAll() *shared.Empty { - if x, ok := x.GetStreamOption().(*ReplayParkedReq_Options_All); ok { - return x.All + if x != nil { + if x, ok := x.StreamOption.(*ReplayParkedReq_Options_All); ok { + return x.All + } } return nil } -func (m *ReplayParkedReq_Options) GetStopAtOption() isReplayParkedReq_Options_StopAtOption { - if m != nil { - return m.StopAtOption +func (x *ReplayParkedReq_Options) GetStopAtOption() isReplayParkedReq_Options_StopAtOption { + if x != nil { + return x.StopAtOption } return nil } func (x *ReplayParkedReq_Options) GetStopAt() int64 { - if x, ok := x.GetStopAtOption().(*ReplayParkedReq_Options_StopAt); ok { - return x.StopAt + if x != nil { + if x, ok := x.StopAtOption.(*ReplayParkedReq_Options_StopAt); ok { + return x.StopAt + } } return 0 } func (x *ReplayParkedReq_Options) GetNoLimit() *shared.Empty { - if x, ok := x.GetStopAtOption().(*ReplayParkedReq_Options_NoLimit); ok { - return x.NoLimit + if x != nil { + if x, ok := x.StopAtOption.(*ReplayParkedReq_Options_NoLimit); ok { + return x.NoLimit + } } return nil } @@ -3603,24 +3593,21 @@ func (*ReplayParkedReq_Options_StopAt) isReplayParkedReq_Options_StopAtOption() func (*ReplayParkedReq_Options_NoLimit) isReplayParkedReq_Options_StopAtOption() {} type ListReq_Options struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Types that are assignable to ListOption: + state protoimpl.MessageState `protogen:"open.v1"` + // Types that are valid to be assigned to ListOption: // // *ListReq_Options_ListAllSubscriptions // *ListReq_Options_ListForStream - ListOption isListReq_Options_ListOption `protobuf_oneof:"list_option"` + ListOption isListReq_Options_ListOption `protobuf_oneof:"list_option"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *ListReq_Options) Reset() { *x = ListReq_Options{} - if protoimpl.UnsafeEnabled { - mi := &file_persistent_proto_msgTypes[40] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_persistent_proto_msgTypes[40] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *ListReq_Options) String() string { @@ -3631,7 +3618,7 @@ func (*ListReq_Options) ProtoMessage() {} func (x *ListReq_Options) ProtoReflect() protoreflect.Message { mi := &file_persistent_proto_msgTypes[40] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -3646,23 +3633,27 @@ func (*ListReq_Options) Descriptor() ([]byte, []int) { return file_persistent_proto_rawDescGZIP(), []int{13, 0} } -func (m *ListReq_Options) GetListOption() isListReq_Options_ListOption { - if m != nil { - return m.ListOption +func (x *ListReq_Options) GetListOption() isListReq_Options_ListOption { + if x != nil { + return x.ListOption } return nil } func (x *ListReq_Options) GetListAllSubscriptions() *shared.Empty { - if x, ok := x.GetListOption().(*ListReq_Options_ListAllSubscriptions); ok { - return x.ListAllSubscriptions + if x != nil { + if x, ok := x.ListOption.(*ListReq_Options_ListAllSubscriptions); ok { + return x.ListAllSubscriptions + } } return nil } func (x *ListReq_Options) GetListForStream() *ListReq_StreamOption { - if x, ok := x.GetListOption().(*ListReq_Options_ListForStream); ok { - return x.ListForStream + if x != nil { + if x, ok := x.ListOption.(*ListReq_Options_ListForStream); ok { + return x.ListForStream + } } return nil } @@ -3684,24 +3675,21 @@ func (*ListReq_Options_ListAllSubscriptions) isListReq_Options_ListOption() {} func (*ListReq_Options_ListForStream) isListReq_Options_ListOption() {} type ListReq_StreamOption struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Types that are assignable to StreamOption: + state protoimpl.MessageState `protogen:"open.v1"` + // Types that are valid to be assigned to StreamOption: // // *ListReq_StreamOption_Stream // *ListReq_StreamOption_All - StreamOption isListReq_StreamOption_StreamOption `protobuf_oneof:"stream_option"` + StreamOption isListReq_StreamOption_StreamOption `protobuf_oneof:"stream_option"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *ListReq_StreamOption) Reset() { *x = ListReq_StreamOption{} - if protoimpl.UnsafeEnabled { - mi := &file_persistent_proto_msgTypes[41] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_persistent_proto_msgTypes[41] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *ListReq_StreamOption) String() string { @@ -3712,7 +3700,7 @@ func (*ListReq_StreamOption) ProtoMessage() {} func (x *ListReq_StreamOption) ProtoReflect() protoreflect.Message { mi := &file_persistent_proto_msgTypes[41] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -3727,23 +3715,27 @@ func (*ListReq_StreamOption) Descriptor() ([]byte, []int) { return file_persistent_proto_rawDescGZIP(), []int{13, 1} } -func (m *ListReq_StreamOption) GetStreamOption() isListReq_StreamOption_StreamOption { - if m != nil { - return m.StreamOption +func (x *ListReq_StreamOption) GetStreamOption() isListReq_StreamOption_StreamOption { + if x != nil { + return x.StreamOption } return nil } func (x *ListReq_StreamOption) GetStream() *shared.StreamIdentifier { - if x, ok := x.GetStreamOption().(*ListReq_StreamOption_Stream); ok { - return x.Stream + if x != nil { + if x, ok := x.StreamOption.(*ListReq_StreamOption_Stream); ok { + return x.Stream + } } return nil } func (x *ListReq_StreamOption) GetAll() *shared.Empty { - if x, ok := x.GetStreamOption().(*ListReq_StreamOption_All); ok { - return x.All + if x != nil { + if x, ok := x.StreamOption.(*ListReq_StreamOption_All); ok { + return x.All + } } return nil } @@ -3766,7 +3758,7 @@ func (*ListReq_StreamOption_All) isListReq_StreamOption_StreamOption() {} var File_persistent_proto protoreflect.FileDescriptor -var file_persistent_proto_rawDesc = []byte{ +var file_persistent_proto_rawDesc = string([]byte{ 0x0a, 0x10, 0x70, 0x65, 0x72, 0x73, 0x69, 0x73, 0x74, 0x65, 0x6e, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x2b, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x5f, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x2e, 0x70, 0x65, 0x72, 0x73, 0x69, 0x73, 0x74, 0x65, 0x6e, @@ -4511,25 +4503,25 @@ var file_persistent_proto_rawDesc = []byte{ 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x5a, 0x3f, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x2f, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x2d, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, - 0x2d, 0x47, 0x6f, 0x2f, 0x76, 0x34, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2f, 0x70, 0x65, + 0x2d, 0x47, 0x6f, 0x2f, 0x76, 0x31, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2f, 0x70, 0x65, 0x72, 0x73, 0x69, 0x73, 0x74, 0x65, 0x6e, 0x74, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} +}) var ( file_persistent_proto_rawDescOnce sync.Once - file_persistent_proto_rawDescData = file_persistent_proto_rawDesc + file_persistent_proto_rawDescData []byte ) func file_persistent_proto_rawDescGZIP() []byte { file_persistent_proto_rawDescOnce.Do(func() { - file_persistent_proto_rawDescData = protoimpl.X.CompressGZIP(file_persistent_proto_rawDescData) + file_persistent_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_persistent_proto_rawDesc), len(file_persistent_proto_rawDesc))) }) return file_persistent_proto_rawDescData } var file_persistent_proto_enumTypes = make([]protoimpl.EnumInfo, 3) var file_persistent_proto_msgTypes = make([]protoimpl.MessageInfo, 42) -var file_persistent_proto_goTypes = []interface{}{ +var file_persistent_proto_goTypes = []any{ (ReadReq_Nack_Action)(0), // 0: event_store.client.persistent_subscriptions.ReadReq.Nack.Action (CreateReq_ConsumerStrategy)(0), // 1: event_store.client.persistent_subscriptions.CreateReq.ConsumerStrategy (UpdateReq_ConsumerStrategy)(0), // 2: event_store.client.persistent_subscriptions.UpdateReq.ConsumerStrategy @@ -4676,590 +4668,96 @@ func file_persistent_proto_init() { if File_persistent_proto != nil { return } - if !protoimpl.UnsafeEnabled { - file_persistent_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ReadReq); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_persistent_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ReadResp); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_persistent_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CreateReq); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_persistent_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CreateResp); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_persistent_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*UpdateReq); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_persistent_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*UpdateResp); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_persistent_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*DeleteReq); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_persistent_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*DeleteResp); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_persistent_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetInfoReq); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_persistent_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetInfoResp); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_persistent_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SubscriptionInfo); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_persistent_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ReplayParkedReq); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_persistent_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ReplayParkedResp); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_persistent_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ListReq); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_persistent_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ListResp); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_persistent_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ReadReq_Options); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_persistent_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ReadReq_Ack); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_persistent_proto_msgTypes[17].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ReadReq_Nack); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_persistent_proto_msgTypes[18].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ReadReq_Options_UUIDOption); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_persistent_proto_msgTypes[19].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ReadResp_ReadEvent); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_persistent_proto_msgTypes[20].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ReadResp_SubscriptionConfirmation); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_persistent_proto_msgTypes[21].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ReadResp_ReadEvent_RecordedEvent); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_persistent_proto_msgTypes[23].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CreateReq_Options); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_persistent_proto_msgTypes[24].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CreateReq_StreamOptions); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_persistent_proto_msgTypes[25].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CreateReq_AllOptions); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_persistent_proto_msgTypes[26].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CreateReq_Position); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_persistent_proto_msgTypes[27].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CreateReq_Settings); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_persistent_proto_msgTypes[28].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CreateReq_AllOptions_FilterOptions); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_persistent_proto_msgTypes[29].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CreateReq_AllOptions_FilterOptions_Expression); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_persistent_proto_msgTypes[30].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*UpdateReq_Options); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_persistent_proto_msgTypes[31].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*UpdateReq_StreamOptions); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_persistent_proto_msgTypes[32].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*UpdateReq_AllOptions); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_persistent_proto_msgTypes[33].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*UpdateReq_Position); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_persistent_proto_msgTypes[34].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*UpdateReq_Settings); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_persistent_proto_msgTypes[35].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*DeleteReq_Options); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_persistent_proto_msgTypes[36].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetInfoReq_Options); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_persistent_proto_msgTypes[37].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SubscriptionInfo_ConnectionInfo); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_persistent_proto_msgTypes[38].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SubscriptionInfo_Measurement); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_persistent_proto_msgTypes[39].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ReplayParkedReq_Options); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_persistent_proto_msgTypes[40].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ListReq_Options); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_persistent_proto_msgTypes[41].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ListReq_StreamOption); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - file_persistent_proto_msgTypes[0].OneofWrappers = []interface{}{ + file_persistent_proto_msgTypes[0].OneofWrappers = []any{ (*ReadReq_Options_)(nil), (*ReadReq_Ack_)(nil), (*ReadReq_Nack_)(nil), } - file_persistent_proto_msgTypes[1].OneofWrappers = []interface{}{ + file_persistent_proto_msgTypes[1].OneofWrappers = []any{ (*ReadResp_Event)(nil), (*ReadResp_SubscriptionConfirmation_)(nil), } - file_persistent_proto_msgTypes[15].OneofWrappers = []interface{}{ + file_persistent_proto_msgTypes[15].OneofWrappers = []any{ (*ReadReq_Options_StreamIdentifier)(nil), (*ReadReq_Options_All)(nil), } - file_persistent_proto_msgTypes[18].OneofWrappers = []interface{}{ + file_persistent_proto_msgTypes[18].OneofWrappers = []any{ (*ReadReq_Options_UUIDOption_Structured)(nil), (*ReadReq_Options_UUIDOption_String_)(nil), } - file_persistent_proto_msgTypes[19].OneofWrappers = []interface{}{ + file_persistent_proto_msgTypes[19].OneofWrappers = []any{ (*ReadResp_ReadEvent_CommitPosition)(nil), (*ReadResp_ReadEvent_NoPosition)(nil), (*ReadResp_ReadEvent_RetryCount)(nil), (*ReadResp_ReadEvent_NoRetryCount)(nil), } - file_persistent_proto_msgTypes[23].OneofWrappers = []interface{}{ + file_persistent_proto_msgTypes[23].OneofWrappers = []any{ (*CreateReq_Options_Stream)(nil), (*CreateReq_Options_All)(nil), } - file_persistent_proto_msgTypes[24].OneofWrappers = []interface{}{ + file_persistent_proto_msgTypes[24].OneofWrappers = []any{ (*CreateReq_StreamOptions_Revision)(nil), (*CreateReq_StreamOptions_Start)(nil), (*CreateReq_StreamOptions_End)(nil), } - file_persistent_proto_msgTypes[25].OneofWrappers = []interface{}{ + file_persistent_proto_msgTypes[25].OneofWrappers = []any{ (*CreateReq_AllOptions_Position)(nil), (*CreateReq_AllOptions_Start)(nil), (*CreateReq_AllOptions_End)(nil), (*CreateReq_AllOptions_Filter)(nil), (*CreateReq_AllOptions_NoFilter)(nil), } - file_persistent_proto_msgTypes[27].OneofWrappers = []interface{}{ + file_persistent_proto_msgTypes[27].OneofWrappers = []any{ (*CreateReq_Settings_MessageTimeoutTicks)(nil), (*CreateReq_Settings_MessageTimeoutMs)(nil), (*CreateReq_Settings_CheckpointAfterTicks)(nil), (*CreateReq_Settings_CheckpointAfterMs)(nil), } - file_persistent_proto_msgTypes[28].OneofWrappers = []interface{}{ + file_persistent_proto_msgTypes[28].OneofWrappers = []any{ (*CreateReq_AllOptions_FilterOptions_StreamIdentifier)(nil), (*CreateReq_AllOptions_FilterOptions_EventType)(nil), (*CreateReq_AllOptions_FilterOptions_Max)(nil), (*CreateReq_AllOptions_FilterOptions_Count)(nil), } - file_persistent_proto_msgTypes[30].OneofWrappers = []interface{}{ + file_persistent_proto_msgTypes[30].OneofWrappers = []any{ (*UpdateReq_Options_Stream)(nil), (*UpdateReq_Options_All)(nil), } - file_persistent_proto_msgTypes[31].OneofWrappers = []interface{}{ + file_persistent_proto_msgTypes[31].OneofWrappers = []any{ (*UpdateReq_StreamOptions_Revision)(nil), (*UpdateReq_StreamOptions_Start)(nil), (*UpdateReq_StreamOptions_End)(nil), } - file_persistent_proto_msgTypes[32].OneofWrappers = []interface{}{ + file_persistent_proto_msgTypes[32].OneofWrappers = []any{ (*UpdateReq_AllOptions_Position)(nil), (*UpdateReq_AllOptions_Start)(nil), (*UpdateReq_AllOptions_End)(nil), } - file_persistent_proto_msgTypes[34].OneofWrappers = []interface{}{ + file_persistent_proto_msgTypes[34].OneofWrappers = []any{ (*UpdateReq_Settings_MessageTimeoutTicks)(nil), (*UpdateReq_Settings_MessageTimeoutMs)(nil), (*UpdateReq_Settings_CheckpointAfterTicks)(nil), (*UpdateReq_Settings_CheckpointAfterMs)(nil), } - file_persistent_proto_msgTypes[35].OneofWrappers = []interface{}{ + file_persistent_proto_msgTypes[35].OneofWrappers = []any{ (*DeleteReq_Options_StreamIdentifier)(nil), (*DeleteReq_Options_All)(nil), } - file_persistent_proto_msgTypes[36].OneofWrappers = []interface{}{ + file_persistent_proto_msgTypes[36].OneofWrappers = []any{ (*GetInfoReq_Options_StreamIdentifier)(nil), (*GetInfoReq_Options_All)(nil), } - file_persistent_proto_msgTypes[39].OneofWrappers = []interface{}{ + file_persistent_proto_msgTypes[39].OneofWrappers = []any{ (*ReplayParkedReq_Options_StreamIdentifier)(nil), (*ReplayParkedReq_Options_All)(nil), (*ReplayParkedReq_Options_StopAt)(nil), (*ReplayParkedReq_Options_NoLimit)(nil), } - file_persistent_proto_msgTypes[40].OneofWrappers = []interface{}{ + file_persistent_proto_msgTypes[40].OneofWrappers = []any{ (*ListReq_Options_ListAllSubscriptions)(nil), (*ListReq_Options_ListForStream)(nil), } - file_persistent_proto_msgTypes[41].OneofWrappers = []interface{}{ + file_persistent_proto_msgTypes[41].OneofWrappers = []any{ (*ListReq_StreamOption_Stream)(nil), (*ListReq_StreamOption_All)(nil), } @@ -5267,7 +4765,7 @@ func file_persistent_proto_init() { out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_persistent_proto_rawDesc, + RawDescriptor: unsafe.Slice(unsafe.StringData(file_persistent_proto_rawDesc), len(file_persistent_proto_rawDesc)), NumEnums: 3, NumMessages: 42, NumExtensions: 0, @@ -5279,7 +4777,6 @@ func file_persistent_proto_init() { MessageInfos: file_persistent_proto_msgTypes, }.Build() File_persistent_proto = out.File - file_persistent_proto_rawDesc = nil file_persistent_proto_goTypes = nil file_persistent_proto_depIdxs = nil } diff --git a/protos/persistent/persistent_grpc.pb.go b/protos/persistent/persistent_grpc.pb.go index 69bcb43b..f85d1958 100644 --- a/protos/persistent/persistent_grpc.pb.go +++ b/protos/persistent/persistent_grpc.pb.go @@ -1,14 +1,14 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.3.0 -// - protoc v3.20.0 +// - protoc-gen-go-grpc v1.5.1 +// - protoc v5.26.0 // source: persistent.proto package persistent import ( context "context" - shared "github.com/EventStore/EventStore-Client-Go/v4/protos/shared" + shared "github.com/EventStore/EventStore-Client-Go/v1/protos/shared" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" @@ -16,8 +16,8 @@ import ( // This is a compile-time assertion to ensure that this generated file // is compatible with the grpc package it is being compiled against. -// Requires gRPC-Go v1.32.0 or later. -const _ = grpc.SupportPackageIsVersion7 +// Requires gRPC-Go v1.64.0 or later. +const _ = grpc.SupportPackageIsVersion9 const ( PersistentSubscriptions_Create_FullMethodName = "/event_store.client.persistent_subscriptions.PersistentSubscriptions/Create" @@ -37,7 +37,7 @@ type PersistentSubscriptionsClient interface { Create(ctx context.Context, in *CreateReq, opts ...grpc.CallOption) (*CreateResp, error) Update(ctx context.Context, in *UpdateReq, opts ...grpc.CallOption) (*UpdateResp, error) Delete(ctx context.Context, in *DeleteReq, opts ...grpc.CallOption) (*DeleteResp, error) - Read(ctx context.Context, opts ...grpc.CallOption) (PersistentSubscriptions_ReadClient, error) + Read(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[ReadReq, ReadResp], error) GetInfo(ctx context.Context, in *GetInfoReq, opts ...grpc.CallOption) (*GetInfoResp, error) ReplayParked(ctx context.Context, in *ReplayParkedReq, opts ...grpc.CallOption) (*ReplayParkedResp, error) List(ctx context.Context, in *ListReq, opts ...grpc.CallOption) (*ListResp, error) @@ -53,8 +53,9 @@ func NewPersistentSubscriptionsClient(cc grpc.ClientConnInterface) PersistentSub } func (c *persistentSubscriptionsClient) Create(ctx context.Context, in *CreateReq, opts ...grpc.CallOption) (*CreateResp, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(CreateResp) - err := c.cc.Invoke(ctx, PersistentSubscriptions_Create_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, PersistentSubscriptions_Create_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } @@ -62,8 +63,9 @@ func (c *persistentSubscriptionsClient) Create(ctx context.Context, in *CreateRe } func (c *persistentSubscriptionsClient) Update(ctx context.Context, in *UpdateReq, opts ...grpc.CallOption) (*UpdateResp, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(UpdateResp) - err := c.cc.Invoke(ctx, PersistentSubscriptions_Update_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, PersistentSubscriptions_Update_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } @@ -71,48 +73,32 @@ func (c *persistentSubscriptionsClient) Update(ctx context.Context, in *UpdateRe } func (c *persistentSubscriptionsClient) Delete(ctx context.Context, in *DeleteReq, opts ...grpc.CallOption) (*DeleteResp, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(DeleteResp) - err := c.cc.Invoke(ctx, PersistentSubscriptions_Delete_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, PersistentSubscriptions_Delete_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } return out, nil } -func (c *persistentSubscriptionsClient) Read(ctx context.Context, opts ...grpc.CallOption) (PersistentSubscriptions_ReadClient, error) { - stream, err := c.cc.NewStream(ctx, &PersistentSubscriptions_ServiceDesc.Streams[0], PersistentSubscriptions_Read_FullMethodName, opts...) +func (c *persistentSubscriptionsClient) Read(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[ReadReq, ReadResp], error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + stream, err := c.cc.NewStream(ctx, &PersistentSubscriptions_ServiceDesc.Streams[0], PersistentSubscriptions_Read_FullMethodName, cOpts...) if err != nil { return nil, err } - x := &persistentSubscriptionsReadClient{stream} + x := &grpc.GenericClientStream[ReadReq, ReadResp]{ClientStream: stream} return x, nil } -type PersistentSubscriptions_ReadClient interface { - Send(*ReadReq) error - Recv() (*ReadResp, error) - grpc.ClientStream -} - -type persistentSubscriptionsReadClient struct { - grpc.ClientStream -} - -func (x *persistentSubscriptionsReadClient) Send(m *ReadReq) error { - return x.ClientStream.SendMsg(m) -} - -func (x *persistentSubscriptionsReadClient) Recv() (*ReadResp, error) { - m := new(ReadResp) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} +// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. +type PersistentSubscriptions_ReadClient = grpc.BidiStreamingClient[ReadReq, ReadResp] func (c *persistentSubscriptionsClient) GetInfo(ctx context.Context, in *GetInfoReq, opts ...grpc.CallOption) (*GetInfoResp, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(GetInfoResp) - err := c.cc.Invoke(ctx, PersistentSubscriptions_GetInfo_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, PersistentSubscriptions_GetInfo_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } @@ -120,8 +106,9 @@ func (c *persistentSubscriptionsClient) GetInfo(ctx context.Context, in *GetInfo } func (c *persistentSubscriptionsClient) ReplayParked(ctx context.Context, in *ReplayParkedReq, opts ...grpc.CallOption) (*ReplayParkedResp, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(ReplayParkedResp) - err := c.cc.Invoke(ctx, PersistentSubscriptions_ReplayParked_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, PersistentSubscriptions_ReplayParked_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } @@ -129,8 +116,9 @@ func (c *persistentSubscriptionsClient) ReplayParked(ctx context.Context, in *Re } func (c *persistentSubscriptionsClient) List(ctx context.Context, in *ListReq, opts ...grpc.CallOption) (*ListResp, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(ListResp) - err := c.cc.Invoke(ctx, PersistentSubscriptions_List_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, PersistentSubscriptions_List_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } @@ -138,8 +126,9 @@ func (c *persistentSubscriptionsClient) List(ctx context.Context, in *ListReq, o } func (c *persistentSubscriptionsClient) RestartSubsystem(ctx context.Context, in *shared.Empty, opts ...grpc.CallOption) (*shared.Empty, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(shared.Empty) - err := c.cc.Invoke(ctx, PersistentSubscriptions_RestartSubsystem_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, PersistentSubscriptions_RestartSubsystem_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } @@ -148,12 +137,12 @@ func (c *persistentSubscriptionsClient) RestartSubsystem(ctx context.Context, in // PersistentSubscriptionsServer is the server API for PersistentSubscriptions service. // All implementations must embed UnimplementedPersistentSubscriptionsServer -// for forward compatibility +// for forward compatibility. type PersistentSubscriptionsServer interface { Create(context.Context, *CreateReq) (*CreateResp, error) Update(context.Context, *UpdateReq) (*UpdateResp, error) Delete(context.Context, *DeleteReq) (*DeleteResp, error) - Read(PersistentSubscriptions_ReadServer) error + Read(grpc.BidiStreamingServer[ReadReq, ReadResp]) error GetInfo(context.Context, *GetInfoReq) (*GetInfoResp, error) ReplayParked(context.Context, *ReplayParkedReq) (*ReplayParkedResp, error) List(context.Context, *ListReq) (*ListResp, error) @@ -161,9 +150,12 @@ type PersistentSubscriptionsServer interface { mustEmbedUnimplementedPersistentSubscriptionsServer() } -// UnimplementedPersistentSubscriptionsServer must be embedded to have forward compatible implementations. -type UnimplementedPersistentSubscriptionsServer struct { -} +// UnimplementedPersistentSubscriptionsServer must be embedded to have +// forward compatible implementations. +// +// NOTE: this should be embedded by value instead of pointer to avoid a nil +// pointer dereference when methods are called. +type UnimplementedPersistentSubscriptionsServer struct{} func (UnimplementedPersistentSubscriptionsServer) Create(context.Context, *CreateReq) (*CreateResp, error) { return nil, status.Errorf(codes.Unimplemented, "method Create not implemented") @@ -174,7 +166,7 @@ func (UnimplementedPersistentSubscriptionsServer) Update(context.Context, *Updat func (UnimplementedPersistentSubscriptionsServer) Delete(context.Context, *DeleteReq) (*DeleteResp, error) { return nil, status.Errorf(codes.Unimplemented, "method Delete not implemented") } -func (UnimplementedPersistentSubscriptionsServer) Read(PersistentSubscriptions_ReadServer) error { +func (UnimplementedPersistentSubscriptionsServer) Read(grpc.BidiStreamingServer[ReadReq, ReadResp]) error { return status.Errorf(codes.Unimplemented, "method Read not implemented") } func (UnimplementedPersistentSubscriptionsServer) GetInfo(context.Context, *GetInfoReq) (*GetInfoResp, error) { @@ -191,6 +183,7 @@ func (UnimplementedPersistentSubscriptionsServer) RestartSubsystem(context.Conte } func (UnimplementedPersistentSubscriptionsServer) mustEmbedUnimplementedPersistentSubscriptionsServer() { } +func (UnimplementedPersistentSubscriptionsServer) testEmbeddedByValue() {} // UnsafePersistentSubscriptionsServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to PersistentSubscriptionsServer will @@ -200,6 +193,13 @@ type UnsafePersistentSubscriptionsServer interface { } func RegisterPersistentSubscriptionsServer(s grpc.ServiceRegistrar, srv PersistentSubscriptionsServer) { + // If the following call pancis, it indicates UnimplementedPersistentSubscriptionsServer was + // embedded by pointer and is nil. This will cause panics if an + // unimplemented method is ever invoked, so we test this at initialization + // time to prevent it from happening at runtime later due to I/O. + if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { + t.testEmbeddedByValue() + } s.RegisterService(&PersistentSubscriptions_ServiceDesc, srv) } @@ -258,30 +258,11 @@ func _PersistentSubscriptions_Delete_Handler(srv interface{}, ctx context.Contex } func _PersistentSubscriptions_Read_Handler(srv interface{}, stream grpc.ServerStream) error { - return srv.(PersistentSubscriptionsServer).Read(&persistentSubscriptionsReadServer{stream}) -} - -type PersistentSubscriptions_ReadServer interface { - Send(*ReadResp) error - Recv() (*ReadReq, error) - grpc.ServerStream -} - -type persistentSubscriptionsReadServer struct { - grpc.ServerStream + return srv.(PersistentSubscriptionsServer).Read(&grpc.GenericServerStream[ReadReq, ReadResp]{ServerStream: stream}) } -func (x *persistentSubscriptionsReadServer) Send(m *ReadResp) error { - return x.ServerStream.SendMsg(m) -} - -func (x *persistentSubscriptionsReadServer) Recv() (*ReadReq, error) { - m := new(ReadReq) - if err := x.ServerStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} +// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. +type PersistentSubscriptions_ReadServer = grpc.BidiStreamingServer[ReadReq, ReadResp] func _PersistentSubscriptions_GetInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(GetInfoReq) diff --git a/protos/projections.proto b/protos/projections.proto index cc03986e..1d2800b8 100644 --- a/protos/projections.proto +++ b/protos/projections.proto @@ -1,7 +1,7 @@ syntax = "proto3"; package event_store.client.projections; option java_package = "com.eventstore.dbclient.proto.projections"; -option go_package = "github.com/EventStore/EventStore-Client-Go/v4/protos/projections"; +option go_package = "github.com/EventStore/EventStore-Client-Go/v1/protos/projections"; import "google/protobuf/struct.proto"; import "shared.proto"; diff --git a/protos/projections/projections.pb.go b/protos/projections/projections.pb.go index 2d3cff30..67a54c63 100644 --- a/protos/projections/projections.pb.go +++ b/protos/projections/projections.pb.go @@ -1,18 +1,19 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.33.0 -// protoc v3.20.0 +// protoc-gen-go v1.36.5 +// protoc v5.26.0 // source: projections.proto package projections import ( - shared "github.com/EventStore/EventStore-Client-Go/v4/protos/shared" + shared "github.com/EventStore/EventStore-Client-Go/v1/protos/shared" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" structpb "google.golang.org/protobuf/types/known/structpb" reflect "reflect" sync "sync" + unsafe "unsafe" ) const ( @@ -23,20 +24,17 @@ const ( ) type CreateReq struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Options *CreateReq_Options `protobuf:"bytes,1,opt,name=options,proto3" json:"options,omitempty"` unknownFields protoimpl.UnknownFields - - Options *CreateReq_Options `protobuf:"bytes,1,opt,name=options,proto3" json:"options,omitempty"` + sizeCache protoimpl.SizeCache } func (x *CreateReq) Reset() { *x = CreateReq{} - if protoimpl.UnsafeEnabled { - mi := &file_projections_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_projections_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *CreateReq) String() string { @@ -47,7 +45,7 @@ func (*CreateReq) ProtoMessage() {} func (x *CreateReq) ProtoReflect() protoreflect.Message { mi := &file_projections_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -70,18 +68,16 @@ func (x *CreateReq) GetOptions() *CreateReq_Options { } type CreateResp struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *CreateResp) Reset() { *x = CreateResp{} - if protoimpl.UnsafeEnabled { - mi := &file_projections_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_projections_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *CreateResp) String() string { @@ -92,7 +88,7 @@ func (*CreateResp) ProtoMessage() {} func (x *CreateResp) ProtoReflect() protoreflect.Message { mi := &file_projections_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -108,20 +104,17 @@ func (*CreateResp) Descriptor() ([]byte, []int) { } type UpdateReq struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Options *UpdateReq_Options `protobuf:"bytes,1,opt,name=options,proto3" json:"options,omitempty"` unknownFields protoimpl.UnknownFields - - Options *UpdateReq_Options `protobuf:"bytes,1,opt,name=options,proto3" json:"options,omitempty"` + sizeCache protoimpl.SizeCache } func (x *UpdateReq) Reset() { *x = UpdateReq{} - if protoimpl.UnsafeEnabled { - mi := &file_projections_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_projections_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *UpdateReq) String() string { @@ -132,7 +125,7 @@ func (*UpdateReq) ProtoMessage() {} func (x *UpdateReq) ProtoReflect() protoreflect.Message { mi := &file_projections_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -155,18 +148,16 @@ func (x *UpdateReq) GetOptions() *UpdateReq_Options { } type UpdateResp struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *UpdateResp) Reset() { *x = UpdateResp{} - if protoimpl.UnsafeEnabled { - mi := &file_projections_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_projections_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *UpdateResp) String() string { @@ -177,7 +168,7 @@ func (*UpdateResp) ProtoMessage() {} func (x *UpdateResp) ProtoReflect() protoreflect.Message { mi := &file_projections_proto_msgTypes[3] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -193,20 +184,17 @@ func (*UpdateResp) Descriptor() ([]byte, []int) { } type DeleteReq struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Options *DeleteReq_Options `protobuf:"bytes,1,opt,name=options,proto3" json:"options,omitempty"` unknownFields protoimpl.UnknownFields - - Options *DeleteReq_Options `protobuf:"bytes,1,opt,name=options,proto3" json:"options,omitempty"` + sizeCache protoimpl.SizeCache } func (x *DeleteReq) Reset() { *x = DeleteReq{} - if protoimpl.UnsafeEnabled { - mi := &file_projections_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_projections_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *DeleteReq) String() string { @@ -217,7 +205,7 @@ func (*DeleteReq) ProtoMessage() {} func (x *DeleteReq) ProtoReflect() protoreflect.Message { mi := &file_projections_proto_msgTypes[4] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -240,18 +228,16 @@ func (x *DeleteReq) GetOptions() *DeleteReq_Options { } type DeleteResp struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *DeleteResp) Reset() { *x = DeleteResp{} - if protoimpl.UnsafeEnabled { - mi := &file_projections_proto_msgTypes[5] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_projections_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *DeleteResp) String() string { @@ -262,7 +248,7 @@ func (*DeleteResp) ProtoMessage() {} func (x *DeleteResp) ProtoReflect() protoreflect.Message { mi := &file_projections_proto_msgTypes[5] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -278,20 +264,17 @@ func (*DeleteResp) Descriptor() ([]byte, []int) { } type StatisticsReq struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Options *StatisticsReq_Options `protobuf:"bytes,1,opt,name=options,proto3" json:"options,omitempty"` unknownFields protoimpl.UnknownFields - - Options *StatisticsReq_Options `protobuf:"bytes,1,opt,name=options,proto3" json:"options,omitempty"` + sizeCache protoimpl.SizeCache } func (x *StatisticsReq) Reset() { *x = StatisticsReq{} - if protoimpl.UnsafeEnabled { - mi := &file_projections_proto_msgTypes[6] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_projections_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *StatisticsReq) String() string { @@ -302,7 +285,7 @@ func (*StatisticsReq) ProtoMessage() {} func (x *StatisticsReq) ProtoReflect() protoreflect.Message { mi := &file_projections_proto_msgTypes[6] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -325,20 +308,17 @@ func (x *StatisticsReq) GetOptions() *StatisticsReq_Options { } type StatisticsResp struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Details *StatisticsResp_Details `protobuf:"bytes,1,opt,name=details,proto3" json:"details,omitempty"` unknownFields protoimpl.UnknownFields - - Details *StatisticsResp_Details `protobuf:"bytes,1,opt,name=details,proto3" json:"details,omitempty"` + sizeCache protoimpl.SizeCache } func (x *StatisticsResp) Reset() { *x = StatisticsResp{} - if protoimpl.UnsafeEnabled { - mi := &file_projections_proto_msgTypes[7] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_projections_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *StatisticsResp) String() string { @@ -349,7 +329,7 @@ func (*StatisticsResp) ProtoMessage() {} func (x *StatisticsResp) ProtoReflect() protoreflect.Message { mi := &file_projections_proto_msgTypes[7] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -372,20 +352,17 @@ func (x *StatisticsResp) GetDetails() *StatisticsResp_Details { } type StateReq struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Options *StateReq_Options `protobuf:"bytes,1,opt,name=options,proto3" json:"options,omitempty"` unknownFields protoimpl.UnknownFields - - Options *StateReq_Options `protobuf:"bytes,1,opt,name=options,proto3" json:"options,omitempty"` + sizeCache protoimpl.SizeCache } func (x *StateReq) Reset() { *x = StateReq{} - if protoimpl.UnsafeEnabled { - mi := &file_projections_proto_msgTypes[8] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_projections_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *StateReq) String() string { @@ -396,7 +373,7 @@ func (*StateReq) ProtoMessage() {} func (x *StateReq) ProtoReflect() protoreflect.Message { mi := &file_projections_proto_msgTypes[8] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -419,20 +396,17 @@ func (x *StateReq) GetOptions() *StateReq_Options { } type StateResp struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + State *structpb.Value `protobuf:"bytes,1,opt,name=state,proto3" json:"state,omitempty"` unknownFields protoimpl.UnknownFields - - State *structpb.Value `protobuf:"bytes,1,opt,name=state,proto3" json:"state,omitempty"` + sizeCache protoimpl.SizeCache } func (x *StateResp) Reset() { *x = StateResp{} - if protoimpl.UnsafeEnabled { - mi := &file_projections_proto_msgTypes[9] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_projections_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *StateResp) String() string { @@ -443,7 +417,7 @@ func (*StateResp) ProtoMessage() {} func (x *StateResp) ProtoReflect() protoreflect.Message { mi := &file_projections_proto_msgTypes[9] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -466,20 +440,17 @@ func (x *StateResp) GetState() *structpb.Value { } type ResultReq struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Options *ResultReq_Options `protobuf:"bytes,1,opt,name=options,proto3" json:"options,omitempty"` unknownFields protoimpl.UnknownFields - - Options *ResultReq_Options `protobuf:"bytes,1,opt,name=options,proto3" json:"options,omitempty"` + sizeCache protoimpl.SizeCache } func (x *ResultReq) Reset() { *x = ResultReq{} - if protoimpl.UnsafeEnabled { - mi := &file_projections_proto_msgTypes[10] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_projections_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *ResultReq) String() string { @@ -490,7 +461,7 @@ func (*ResultReq) ProtoMessage() {} func (x *ResultReq) ProtoReflect() protoreflect.Message { mi := &file_projections_proto_msgTypes[10] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -513,20 +484,17 @@ func (x *ResultReq) GetOptions() *ResultReq_Options { } type ResultResp struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Result *structpb.Value `protobuf:"bytes,1,opt,name=result,proto3" json:"result,omitempty"` unknownFields protoimpl.UnknownFields - - Result *structpb.Value `protobuf:"bytes,1,opt,name=result,proto3" json:"result,omitempty"` + sizeCache protoimpl.SizeCache } func (x *ResultResp) Reset() { *x = ResultResp{} - if protoimpl.UnsafeEnabled { - mi := &file_projections_proto_msgTypes[11] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_projections_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *ResultResp) String() string { @@ -537,7 +505,7 @@ func (*ResultResp) ProtoMessage() {} func (x *ResultResp) ProtoReflect() protoreflect.Message { mi := &file_projections_proto_msgTypes[11] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -560,20 +528,17 @@ func (x *ResultResp) GetResult() *structpb.Value { } type ResetReq struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Options *ResetReq_Options `protobuf:"bytes,1,opt,name=options,proto3" json:"options,omitempty"` unknownFields protoimpl.UnknownFields - - Options *ResetReq_Options `protobuf:"bytes,1,opt,name=options,proto3" json:"options,omitempty"` + sizeCache protoimpl.SizeCache } func (x *ResetReq) Reset() { *x = ResetReq{} - if protoimpl.UnsafeEnabled { - mi := &file_projections_proto_msgTypes[12] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_projections_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *ResetReq) String() string { @@ -584,7 +549,7 @@ func (*ResetReq) ProtoMessage() {} func (x *ResetReq) ProtoReflect() protoreflect.Message { mi := &file_projections_proto_msgTypes[12] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -607,18 +572,16 @@ func (x *ResetReq) GetOptions() *ResetReq_Options { } type ResetResp struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *ResetResp) Reset() { *x = ResetResp{} - if protoimpl.UnsafeEnabled { - mi := &file_projections_proto_msgTypes[13] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_projections_proto_msgTypes[13] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *ResetResp) String() string { @@ -629,7 +592,7 @@ func (*ResetResp) ProtoMessage() {} func (x *ResetResp) ProtoReflect() protoreflect.Message { mi := &file_projections_proto_msgTypes[13] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -645,20 +608,17 @@ func (*ResetResp) Descriptor() ([]byte, []int) { } type EnableReq struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Options *EnableReq_Options `protobuf:"bytes,1,opt,name=options,proto3" json:"options,omitempty"` unknownFields protoimpl.UnknownFields - - Options *EnableReq_Options `protobuf:"bytes,1,opt,name=options,proto3" json:"options,omitempty"` + sizeCache protoimpl.SizeCache } func (x *EnableReq) Reset() { *x = EnableReq{} - if protoimpl.UnsafeEnabled { - mi := &file_projections_proto_msgTypes[14] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_projections_proto_msgTypes[14] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *EnableReq) String() string { @@ -669,7 +629,7 @@ func (*EnableReq) ProtoMessage() {} func (x *EnableReq) ProtoReflect() protoreflect.Message { mi := &file_projections_proto_msgTypes[14] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -692,18 +652,16 @@ func (x *EnableReq) GetOptions() *EnableReq_Options { } type EnableResp struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *EnableResp) Reset() { *x = EnableResp{} - if protoimpl.UnsafeEnabled { - mi := &file_projections_proto_msgTypes[15] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_projections_proto_msgTypes[15] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *EnableResp) String() string { @@ -714,7 +672,7 @@ func (*EnableResp) ProtoMessage() {} func (x *EnableResp) ProtoReflect() protoreflect.Message { mi := &file_projections_proto_msgTypes[15] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -730,20 +688,17 @@ func (*EnableResp) Descriptor() ([]byte, []int) { } type DisableReq struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Options *DisableReq_Options `protobuf:"bytes,1,opt,name=options,proto3" json:"options,omitempty"` unknownFields protoimpl.UnknownFields - - Options *DisableReq_Options `protobuf:"bytes,1,opt,name=options,proto3" json:"options,omitempty"` + sizeCache protoimpl.SizeCache } func (x *DisableReq) Reset() { *x = DisableReq{} - if protoimpl.UnsafeEnabled { - mi := &file_projections_proto_msgTypes[16] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_projections_proto_msgTypes[16] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *DisableReq) String() string { @@ -754,7 +709,7 @@ func (*DisableReq) ProtoMessage() {} func (x *DisableReq) ProtoReflect() protoreflect.Message { mi := &file_projections_proto_msgTypes[16] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -777,18 +732,16 @@ func (x *DisableReq) GetOptions() *DisableReq_Options { } type DisableResp struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *DisableResp) Reset() { *x = DisableResp{} - if protoimpl.UnsafeEnabled { - mi := &file_projections_proto_msgTypes[17] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_projections_proto_msgTypes[17] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *DisableResp) String() string { @@ -799,7 +752,7 @@ func (*DisableResp) ProtoMessage() {} func (x *DisableResp) ProtoReflect() protoreflect.Message { mi := &file_projections_proto_msgTypes[17] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -815,26 +768,23 @@ func (*DisableResp) Descriptor() ([]byte, []int) { } type CreateReq_Options struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Types that are assignable to Mode: + state protoimpl.MessageState `protogen:"open.v1"` + // Types that are valid to be assigned to Mode: // // *CreateReq_Options_OneTime // *CreateReq_Options_Transient_ // *CreateReq_Options_Continuous_ - Mode isCreateReq_Options_Mode `protobuf_oneof:"mode"` - Query string `protobuf:"bytes,4,opt,name=query,proto3" json:"query,omitempty"` + Mode isCreateReq_Options_Mode `protobuf_oneof:"mode"` + Query string `protobuf:"bytes,4,opt,name=query,proto3" json:"query,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *CreateReq_Options) Reset() { *x = CreateReq_Options{} - if protoimpl.UnsafeEnabled { - mi := &file_projections_proto_msgTypes[18] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_projections_proto_msgTypes[18] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *CreateReq_Options) String() string { @@ -845,7 +795,7 @@ func (*CreateReq_Options) ProtoMessage() {} func (x *CreateReq_Options) ProtoReflect() protoreflect.Message { mi := &file_projections_proto_msgTypes[18] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -860,30 +810,36 @@ func (*CreateReq_Options) Descriptor() ([]byte, []int) { return file_projections_proto_rawDescGZIP(), []int{0, 0} } -func (m *CreateReq_Options) GetMode() isCreateReq_Options_Mode { - if m != nil { - return m.Mode +func (x *CreateReq_Options) GetMode() isCreateReq_Options_Mode { + if x != nil { + return x.Mode } return nil } func (x *CreateReq_Options) GetOneTime() *shared.Empty { - if x, ok := x.GetMode().(*CreateReq_Options_OneTime); ok { - return x.OneTime + if x != nil { + if x, ok := x.Mode.(*CreateReq_Options_OneTime); ok { + return x.OneTime + } } return nil } func (x *CreateReq_Options) GetTransient() *CreateReq_Options_Transient { - if x, ok := x.GetMode().(*CreateReq_Options_Transient_); ok { - return x.Transient + if x != nil { + if x, ok := x.Mode.(*CreateReq_Options_Transient_); ok { + return x.Transient + } } return nil } func (x *CreateReq_Options) GetContinuous() *CreateReq_Options_Continuous { - if x, ok := x.GetMode().(*CreateReq_Options_Continuous_); ok { - return x.Continuous + if x != nil { + if x, ok := x.Mode.(*CreateReq_Options_Continuous_); ok { + return x.Continuous + } } return nil } @@ -918,20 +874,17 @@ func (*CreateReq_Options_Transient_) isCreateReq_Options_Mode() {} func (*CreateReq_Options_Continuous_) isCreateReq_Options_Mode() {} type CreateReq_Options_Transient struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` unknownFields protoimpl.UnknownFields - - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + sizeCache protoimpl.SizeCache } func (x *CreateReq_Options_Transient) Reset() { *x = CreateReq_Options_Transient{} - if protoimpl.UnsafeEnabled { - mi := &file_projections_proto_msgTypes[19] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_projections_proto_msgTypes[19] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *CreateReq_Options_Transient) String() string { @@ -942,7 +895,7 @@ func (*CreateReq_Options_Transient) ProtoMessage() {} func (x *CreateReq_Options_Transient) ProtoReflect() protoreflect.Message { mi := &file_projections_proto_msgTypes[19] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -965,22 +918,19 @@ func (x *CreateReq_Options_Transient) GetName() string { } type CreateReq_Options_Continuous struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - EmitEnabled bool `protobuf:"varint,2,opt,name=emit_enabled,json=emitEnabled,proto3" json:"emit_enabled,omitempty"` - TrackEmittedStreams bool `protobuf:"varint,3,opt,name=track_emitted_streams,json=trackEmittedStreams,proto3" json:"track_emitted_streams,omitempty"` + state protoimpl.MessageState `protogen:"open.v1"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + EmitEnabled bool `protobuf:"varint,2,opt,name=emit_enabled,json=emitEnabled,proto3" json:"emit_enabled,omitempty"` + TrackEmittedStreams bool `protobuf:"varint,3,opt,name=track_emitted_streams,json=trackEmittedStreams,proto3" json:"track_emitted_streams,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *CreateReq_Options_Continuous) Reset() { *x = CreateReq_Options_Continuous{} - if protoimpl.UnsafeEnabled { - mi := &file_projections_proto_msgTypes[20] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_projections_proto_msgTypes[20] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *CreateReq_Options_Continuous) String() string { @@ -991,7 +941,7 @@ func (*CreateReq_Options_Continuous) ProtoMessage() {} func (x *CreateReq_Options_Continuous) ProtoReflect() protoreflect.Message { mi := &file_projections_proto_msgTypes[20] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -1028,26 +978,23 @@ func (x *CreateReq_Options_Continuous) GetTrackEmittedStreams() bool { } type UpdateReq_Options struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - Query string `protobuf:"bytes,2,opt,name=query,proto3" json:"query,omitempty"` - // Types that are assignable to EmitOption: + state protoimpl.MessageState `protogen:"open.v1"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Query string `protobuf:"bytes,2,opt,name=query,proto3" json:"query,omitempty"` + // Types that are valid to be assigned to EmitOption: // // *UpdateReq_Options_EmitEnabled // *UpdateReq_Options_NoEmitOptions - EmitOption isUpdateReq_Options_EmitOption `protobuf_oneof:"emit_option"` + EmitOption isUpdateReq_Options_EmitOption `protobuf_oneof:"emit_option"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *UpdateReq_Options) Reset() { *x = UpdateReq_Options{} - if protoimpl.UnsafeEnabled { - mi := &file_projections_proto_msgTypes[21] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_projections_proto_msgTypes[21] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *UpdateReq_Options) String() string { @@ -1058,7 +1005,7 @@ func (*UpdateReq_Options) ProtoMessage() {} func (x *UpdateReq_Options) ProtoReflect() protoreflect.Message { mi := &file_projections_proto_msgTypes[21] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -1087,23 +1034,27 @@ func (x *UpdateReq_Options) GetQuery() string { return "" } -func (m *UpdateReq_Options) GetEmitOption() isUpdateReq_Options_EmitOption { - if m != nil { - return m.EmitOption +func (x *UpdateReq_Options) GetEmitOption() isUpdateReq_Options_EmitOption { + if x != nil { + return x.EmitOption } return nil } func (x *UpdateReq_Options) GetEmitEnabled() bool { - if x, ok := x.GetEmitOption().(*UpdateReq_Options_EmitEnabled); ok { - return x.EmitEnabled + if x != nil { + if x, ok := x.EmitOption.(*UpdateReq_Options_EmitEnabled); ok { + return x.EmitEnabled + } } return false } func (x *UpdateReq_Options) GetNoEmitOptions() *shared.Empty { - if x, ok := x.GetEmitOption().(*UpdateReq_Options_NoEmitOptions); ok { - return x.NoEmitOptions + if x != nil { + if x, ok := x.EmitOption.(*UpdateReq_Options_NoEmitOptions); ok { + return x.NoEmitOptions + } } return nil } @@ -1125,23 +1076,20 @@ func (*UpdateReq_Options_EmitEnabled) isUpdateReq_Options_EmitOption() {} func (*UpdateReq_Options_NoEmitOptions) isUpdateReq_Options_EmitOption() {} type DeleteReq_Options struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - DeleteEmittedStreams bool `protobuf:"varint,2,opt,name=delete_emitted_streams,json=deleteEmittedStreams,proto3" json:"delete_emitted_streams,omitempty"` - DeleteStateStream bool `protobuf:"varint,3,opt,name=delete_state_stream,json=deleteStateStream,proto3" json:"delete_state_stream,omitempty"` - DeleteCheckpointStream bool `protobuf:"varint,4,opt,name=delete_checkpoint_stream,json=deleteCheckpointStream,proto3" json:"delete_checkpoint_stream,omitempty"` + state protoimpl.MessageState `protogen:"open.v1"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + DeleteEmittedStreams bool `protobuf:"varint,2,opt,name=delete_emitted_streams,json=deleteEmittedStreams,proto3" json:"delete_emitted_streams,omitempty"` + DeleteStateStream bool `protobuf:"varint,3,opt,name=delete_state_stream,json=deleteStateStream,proto3" json:"delete_state_stream,omitempty"` + DeleteCheckpointStream bool `protobuf:"varint,4,opt,name=delete_checkpoint_stream,json=deleteCheckpointStream,proto3" json:"delete_checkpoint_stream,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *DeleteReq_Options) Reset() { *x = DeleteReq_Options{} - if protoimpl.UnsafeEnabled { - mi := &file_projections_proto_msgTypes[22] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_projections_proto_msgTypes[22] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *DeleteReq_Options) String() string { @@ -1152,7 +1100,7 @@ func (*DeleteReq_Options) ProtoMessage() {} func (x *DeleteReq_Options) ProtoReflect() protoreflect.Message { mi := &file_projections_proto_msgTypes[22] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -1196,27 +1144,24 @@ func (x *DeleteReq_Options) GetDeleteCheckpointStream() bool { } type StatisticsReq_Options struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Types that are assignable to Mode: + state protoimpl.MessageState `protogen:"open.v1"` + // Types that are valid to be assigned to Mode: // // *StatisticsReq_Options_Name // *StatisticsReq_Options_All // *StatisticsReq_Options_Transient // *StatisticsReq_Options_Continuous // *StatisticsReq_Options_OneTime - Mode isStatisticsReq_Options_Mode `protobuf_oneof:"mode"` + Mode isStatisticsReq_Options_Mode `protobuf_oneof:"mode"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *StatisticsReq_Options) Reset() { *x = StatisticsReq_Options{} - if protoimpl.UnsafeEnabled { - mi := &file_projections_proto_msgTypes[23] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_projections_proto_msgTypes[23] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *StatisticsReq_Options) String() string { @@ -1227,7 +1172,7 @@ func (*StatisticsReq_Options) ProtoMessage() {} func (x *StatisticsReq_Options) ProtoReflect() protoreflect.Message { mi := &file_projections_proto_msgTypes[23] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -1242,44 +1187,54 @@ func (*StatisticsReq_Options) Descriptor() ([]byte, []int) { return file_projections_proto_rawDescGZIP(), []int{6, 0} } -func (m *StatisticsReq_Options) GetMode() isStatisticsReq_Options_Mode { - if m != nil { - return m.Mode +func (x *StatisticsReq_Options) GetMode() isStatisticsReq_Options_Mode { + if x != nil { + return x.Mode } return nil } func (x *StatisticsReq_Options) GetName() string { - if x, ok := x.GetMode().(*StatisticsReq_Options_Name); ok { - return x.Name + if x != nil { + if x, ok := x.Mode.(*StatisticsReq_Options_Name); ok { + return x.Name + } } return "" } func (x *StatisticsReq_Options) GetAll() *shared.Empty { - if x, ok := x.GetMode().(*StatisticsReq_Options_All); ok { - return x.All + if x != nil { + if x, ok := x.Mode.(*StatisticsReq_Options_All); ok { + return x.All + } } return nil } func (x *StatisticsReq_Options) GetTransient() *shared.Empty { - if x, ok := x.GetMode().(*StatisticsReq_Options_Transient); ok { - return x.Transient + if x != nil { + if x, ok := x.Mode.(*StatisticsReq_Options_Transient); ok { + return x.Transient + } } return nil } func (x *StatisticsReq_Options) GetContinuous() *shared.Empty { - if x, ok := x.GetMode().(*StatisticsReq_Options_Continuous); ok { - return x.Continuous + if x != nil { + if x, ok := x.Mode.(*StatisticsReq_Options_Continuous); ok { + return x.Continuous + } } return nil } func (x *StatisticsReq_Options) GetOneTime() *shared.Empty { - if x, ok := x.GetMode().(*StatisticsReq_Options_OneTime); ok { - return x.OneTime + if x != nil { + if x, ok := x.Mode.(*StatisticsReq_Options_OneTime); ok { + return x.OneTime + } } return nil } @@ -1319,38 +1274,35 @@ func (*StatisticsReq_Options_Continuous) isStatisticsReq_Options_Mode() {} func (*StatisticsReq_Options_OneTime) isStatisticsReq_Options_Mode() {} type StatisticsResp_Details struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - CoreProcessingTime int64 `protobuf:"varint,1,opt,name=coreProcessingTime,proto3" json:"coreProcessingTime,omitempty"` - Version int64 `protobuf:"varint,2,opt,name=version,proto3" json:"version,omitempty"` - Epoch int64 `protobuf:"varint,3,opt,name=epoch,proto3" json:"epoch,omitempty"` - EffectiveName string `protobuf:"bytes,4,opt,name=effectiveName,proto3" json:"effectiveName,omitempty"` - WritesInProgress int32 `protobuf:"varint,5,opt,name=writesInProgress,proto3" json:"writesInProgress,omitempty"` - ReadsInProgress int32 `protobuf:"varint,6,opt,name=readsInProgress,proto3" json:"readsInProgress,omitempty"` - PartitionsCached int32 `protobuf:"varint,7,opt,name=partitionsCached,proto3" json:"partitionsCached,omitempty"` - Status string `protobuf:"bytes,8,opt,name=status,proto3" json:"status,omitempty"` - StateReason string `protobuf:"bytes,9,opt,name=stateReason,proto3" json:"stateReason,omitempty"` - Name string `protobuf:"bytes,10,opt,name=name,proto3" json:"name,omitempty"` - Mode string `protobuf:"bytes,11,opt,name=mode,proto3" json:"mode,omitempty"` - Position string `protobuf:"bytes,12,opt,name=position,proto3" json:"position,omitempty"` - Progress float32 `protobuf:"fixed32,13,opt,name=progress,proto3" json:"progress,omitempty"` - LastCheckpoint string `protobuf:"bytes,14,opt,name=lastCheckpoint,proto3" json:"lastCheckpoint,omitempty"` - EventsProcessedAfterRestart int64 `protobuf:"varint,15,opt,name=eventsProcessedAfterRestart,proto3" json:"eventsProcessedAfterRestart,omitempty"` - CheckpointStatus string `protobuf:"bytes,16,opt,name=checkpointStatus,proto3" json:"checkpointStatus,omitempty"` - BufferedEvents int64 `protobuf:"varint,17,opt,name=bufferedEvents,proto3" json:"bufferedEvents,omitempty"` - WritePendingEventsBeforeCheckpoint int32 `protobuf:"varint,18,opt,name=writePendingEventsBeforeCheckpoint,proto3" json:"writePendingEventsBeforeCheckpoint,omitempty"` - WritePendingEventsAfterCheckpoint int32 `protobuf:"varint,19,opt,name=writePendingEventsAfterCheckpoint,proto3" json:"writePendingEventsAfterCheckpoint,omitempty"` + state protoimpl.MessageState `protogen:"open.v1"` + CoreProcessingTime int64 `protobuf:"varint,1,opt,name=coreProcessingTime,proto3" json:"coreProcessingTime,omitempty"` + Version int64 `protobuf:"varint,2,opt,name=version,proto3" json:"version,omitempty"` + Epoch int64 `protobuf:"varint,3,opt,name=epoch,proto3" json:"epoch,omitempty"` + EffectiveName string `protobuf:"bytes,4,opt,name=effectiveName,proto3" json:"effectiveName,omitempty"` + WritesInProgress int32 `protobuf:"varint,5,opt,name=writesInProgress,proto3" json:"writesInProgress,omitempty"` + ReadsInProgress int32 `protobuf:"varint,6,opt,name=readsInProgress,proto3" json:"readsInProgress,omitempty"` + PartitionsCached int32 `protobuf:"varint,7,opt,name=partitionsCached,proto3" json:"partitionsCached,omitempty"` + Status string `protobuf:"bytes,8,opt,name=status,proto3" json:"status,omitempty"` + StateReason string `protobuf:"bytes,9,opt,name=stateReason,proto3" json:"stateReason,omitempty"` + Name string `protobuf:"bytes,10,opt,name=name,proto3" json:"name,omitempty"` + Mode string `protobuf:"bytes,11,opt,name=mode,proto3" json:"mode,omitempty"` + Position string `protobuf:"bytes,12,opt,name=position,proto3" json:"position,omitempty"` + Progress float32 `protobuf:"fixed32,13,opt,name=progress,proto3" json:"progress,omitempty"` + LastCheckpoint string `protobuf:"bytes,14,opt,name=lastCheckpoint,proto3" json:"lastCheckpoint,omitempty"` + EventsProcessedAfterRestart int64 `protobuf:"varint,15,opt,name=eventsProcessedAfterRestart,proto3" json:"eventsProcessedAfterRestart,omitempty"` + CheckpointStatus string `protobuf:"bytes,16,opt,name=checkpointStatus,proto3" json:"checkpointStatus,omitempty"` + BufferedEvents int64 `protobuf:"varint,17,opt,name=bufferedEvents,proto3" json:"bufferedEvents,omitempty"` + WritePendingEventsBeforeCheckpoint int32 `protobuf:"varint,18,opt,name=writePendingEventsBeforeCheckpoint,proto3" json:"writePendingEventsBeforeCheckpoint,omitempty"` + WritePendingEventsAfterCheckpoint int32 `protobuf:"varint,19,opt,name=writePendingEventsAfterCheckpoint,proto3" json:"writePendingEventsAfterCheckpoint,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *StatisticsResp_Details) Reset() { *x = StatisticsResp_Details{} - if protoimpl.UnsafeEnabled { - mi := &file_projections_proto_msgTypes[24] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_projections_proto_msgTypes[24] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *StatisticsResp_Details) String() string { @@ -1361,7 +1313,7 @@ func (*StatisticsResp_Details) ProtoMessage() {} func (x *StatisticsResp_Details) ProtoReflect() protoreflect.Message { mi := &file_projections_proto_msgTypes[24] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -1510,21 +1462,18 @@ func (x *StatisticsResp_Details) GetWritePendingEventsAfterCheckpoint() int32 { } type StateReq_Options struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Partition string `protobuf:"bytes,2,opt,name=partition,proto3" json:"partition,omitempty"` unknownFields protoimpl.UnknownFields - - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - Partition string `protobuf:"bytes,2,opt,name=partition,proto3" json:"partition,omitempty"` + sizeCache protoimpl.SizeCache } func (x *StateReq_Options) Reset() { *x = StateReq_Options{} - if protoimpl.UnsafeEnabled { - mi := &file_projections_proto_msgTypes[25] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_projections_proto_msgTypes[25] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *StateReq_Options) String() string { @@ -1535,7 +1484,7 @@ func (*StateReq_Options) ProtoMessage() {} func (x *StateReq_Options) ProtoReflect() protoreflect.Message { mi := &file_projections_proto_msgTypes[25] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -1565,21 +1514,18 @@ func (x *StateReq_Options) GetPartition() string { } type ResultReq_Options struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Partition string `protobuf:"bytes,2,opt,name=partition,proto3" json:"partition,omitempty"` unknownFields protoimpl.UnknownFields - - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - Partition string `protobuf:"bytes,2,opt,name=partition,proto3" json:"partition,omitempty"` + sizeCache protoimpl.SizeCache } func (x *ResultReq_Options) Reset() { *x = ResultReq_Options{} - if protoimpl.UnsafeEnabled { - mi := &file_projections_proto_msgTypes[26] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_projections_proto_msgTypes[26] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *ResultReq_Options) String() string { @@ -1590,7 +1536,7 @@ func (*ResultReq_Options) ProtoMessage() {} func (x *ResultReq_Options) ProtoReflect() protoreflect.Message { mi := &file_projections_proto_msgTypes[26] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -1620,21 +1566,18 @@ func (x *ResultReq_Options) GetPartition() string { } type ResetReq_Options struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - WriteCheckpoint bool `protobuf:"varint,2,opt,name=write_checkpoint,json=writeCheckpoint,proto3" json:"write_checkpoint,omitempty"` + state protoimpl.MessageState `protogen:"open.v1"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + WriteCheckpoint bool `protobuf:"varint,2,opt,name=write_checkpoint,json=writeCheckpoint,proto3" json:"write_checkpoint,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *ResetReq_Options) Reset() { *x = ResetReq_Options{} - if protoimpl.UnsafeEnabled { - mi := &file_projections_proto_msgTypes[27] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_projections_proto_msgTypes[27] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *ResetReq_Options) String() string { @@ -1645,7 +1588,7 @@ func (*ResetReq_Options) ProtoMessage() {} func (x *ResetReq_Options) ProtoReflect() protoreflect.Message { mi := &file_projections_proto_msgTypes[27] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -1675,20 +1618,17 @@ func (x *ResetReq_Options) GetWriteCheckpoint() bool { } type EnableReq_Options struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` unknownFields protoimpl.UnknownFields - - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + sizeCache protoimpl.SizeCache } func (x *EnableReq_Options) Reset() { *x = EnableReq_Options{} - if protoimpl.UnsafeEnabled { - mi := &file_projections_proto_msgTypes[28] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_projections_proto_msgTypes[28] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *EnableReq_Options) String() string { @@ -1699,7 +1639,7 @@ func (*EnableReq_Options) ProtoMessage() {} func (x *EnableReq_Options) ProtoReflect() protoreflect.Message { mi := &file_projections_proto_msgTypes[28] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -1722,21 +1662,18 @@ func (x *EnableReq_Options) GetName() string { } type DisableReq_Options struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - WriteCheckpoint bool `protobuf:"varint,2,opt,name=write_checkpoint,json=writeCheckpoint,proto3" json:"write_checkpoint,omitempty"` + state protoimpl.MessageState `protogen:"open.v1"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + WriteCheckpoint bool `protobuf:"varint,2,opt,name=write_checkpoint,json=writeCheckpoint,proto3" json:"write_checkpoint,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *DisableReq_Options) Reset() { *x = DisableReq_Options{} - if protoimpl.UnsafeEnabled { - mi := &file_projections_proto_msgTypes[29] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_projections_proto_msgTypes[29] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *DisableReq_Options) String() string { @@ -1747,7 +1684,7 @@ func (*DisableReq_Options) ProtoMessage() {} func (x *DisableReq_Options) ProtoReflect() protoreflect.Message { mi := &file_projections_proto_msgTypes[29] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -1778,7 +1715,7 @@ func (x *DisableReq_Options) GetWriteCheckpoint() bool { var File_projections_proto protoreflect.FileDescriptor -var file_projections_proto_rawDesc = []byte{ +var file_projections_proto_rawDesc = string([]byte{ 0x0a, 0x11, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x1e, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x5f, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x69, @@ -2056,25 +1993,25 @@ var file_projections_proto_rawDesc = []byte{ 0x2e, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x5a, 0x40, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x2f, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x2d, 0x43, - 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x2d, 0x47, 0x6f, 0x2f, 0x76, 0x34, 0x2f, 0x70, 0x72, 0x6f, 0x74, + 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x2d, 0x47, 0x6f, 0x2f, 0x76, 0x31, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2f, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} +}) var ( file_projections_proto_rawDescOnce sync.Once - file_projections_proto_rawDescData = file_projections_proto_rawDesc + file_projections_proto_rawDescData []byte ) func file_projections_proto_rawDescGZIP() []byte { file_projections_proto_rawDescOnce.Do(func() { - file_projections_proto_rawDescData = protoimpl.X.CompressGZIP(file_projections_proto_rawDescData) + file_projections_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_projections_proto_rawDesc), len(file_projections_proto_rawDesc))) }) return file_projections_proto_rawDescData } var file_projections_proto_msgTypes = make([]protoimpl.MessageInfo, 30) -var file_projections_proto_goTypes = []interface{}{ +var file_projections_proto_goTypes = []any{ (*CreateReq)(nil), // 0: event_store.client.projections.CreateReq (*CreateResp)(nil), // 1: event_store.client.projections.CreateResp (*UpdateReq)(nil), // 2: event_store.client.projections.UpdateReq @@ -2161,378 +2098,16 @@ func file_projections_proto_init() { if File_projections_proto != nil { return } - if !protoimpl.UnsafeEnabled { - file_projections_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CreateReq); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_projections_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CreateResp); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_projections_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*UpdateReq); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_projections_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*UpdateResp); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_projections_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*DeleteReq); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_projections_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*DeleteResp); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_projections_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*StatisticsReq); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_projections_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*StatisticsResp); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_projections_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*StateReq); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_projections_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*StateResp); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_projections_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ResultReq); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_projections_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ResultResp); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_projections_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ResetReq); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_projections_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ResetResp); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_projections_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*EnableReq); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_projections_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*EnableResp); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_projections_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*DisableReq); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_projections_proto_msgTypes[17].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*DisableResp); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_projections_proto_msgTypes[18].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CreateReq_Options); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_projections_proto_msgTypes[19].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CreateReq_Options_Transient); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_projections_proto_msgTypes[20].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CreateReq_Options_Continuous); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_projections_proto_msgTypes[21].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*UpdateReq_Options); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_projections_proto_msgTypes[22].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*DeleteReq_Options); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_projections_proto_msgTypes[23].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*StatisticsReq_Options); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_projections_proto_msgTypes[24].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*StatisticsResp_Details); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_projections_proto_msgTypes[25].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*StateReq_Options); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_projections_proto_msgTypes[26].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ResultReq_Options); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_projections_proto_msgTypes[27].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ResetReq_Options); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_projections_proto_msgTypes[28].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*EnableReq_Options); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_projections_proto_msgTypes[29].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*DisableReq_Options); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - file_projections_proto_msgTypes[18].OneofWrappers = []interface{}{ + file_projections_proto_msgTypes[18].OneofWrappers = []any{ (*CreateReq_Options_OneTime)(nil), (*CreateReq_Options_Transient_)(nil), (*CreateReq_Options_Continuous_)(nil), } - file_projections_proto_msgTypes[21].OneofWrappers = []interface{}{ + file_projections_proto_msgTypes[21].OneofWrappers = []any{ (*UpdateReq_Options_EmitEnabled)(nil), (*UpdateReq_Options_NoEmitOptions)(nil), } - file_projections_proto_msgTypes[23].OneofWrappers = []interface{}{ + file_projections_proto_msgTypes[23].OneofWrappers = []any{ (*StatisticsReq_Options_Name)(nil), (*StatisticsReq_Options_All)(nil), (*StatisticsReq_Options_Transient)(nil), @@ -2543,7 +2118,7 @@ func file_projections_proto_init() { out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_projections_proto_rawDesc, + RawDescriptor: unsafe.Slice(unsafe.StringData(file_projections_proto_rawDesc), len(file_projections_proto_rawDesc)), NumEnums: 0, NumMessages: 30, NumExtensions: 0, @@ -2554,7 +2129,6 @@ func file_projections_proto_init() { MessageInfos: file_projections_proto_msgTypes, }.Build() File_projections_proto = out.File - file_projections_proto_rawDesc = nil file_projections_proto_goTypes = nil file_projections_proto_depIdxs = nil } diff --git a/protos/projections/projections_grpc.pb.go b/protos/projections/projections_grpc.pb.go index 66745415..96f4e717 100644 --- a/protos/projections/projections_grpc.pb.go +++ b/protos/projections/projections_grpc.pb.go @@ -1,14 +1,14 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.3.0 -// - protoc v3.20.0 +// - protoc-gen-go-grpc v1.5.1 +// - protoc v5.26.0 // source: projections.proto package projections import ( context "context" - shared "github.com/EventStore/EventStore-Client-Go/v4/protos/shared" + shared "github.com/EventStore/EventStore-Client-Go/v1/protos/shared" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" @@ -16,8 +16,8 @@ import ( // This is a compile-time assertion to ensure that this generated file // is compatible with the grpc package it is being compiled against. -// Requires gRPC-Go v1.32.0 or later. -const _ = grpc.SupportPackageIsVersion7 +// Requires gRPC-Go v1.64.0 or later. +const _ = grpc.SupportPackageIsVersion9 const ( Projections_Create_FullMethodName = "/event_store.client.projections.Projections/Create" @@ -39,7 +39,7 @@ type ProjectionsClient interface { Create(ctx context.Context, in *CreateReq, opts ...grpc.CallOption) (*CreateResp, error) Update(ctx context.Context, in *UpdateReq, opts ...grpc.CallOption) (*UpdateResp, error) Delete(ctx context.Context, in *DeleteReq, opts ...grpc.CallOption) (*DeleteResp, error) - Statistics(ctx context.Context, in *StatisticsReq, opts ...grpc.CallOption) (Projections_StatisticsClient, error) + Statistics(ctx context.Context, in *StatisticsReq, opts ...grpc.CallOption) (grpc.ServerStreamingClient[StatisticsResp], error) Disable(ctx context.Context, in *DisableReq, opts ...grpc.CallOption) (*DisableResp, error) Enable(ctx context.Context, in *EnableReq, opts ...grpc.CallOption) (*EnableResp, error) Reset(ctx context.Context, in *ResetReq, opts ...grpc.CallOption) (*ResetResp, error) @@ -57,8 +57,9 @@ func NewProjectionsClient(cc grpc.ClientConnInterface) ProjectionsClient { } func (c *projectionsClient) Create(ctx context.Context, in *CreateReq, opts ...grpc.CallOption) (*CreateResp, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(CreateResp) - err := c.cc.Invoke(ctx, Projections_Create_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, Projections_Create_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } @@ -66,8 +67,9 @@ func (c *projectionsClient) Create(ctx context.Context, in *CreateReq, opts ...g } func (c *projectionsClient) Update(ctx context.Context, in *UpdateReq, opts ...grpc.CallOption) (*UpdateResp, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(UpdateResp) - err := c.cc.Invoke(ctx, Projections_Update_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, Projections_Update_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } @@ -75,20 +77,22 @@ func (c *projectionsClient) Update(ctx context.Context, in *UpdateReq, opts ...g } func (c *projectionsClient) Delete(ctx context.Context, in *DeleteReq, opts ...grpc.CallOption) (*DeleteResp, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(DeleteResp) - err := c.cc.Invoke(ctx, Projections_Delete_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, Projections_Delete_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } return out, nil } -func (c *projectionsClient) Statistics(ctx context.Context, in *StatisticsReq, opts ...grpc.CallOption) (Projections_StatisticsClient, error) { - stream, err := c.cc.NewStream(ctx, &Projections_ServiceDesc.Streams[0], Projections_Statistics_FullMethodName, opts...) +func (c *projectionsClient) Statistics(ctx context.Context, in *StatisticsReq, opts ...grpc.CallOption) (grpc.ServerStreamingClient[StatisticsResp], error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + stream, err := c.cc.NewStream(ctx, &Projections_ServiceDesc.Streams[0], Projections_Statistics_FullMethodName, cOpts...) if err != nil { return nil, err } - x := &projectionsStatisticsClient{stream} + x := &grpc.GenericClientStream[StatisticsReq, StatisticsResp]{ClientStream: stream} if err := x.ClientStream.SendMsg(in); err != nil { return nil, err } @@ -98,26 +102,13 @@ func (c *projectionsClient) Statistics(ctx context.Context, in *StatisticsReq, o return x, nil } -type Projections_StatisticsClient interface { - Recv() (*StatisticsResp, error) - grpc.ClientStream -} - -type projectionsStatisticsClient struct { - grpc.ClientStream -} - -func (x *projectionsStatisticsClient) Recv() (*StatisticsResp, error) { - m := new(StatisticsResp) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} +// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. +type Projections_StatisticsClient = grpc.ServerStreamingClient[StatisticsResp] func (c *projectionsClient) Disable(ctx context.Context, in *DisableReq, opts ...grpc.CallOption) (*DisableResp, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(DisableResp) - err := c.cc.Invoke(ctx, Projections_Disable_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, Projections_Disable_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } @@ -125,8 +116,9 @@ func (c *projectionsClient) Disable(ctx context.Context, in *DisableReq, opts .. } func (c *projectionsClient) Enable(ctx context.Context, in *EnableReq, opts ...grpc.CallOption) (*EnableResp, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(EnableResp) - err := c.cc.Invoke(ctx, Projections_Enable_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, Projections_Enable_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } @@ -134,8 +126,9 @@ func (c *projectionsClient) Enable(ctx context.Context, in *EnableReq, opts ...g } func (c *projectionsClient) Reset(ctx context.Context, in *ResetReq, opts ...grpc.CallOption) (*ResetResp, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(ResetResp) - err := c.cc.Invoke(ctx, Projections_Reset_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, Projections_Reset_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } @@ -143,8 +136,9 @@ func (c *projectionsClient) Reset(ctx context.Context, in *ResetReq, opts ...grp } func (c *projectionsClient) State(ctx context.Context, in *StateReq, opts ...grpc.CallOption) (*StateResp, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(StateResp) - err := c.cc.Invoke(ctx, Projections_State_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, Projections_State_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } @@ -152,8 +146,9 @@ func (c *projectionsClient) State(ctx context.Context, in *StateReq, opts ...grp } func (c *projectionsClient) Result(ctx context.Context, in *ResultReq, opts ...grpc.CallOption) (*ResultResp, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(ResultResp) - err := c.cc.Invoke(ctx, Projections_Result_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, Projections_Result_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } @@ -161,8 +156,9 @@ func (c *projectionsClient) Result(ctx context.Context, in *ResultReq, opts ...g } func (c *projectionsClient) RestartSubsystem(ctx context.Context, in *shared.Empty, opts ...grpc.CallOption) (*shared.Empty, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(shared.Empty) - err := c.cc.Invoke(ctx, Projections_RestartSubsystem_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, Projections_RestartSubsystem_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } @@ -171,12 +167,12 @@ func (c *projectionsClient) RestartSubsystem(ctx context.Context, in *shared.Emp // ProjectionsServer is the server API for Projections service. // All implementations must embed UnimplementedProjectionsServer -// for forward compatibility +// for forward compatibility. type ProjectionsServer interface { Create(context.Context, *CreateReq) (*CreateResp, error) Update(context.Context, *UpdateReq) (*UpdateResp, error) Delete(context.Context, *DeleteReq) (*DeleteResp, error) - Statistics(*StatisticsReq, Projections_StatisticsServer) error + Statistics(*StatisticsReq, grpc.ServerStreamingServer[StatisticsResp]) error Disable(context.Context, *DisableReq) (*DisableResp, error) Enable(context.Context, *EnableReq) (*EnableResp, error) Reset(context.Context, *ResetReq) (*ResetResp, error) @@ -186,9 +182,12 @@ type ProjectionsServer interface { mustEmbedUnimplementedProjectionsServer() } -// UnimplementedProjectionsServer must be embedded to have forward compatible implementations. -type UnimplementedProjectionsServer struct { -} +// UnimplementedProjectionsServer must be embedded to have +// forward compatible implementations. +// +// NOTE: this should be embedded by value instead of pointer to avoid a nil +// pointer dereference when methods are called. +type UnimplementedProjectionsServer struct{} func (UnimplementedProjectionsServer) Create(context.Context, *CreateReq) (*CreateResp, error) { return nil, status.Errorf(codes.Unimplemented, "method Create not implemented") @@ -199,7 +198,7 @@ func (UnimplementedProjectionsServer) Update(context.Context, *UpdateReq) (*Upda func (UnimplementedProjectionsServer) Delete(context.Context, *DeleteReq) (*DeleteResp, error) { return nil, status.Errorf(codes.Unimplemented, "method Delete not implemented") } -func (UnimplementedProjectionsServer) Statistics(*StatisticsReq, Projections_StatisticsServer) error { +func (UnimplementedProjectionsServer) Statistics(*StatisticsReq, grpc.ServerStreamingServer[StatisticsResp]) error { return status.Errorf(codes.Unimplemented, "method Statistics not implemented") } func (UnimplementedProjectionsServer) Disable(context.Context, *DisableReq) (*DisableResp, error) { @@ -221,6 +220,7 @@ func (UnimplementedProjectionsServer) RestartSubsystem(context.Context, *shared. return nil, status.Errorf(codes.Unimplemented, "method RestartSubsystem not implemented") } func (UnimplementedProjectionsServer) mustEmbedUnimplementedProjectionsServer() {} +func (UnimplementedProjectionsServer) testEmbeddedByValue() {} // UnsafeProjectionsServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to ProjectionsServer will @@ -230,6 +230,13 @@ type UnsafeProjectionsServer interface { } func RegisterProjectionsServer(s grpc.ServiceRegistrar, srv ProjectionsServer) { + // If the following call pancis, it indicates UnimplementedProjectionsServer was + // embedded by pointer and is nil. This will cause panics if an + // unimplemented method is ever invoked, so we test this at initialization + // time to prevent it from happening at runtime later due to I/O. + if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { + t.testEmbeddedByValue() + } s.RegisterService(&Projections_ServiceDesc, srv) } @@ -292,21 +299,11 @@ func _Projections_Statistics_Handler(srv interface{}, stream grpc.ServerStream) if err := stream.RecvMsg(m); err != nil { return err } - return srv.(ProjectionsServer).Statistics(m, &projectionsStatisticsServer{stream}) -} - -type Projections_StatisticsServer interface { - Send(*StatisticsResp) error - grpc.ServerStream + return srv.(ProjectionsServer).Statistics(m, &grpc.GenericServerStream[StatisticsReq, StatisticsResp]{ServerStream: stream}) } -type projectionsStatisticsServer struct { - grpc.ServerStream -} - -func (x *projectionsStatisticsServer) Send(m *StatisticsResp) error { - return x.ServerStream.SendMsg(m) -} +// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. +type Projections_StatisticsServer = grpc.ServerStreamingServer[StatisticsResp] func _Projections_Disable_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(DisableReq) diff --git a/protos/serverfeatures.proto b/protos/serverfeatures.proto index f6188d53..10c8cec7 100644 --- a/protos/serverfeatures.proto +++ b/protos/serverfeatures.proto @@ -1,7 +1,7 @@ syntax = "proto3"; package event_store.client.server_features; option java_package = "com.eventstore.dbclient.proto.serverfeatures"; -option go_package = "github.com/EventStore/EventStore-Client-Go/v4/protos/serverfeatures"; +option go_package = "github.com/EventStore/EventStore-Client-Go/v1/protos/serverfeatures"; import "shared.proto"; service ServerFeatures { diff --git a/protos/serverfeatures/serverfeatures.pb.go b/protos/serverfeatures/serverfeatures.pb.go index 9c487e12..7defca75 100644 --- a/protos/serverfeatures/serverfeatures.pb.go +++ b/protos/serverfeatures/serverfeatures.pb.go @@ -1,17 +1,18 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.33.0 -// protoc v3.20.0 +// protoc-gen-go v1.36.5 +// protoc v5.26.0 // source: serverfeatures.proto package serverfeatures import ( - shared "github.com/EventStore/EventStore-Client-Go/v4/protos/shared" + shared "github.com/EventStore/EventStore-Client-Go/v1/protos/shared" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" sync "sync" + unsafe "unsafe" ) const ( @@ -22,21 +23,18 @@ const ( ) type SupportedMethods struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Methods []*SupportedMethod `protobuf:"bytes,1,rep,name=methods,proto3" json:"methods,omitempty"` - EventStoreServerVersion string `protobuf:"bytes,2,opt,name=event_store_server_version,json=eventStoreServerVersion,proto3" json:"event_store_server_version,omitempty"` + state protoimpl.MessageState `protogen:"open.v1"` + Methods []*SupportedMethod `protobuf:"bytes,1,rep,name=methods,proto3" json:"methods,omitempty"` + EventStoreServerVersion string `protobuf:"bytes,2,opt,name=event_store_server_version,json=eventStoreServerVersion,proto3" json:"event_store_server_version,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *SupportedMethods) Reset() { *x = SupportedMethods{} - if protoimpl.UnsafeEnabled { - mi := &file_serverfeatures_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_serverfeatures_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *SupportedMethods) String() string { @@ -47,7 +45,7 @@ func (*SupportedMethods) ProtoMessage() {} func (x *SupportedMethods) ProtoReflect() protoreflect.Message { mi := &file_serverfeatures_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -77,22 +75,19 @@ func (x *SupportedMethods) GetEventStoreServerVersion() string { } type SupportedMethod struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + MethodName string `protobuf:"bytes,1,opt,name=method_name,json=methodName,proto3" json:"method_name,omitempty"` + ServiceName string `protobuf:"bytes,2,opt,name=service_name,json=serviceName,proto3" json:"service_name,omitempty"` + Features []string `protobuf:"bytes,3,rep,name=features,proto3" json:"features,omitempty"` unknownFields protoimpl.UnknownFields - - MethodName string `protobuf:"bytes,1,opt,name=method_name,json=methodName,proto3" json:"method_name,omitempty"` - ServiceName string `protobuf:"bytes,2,opt,name=service_name,json=serviceName,proto3" json:"service_name,omitempty"` - Features []string `protobuf:"bytes,3,rep,name=features,proto3" json:"features,omitempty"` + sizeCache protoimpl.SizeCache } func (x *SupportedMethod) Reset() { *x = SupportedMethod{} - if protoimpl.UnsafeEnabled { - mi := &file_serverfeatures_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_serverfeatures_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *SupportedMethod) String() string { @@ -103,7 +98,7 @@ func (*SupportedMethod) ProtoMessage() {} func (x *SupportedMethod) ProtoReflect() protoreflect.Message { mi := &file_serverfeatures_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -141,7 +136,7 @@ func (x *SupportedMethod) GetFeatures() []string { var File_serverfeatures_proto protoreflect.FileDescriptor -var file_serverfeatures_proto_rawDesc = []byte{ +var file_serverfeatures_proto_rawDesc = string([]byte{ 0x0a, 0x14, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x66, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x22, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x5f, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, @@ -177,25 +172,25 @@ var file_serverfeatures_proto_rawDesc = []byte{ 0x61, 0x74, 0x75, 0x72, 0x65, 0x73, 0x5a, 0x43, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x2f, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x2d, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x2d, - 0x47, 0x6f, 0x2f, 0x76, 0x34, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2f, 0x73, 0x65, 0x72, + 0x47, 0x6f, 0x2f, 0x76, 0x31, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x66, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} +}) var ( file_serverfeatures_proto_rawDescOnce sync.Once - file_serverfeatures_proto_rawDescData = file_serverfeatures_proto_rawDesc + file_serverfeatures_proto_rawDescData []byte ) func file_serverfeatures_proto_rawDescGZIP() []byte { file_serverfeatures_proto_rawDescOnce.Do(func() { - file_serverfeatures_proto_rawDescData = protoimpl.X.CompressGZIP(file_serverfeatures_proto_rawDescData) + file_serverfeatures_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_serverfeatures_proto_rawDesc), len(file_serverfeatures_proto_rawDesc))) }) return file_serverfeatures_proto_rawDescData } var file_serverfeatures_proto_msgTypes = make([]protoimpl.MessageInfo, 2) -var file_serverfeatures_proto_goTypes = []interface{}{ +var file_serverfeatures_proto_goTypes = []any{ (*SupportedMethods)(nil), // 0: event_store.client.server_features.SupportedMethods (*SupportedMethod)(nil), // 1: event_store.client.server_features.SupportedMethod (*shared.Empty)(nil), // 2: event_store.client.Empty @@ -216,37 +211,11 @@ func file_serverfeatures_proto_init() { if File_serverfeatures_proto != nil { return } - if !protoimpl.UnsafeEnabled { - file_serverfeatures_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SupportedMethods); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_serverfeatures_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SupportedMethod); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_serverfeatures_proto_rawDesc, + RawDescriptor: unsafe.Slice(unsafe.StringData(file_serverfeatures_proto_rawDesc), len(file_serverfeatures_proto_rawDesc)), NumEnums: 0, NumMessages: 2, NumExtensions: 0, @@ -257,7 +226,6 @@ func file_serverfeatures_proto_init() { MessageInfos: file_serverfeatures_proto_msgTypes, }.Build() File_serverfeatures_proto = out.File - file_serverfeatures_proto_rawDesc = nil file_serverfeatures_proto_goTypes = nil file_serverfeatures_proto_depIdxs = nil } diff --git a/protos/serverfeatures/serverfeatures_grpc.pb.go b/protos/serverfeatures/serverfeatures_grpc.pb.go index 4f611924..626884b7 100644 --- a/protos/serverfeatures/serverfeatures_grpc.pb.go +++ b/protos/serverfeatures/serverfeatures_grpc.pb.go @@ -1,14 +1,14 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.3.0 -// - protoc v3.20.0 +// - protoc-gen-go-grpc v1.5.1 +// - protoc v5.26.0 // source: serverfeatures.proto package serverfeatures import ( context "context" - shared "github.com/EventStore/EventStore-Client-Go/v4/protos/shared" + shared "github.com/EventStore/EventStore-Client-Go/v1/protos/shared" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" @@ -16,8 +16,8 @@ import ( // This is a compile-time assertion to ensure that this generated file // is compatible with the grpc package it is being compiled against. -// Requires gRPC-Go v1.32.0 or later. -const _ = grpc.SupportPackageIsVersion7 +// Requires gRPC-Go v1.64.0 or later. +const _ = grpc.SupportPackageIsVersion9 const ( ServerFeatures_GetSupportedMethods_FullMethodName = "/event_store.client.server_features.ServerFeatures/GetSupportedMethods" @@ -39,8 +39,9 @@ func NewServerFeaturesClient(cc grpc.ClientConnInterface) ServerFeaturesClient { } func (c *serverFeaturesClient) GetSupportedMethods(ctx context.Context, in *shared.Empty, opts ...grpc.CallOption) (*SupportedMethods, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(SupportedMethods) - err := c.cc.Invoke(ctx, ServerFeatures_GetSupportedMethods_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, ServerFeatures_GetSupportedMethods_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } @@ -49,20 +50,24 @@ func (c *serverFeaturesClient) GetSupportedMethods(ctx context.Context, in *shar // ServerFeaturesServer is the server API for ServerFeatures service. // All implementations must embed UnimplementedServerFeaturesServer -// for forward compatibility +// for forward compatibility. type ServerFeaturesServer interface { GetSupportedMethods(context.Context, *shared.Empty) (*SupportedMethods, error) mustEmbedUnimplementedServerFeaturesServer() } -// UnimplementedServerFeaturesServer must be embedded to have forward compatible implementations. -type UnimplementedServerFeaturesServer struct { -} +// UnimplementedServerFeaturesServer must be embedded to have +// forward compatible implementations. +// +// NOTE: this should be embedded by value instead of pointer to avoid a nil +// pointer dereference when methods are called. +type UnimplementedServerFeaturesServer struct{} func (UnimplementedServerFeaturesServer) GetSupportedMethods(context.Context, *shared.Empty) (*SupportedMethods, error) { return nil, status.Errorf(codes.Unimplemented, "method GetSupportedMethods not implemented") } func (UnimplementedServerFeaturesServer) mustEmbedUnimplementedServerFeaturesServer() {} +func (UnimplementedServerFeaturesServer) testEmbeddedByValue() {} // UnsafeServerFeaturesServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to ServerFeaturesServer will @@ -72,6 +77,13 @@ type UnsafeServerFeaturesServer interface { } func RegisterServerFeaturesServer(s grpc.ServiceRegistrar, srv ServerFeaturesServer) { + // If the following call pancis, it indicates UnimplementedServerFeaturesServer was + // embedded by pointer and is nil. This will cause panics if an + // unimplemented method is ever invoked, so we test this at initialization + // time to prevent it from happening at runtime later due to I/O. + if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { + t.testEmbeddedByValue() + } s.RegisterService(&ServerFeatures_ServiceDesc, srv) } diff --git a/protos/shared.proto b/protos/shared.proto index b293dc5d..1d8ecccb 100755 --- a/protos/shared.proto +++ b/protos/shared.proto @@ -1,7 +1,7 @@ syntax = "proto3"; package event_store.client; option java_package = "com.eventstore.dbclient.proto.shared"; -option go_package = "github.com/EventStore/EventStore-Client-Go/v4/protos/shared"; +option go_package = "github.com/EventStore/EventStore-Client-Go/v1/protos/shared"; import "google/protobuf/empty.proto"; message UUID { diff --git a/protos/shared/shared.pb.go b/protos/shared/shared.pb.go index ce5d95d0..7bd9335b 100644 --- a/protos/shared/shared.pb.go +++ b/protos/shared/shared.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.33.0 -// protoc v3.20.0 +// protoc-gen-go v1.36.5 +// protoc v5.26.0 // source: shared.proto package shared @@ -12,6 +12,7 @@ import ( emptypb "google.golang.org/protobuf/types/known/emptypb" reflect "reflect" sync "sync" + unsafe "unsafe" ) const ( @@ -22,24 +23,21 @@ const ( ) type UUID struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Types that are assignable to Value: + state protoimpl.MessageState `protogen:"open.v1"` + // Types that are valid to be assigned to Value: // // *UUID_Structured_ // *UUID_String_ - Value isUUID_Value `protobuf_oneof:"value"` + Value isUUID_Value `protobuf_oneof:"value"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *UUID) Reset() { *x = UUID{} - if protoimpl.UnsafeEnabled { - mi := &file_shared_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_shared_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *UUID) String() string { @@ -50,7 +48,7 @@ func (*UUID) ProtoMessage() {} func (x *UUID) ProtoReflect() protoreflect.Message { mi := &file_shared_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -65,23 +63,27 @@ func (*UUID) Descriptor() ([]byte, []int) { return file_shared_proto_rawDescGZIP(), []int{0} } -func (m *UUID) GetValue() isUUID_Value { - if m != nil { - return m.Value +func (x *UUID) GetValue() isUUID_Value { + if x != nil { + return x.Value } return nil } func (x *UUID) GetStructured() *UUID_Structured { - if x, ok := x.GetValue().(*UUID_Structured_); ok { - return x.Structured + if x != nil { + if x, ok := x.Value.(*UUID_Structured_); ok { + return x.Structured + } } return nil } func (x *UUID) GetString_() string { - if x, ok := x.GetValue().(*UUID_String_); ok { - return x.String_ + if x != nil { + if x, ok := x.Value.(*UUID_String_); ok { + return x.String_ + } } return "" } @@ -103,18 +105,16 @@ func (*UUID_Structured_) isUUID_Value() {} func (*UUID_String_) isUUID_Value() {} type Empty struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *Empty) Reset() { *x = Empty{} - if protoimpl.UnsafeEnabled { - mi := &file_shared_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_shared_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *Empty) String() string { @@ -125,7 +125,7 @@ func (*Empty) ProtoMessage() {} func (x *Empty) ProtoReflect() protoreflect.Message { mi := &file_shared_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -141,20 +141,17 @@ func (*Empty) Descriptor() ([]byte, []int) { } type StreamIdentifier struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + StreamName []byte `protobuf:"bytes,3,opt,name=stream_name,json=streamName,proto3" json:"stream_name,omitempty"` unknownFields protoimpl.UnknownFields - - StreamName []byte `protobuf:"bytes,3,opt,name=stream_name,json=streamName,proto3" json:"stream_name,omitempty"` + sizeCache protoimpl.SizeCache } func (x *StreamIdentifier) Reset() { *x = StreamIdentifier{} - if protoimpl.UnsafeEnabled { - mi := &file_shared_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_shared_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *StreamIdentifier) String() string { @@ -165,7 +162,7 @@ func (*StreamIdentifier) ProtoMessage() {} func (x *StreamIdentifier) ProtoReflect() protoreflect.Message { mi := &file_shared_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -188,21 +185,18 @@ func (x *StreamIdentifier) GetStreamName() []byte { } type AllStreamPosition struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - CommitPosition uint64 `protobuf:"varint,1,opt,name=commit_position,json=commitPosition,proto3" json:"commit_position,omitempty"` - PreparePosition uint64 `protobuf:"varint,2,opt,name=prepare_position,json=preparePosition,proto3" json:"prepare_position,omitempty"` + state protoimpl.MessageState `protogen:"open.v1"` + CommitPosition uint64 `protobuf:"varint,1,opt,name=commit_position,json=commitPosition,proto3" json:"commit_position,omitempty"` + PreparePosition uint64 `protobuf:"varint,2,opt,name=prepare_position,json=preparePosition,proto3" json:"prepare_position,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *AllStreamPosition) Reset() { *x = AllStreamPosition{} - if protoimpl.UnsafeEnabled { - mi := &file_shared_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_shared_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *AllStreamPosition) String() string { @@ -213,7 +207,7 @@ func (*AllStreamPosition) ProtoMessage() {} func (x *AllStreamPosition) ProtoReflect() protoreflect.Message { mi := &file_shared_proto_msgTypes[3] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -243,31 +237,28 @@ func (x *AllStreamPosition) GetPreparePosition() uint64 { } type WrongExpectedVersion struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Types that are assignable to CurrentStreamRevisionOption: + state protoimpl.MessageState `protogen:"open.v1"` + // Types that are valid to be assigned to CurrentStreamRevisionOption: // // *WrongExpectedVersion_CurrentStreamRevision // *WrongExpectedVersion_CurrentNoStream CurrentStreamRevisionOption isWrongExpectedVersion_CurrentStreamRevisionOption `protobuf_oneof:"current_stream_revision_option"` - // Types that are assignable to ExpectedStreamPositionOption: + // Types that are valid to be assigned to ExpectedStreamPositionOption: // // *WrongExpectedVersion_ExpectedStreamPosition // *WrongExpectedVersion_ExpectedAny // *WrongExpectedVersion_ExpectedStreamExists // *WrongExpectedVersion_ExpectedNoStream ExpectedStreamPositionOption isWrongExpectedVersion_ExpectedStreamPositionOption `protobuf_oneof:"expected_stream_position_option"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *WrongExpectedVersion) Reset() { *x = WrongExpectedVersion{} - if protoimpl.UnsafeEnabled { - mi := &file_shared_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_shared_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *WrongExpectedVersion) String() string { @@ -278,7 +269,7 @@ func (*WrongExpectedVersion) ProtoMessage() {} func (x *WrongExpectedVersion) ProtoReflect() protoreflect.Message { mi := &file_shared_proto_msgTypes[4] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -293,58 +284,70 @@ func (*WrongExpectedVersion) Descriptor() ([]byte, []int) { return file_shared_proto_rawDescGZIP(), []int{4} } -func (m *WrongExpectedVersion) GetCurrentStreamRevisionOption() isWrongExpectedVersion_CurrentStreamRevisionOption { - if m != nil { - return m.CurrentStreamRevisionOption +func (x *WrongExpectedVersion) GetCurrentStreamRevisionOption() isWrongExpectedVersion_CurrentStreamRevisionOption { + if x != nil { + return x.CurrentStreamRevisionOption } return nil } func (x *WrongExpectedVersion) GetCurrentStreamRevision() uint64 { - if x, ok := x.GetCurrentStreamRevisionOption().(*WrongExpectedVersion_CurrentStreamRevision); ok { - return x.CurrentStreamRevision + if x != nil { + if x, ok := x.CurrentStreamRevisionOption.(*WrongExpectedVersion_CurrentStreamRevision); ok { + return x.CurrentStreamRevision + } } return 0 } func (x *WrongExpectedVersion) GetCurrentNoStream() *emptypb.Empty { - if x, ok := x.GetCurrentStreamRevisionOption().(*WrongExpectedVersion_CurrentNoStream); ok { - return x.CurrentNoStream + if x != nil { + if x, ok := x.CurrentStreamRevisionOption.(*WrongExpectedVersion_CurrentNoStream); ok { + return x.CurrentNoStream + } } return nil } -func (m *WrongExpectedVersion) GetExpectedStreamPositionOption() isWrongExpectedVersion_ExpectedStreamPositionOption { - if m != nil { - return m.ExpectedStreamPositionOption +func (x *WrongExpectedVersion) GetExpectedStreamPositionOption() isWrongExpectedVersion_ExpectedStreamPositionOption { + if x != nil { + return x.ExpectedStreamPositionOption } return nil } func (x *WrongExpectedVersion) GetExpectedStreamPosition() uint64 { - if x, ok := x.GetExpectedStreamPositionOption().(*WrongExpectedVersion_ExpectedStreamPosition); ok { - return x.ExpectedStreamPosition + if x != nil { + if x, ok := x.ExpectedStreamPositionOption.(*WrongExpectedVersion_ExpectedStreamPosition); ok { + return x.ExpectedStreamPosition + } } return 0 } func (x *WrongExpectedVersion) GetExpectedAny() *emptypb.Empty { - if x, ok := x.GetExpectedStreamPositionOption().(*WrongExpectedVersion_ExpectedAny); ok { - return x.ExpectedAny + if x != nil { + if x, ok := x.ExpectedStreamPositionOption.(*WrongExpectedVersion_ExpectedAny); ok { + return x.ExpectedAny + } } return nil } func (x *WrongExpectedVersion) GetExpectedStreamExists() *emptypb.Empty { - if x, ok := x.GetExpectedStreamPositionOption().(*WrongExpectedVersion_ExpectedStreamExists); ok { - return x.ExpectedStreamExists + if x != nil { + if x, ok := x.ExpectedStreamPositionOption.(*WrongExpectedVersion_ExpectedStreamExists); ok { + return x.ExpectedStreamExists + } } return nil } func (x *WrongExpectedVersion) GetExpectedNoStream() *emptypb.Empty { - if x, ok := x.GetExpectedStreamPositionOption().(*WrongExpectedVersion_ExpectedNoStream); ok { - return x.ExpectedNoStream + if x != nil { + if x, ok := x.ExpectedStreamPositionOption.(*WrongExpectedVersion_ExpectedNoStream); ok { + return x.ExpectedNoStream + } } return nil } @@ -397,18 +400,16 @@ func (*WrongExpectedVersion_ExpectedStreamExists) isWrongExpectedVersion_Expecte func (*WrongExpectedVersion_ExpectedNoStream) isWrongExpectedVersion_ExpectedStreamPositionOption() {} type AccessDenied struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *AccessDenied) Reset() { *x = AccessDenied{} - if protoimpl.UnsafeEnabled { - mi := &file_shared_proto_msgTypes[5] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_shared_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *AccessDenied) String() string { @@ -419,7 +420,7 @@ func (*AccessDenied) ProtoMessage() {} func (x *AccessDenied) ProtoReflect() protoreflect.Message { mi := &file_shared_proto_msgTypes[5] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -435,20 +436,17 @@ func (*AccessDenied) Descriptor() ([]byte, []int) { } type StreamDeleted struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - StreamIdentifier *StreamIdentifier `protobuf:"bytes,1,opt,name=stream_identifier,json=streamIdentifier,proto3" json:"stream_identifier,omitempty"` + state protoimpl.MessageState `protogen:"open.v1"` + StreamIdentifier *StreamIdentifier `protobuf:"bytes,1,opt,name=stream_identifier,json=streamIdentifier,proto3" json:"stream_identifier,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *StreamDeleted) Reset() { *x = StreamDeleted{} - if protoimpl.UnsafeEnabled { - mi := &file_shared_proto_msgTypes[6] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_shared_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *StreamDeleted) String() string { @@ -459,7 +457,7 @@ func (*StreamDeleted) ProtoMessage() {} func (x *StreamDeleted) ProtoReflect() protoreflect.Message { mi := &file_shared_proto_msgTypes[6] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -482,18 +480,16 @@ func (x *StreamDeleted) GetStreamIdentifier() *StreamIdentifier { } type Timeout struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *Timeout) Reset() { *x = Timeout{} - if protoimpl.UnsafeEnabled { - mi := &file_shared_proto_msgTypes[7] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_shared_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *Timeout) String() string { @@ -504,7 +500,7 @@ func (*Timeout) ProtoMessage() {} func (x *Timeout) ProtoReflect() protoreflect.Message { mi := &file_shared_proto_msgTypes[7] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -520,18 +516,16 @@ func (*Timeout) Descriptor() ([]byte, []int) { } type Unknown struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *Unknown) Reset() { *x = Unknown{} - if protoimpl.UnsafeEnabled { - mi := &file_shared_proto_msgTypes[8] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_shared_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *Unknown) String() string { @@ -542,7 +536,7 @@ func (*Unknown) ProtoMessage() {} func (x *Unknown) ProtoReflect() protoreflect.Message { mi := &file_shared_proto_msgTypes[8] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -558,18 +552,16 @@ func (*Unknown) Descriptor() ([]byte, []int) { } type InvalidTransaction struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *InvalidTransaction) Reset() { *x = InvalidTransaction{} - if protoimpl.UnsafeEnabled { - mi := &file_shared_proto_msgTypes[9] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_shared_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *InvalidTransaction) String() string { @@ -580,7 +572,7 @@ func (*InvalidTransaction) ProtoMessage() {} func (x *InvalidTransaction) ProtoReflect() protoreflect.Message { mi := &file_shared_proto_msgTypes[9] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -596,20 +588,17 @@ func (*InvalidTransaction) Descriptor() ([]byte, []int) { } type MaximumAppendSizeExceeded struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + MaxAppendSize uint32 `protobuf:"varint,1,opt,name=maxAppendSize,proto3" json:"maxAppendSize,omitempty"` unknownFields protoimpl.UnknownFields - - MaxAppendSize uint32 `protobuf:"varint,1,opt,name=maxAppendSize,proto3" json:"maxAppendSize,omitempty"` + sizeCache protoimpl.SizeCache } func (x *MaximumAppendSizeExceeded) Reset() { *x = MaximumAppendSizeExceeded{} - if protoimpl.UnsafeEnabled { - mi := &file_shared_proto_msgTypes[10] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_shared_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *MaximumAppendSizeExceeded) String() string { @@ -620,7 +609,7 @@ func (*MaximumAppendSizeExceeded) ProtoMessage() {} func (x *MaximumAppendSizeExceeded) ProtoReflect() protoreflect.Message { mi := &file_shared_proto_msgTypes[10] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -643,20 +632,17 @@ func (x *MaximumAppendSizeExceeded) GetMaxAppendSize() uint32 { } type BadRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Message string `protobuf:"bytes,1,opt,name=message,proto3" json:"message,omitempty"` unknownFields protoimpl.UnknownFields - - Message string `protobuf:"bytes,1,opt,name=message,proto3" json:"message,omitempty"` + sizeCache protoimpl.SizeCache } func (x *BadRequest) Reset() { *x = BadRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_shared_proto_msgTypes[11] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_shared_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *BadRequest) String() string { @@ -667,7 +653,7 @@ func (*BadRequest) ProtoMessage() {} func (x *BadRequest) ProtoReflect() protoreflect.Message { mi := &file_shared_proto_msgTypes[11] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -690,21 +676,18 @@ func (x *BadRequest) GetMessage() string { } type UUID_Structured struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - MostSignificantBits int64 `protobuf:"varint,1,opt,name=most_significant_bits,json=mostSignificantBits,proto3" json:"most_significant_bits,omitempty"` - LeastSignificantBits int64 `protobuf:"varint,2,opt,name=least_significant_bits,json=leastSignificantBits,proto3" json:"least_significant_bits,omitempty"` + state protoimpl.MessageState `protogen:"open.v1"` + MostSignificantBits int64 `protobuf:"varint,1,opt,name=most_significant_bits,json=mostSignificantBits,proto3" json:"most_significant_bits,omitempty"` + LeastSignificantBits int64 `protobuf:"varint,2,opt,name=least_significant_bits,json=leastSignificantBits,proto3" json:"least_significant_bits,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *UUID_Structured) Reset() { *x = UUID_Structured{} - if protoimpl.UnsafeEnabled { - mi := &file_shared_proto_msgTypes[12] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_shared_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *UUID_Structured) String() string { @@ -715,7 +698,7 @@ func (*UUID_Structured) ProtoMessage() {} func (x *UUID_Structured) ProtoReflect() protoreflect.Message { mi := &file_shared_proto_msgTypes[12] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -746,7 +729,7 @@ func (x *UUID_Structured) GetLeastSignificantBits() int64 { var File_shared_proto protoreflect.FileDescriptor -var file_shared_proto_rawDesc = []byte{ +var file_shared_proto_rawDesc = string([]byte{ 0x0a, 0x0c, 0x73, 0x68, 0x61, 0x72, 0x65, 0x64, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x12, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x5f, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x1a, 0x1b, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, @@ -829,24 +812,24 @@ var file_shared_proto_rawDesc = []byte{ 0x74, 0x6f, 0x2e, 0x73, 0x68, 0x61, 0x72, 0x65, 0x64, 0x5a, 0x3b, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x2f, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x2d, 0x43, 0x6c, 0x69, 0x65, - 0x6e, 0x74, 0x2d, 0x47, 0x6f, 0x2f, 0x76, 0x34, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2f, + 0x6e, 0x74, 0x2d, 0x47, 0x6f, 0x2f, 0x76, 0x31, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2f, 0x73, 0x68, 0x61, 0x72, 0x65, 0x64, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} +}) var ( file_shared_proto_rawDescOnce sync.Once - file_shared_proto_rawDescData = file_shared_proto_rawDesc + file_shared_proto_rawDescData []byte ) func file_shared_proto_rawDescGZIP() []byte { file_shared_proto_rawDescOnce.Do(func() { - file_shared_proto_rawDescData = protoimpl.X.CompressGZIP(file_shared_proto_rawDescData) + file_shared_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_shared_proto_rawDesc), len(file_shared_proto_rawDesc))) }) return file_shared_proto_rawDescData } var file_shared_proto_msgTypes = make([]protoimpl.MessageInfo, 13) -var file_shared_proto_goTypes = []interface{}{ +var file_shared_proto_goTypes = []any{ (*UUID)(nil), // 0: event_store.client.UUID (*Empty)(nil), // 1: event_store.client.Empty (*StreamIdentifier)(nil), // 2: event_store.client.StreamIdentifier @@ -881,169 +864,11 @@ func file_shared_proto_init() { if File_shared_proto != nil { return } - if !protoimpl.UnsafeEnabled { - file_shared_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*UUID); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_shared_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Empty); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_shared_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*StreamIdentifier); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_shared_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AllStreamPosition); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_shared_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*WrongExpectedVersion); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_shared_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AccessDenied); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_shared_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*StreamDeleted); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_shared_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Timeout); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_shared_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Unknown); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_shared_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*InvalidTransaction); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_shared_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MaximumAppendSizeExceeded); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_shared_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*BadRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_shared_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*UUID_Structured); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - file_shared_proto_msgTypes[0].OneofWrappers = []interface{}{ + file_shared_proto_msgTypes[0].OneofWrappers = []any{ (*UUID_Structured_)(nil), (*UUID_String_)(nil), } - file_shared_proto_msgTypes[4].OneofWrappers = []interface{}{ + file_shared_proto_msgTypes[4].OneofWrappers = []any{ (*WrongExpectedVersion_CurrentStreamRevision)(nil), (*WrongExpectedVersion_CurrentNoStream)(nil), (*WrongExpectedVersion_ExpectedStreamPosition)(nil), @@ -1055,7 +880,7 @@ func file_shared_proto_init() { out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_shared_proto_rawDesc, + RawDescriptor: unsafe.Slice(unsafe.StringData(file_shared_proto_rawDesc), len(file_shared_proto_rawDesc)), NumEnums: 0, NumMessages: 13, NumExtensions: 0, @@ -1066,7 +891,6 @@ func file_shared_proto_init() { MessageInfos: file_shared_proto_msgTypes, }.Build() File_shared_proto = out.File - file_shared_proto_rawDesc = nil file_shared_proto_goTypes = nil file_shared_proto_depIdxs = nil } diff --git a/protos/status/status.pb.go b/protos/status/status.pb.go index 7c52171c..6241feff 100644 --- a/protos/status/status.pb.go +++ b/protos/status/status.pb.go @@ -14,8 +14,8 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.33.0 -// protoc v3.20.0 +// protoc-gen-go v1.36.5 +// protoc v5.26.0 // source: status.proto package status @@ -27,6 +27,7 @@ import ( anypb "google.golang.org/protobuf/types/known/anypb" reflect "reflect" sync "sync" + unsafe "unsafe" ) const ( @@ -44,10 +45,7 @@ const ( // You can find out more about this error model and how to work with it in the // [API Design Guide](https://cloud.google.com/apis/design/errors). type Status struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - + state protoimpl.MessageState `protogen:"open.v1"` // The status code, which should be an enum value of [google.rpc.Code][google.rpc.Code]. Code code.Code `protobuf:"varint,1,opt,name=code,proto3,enum=google.rpc.Code" json:"code,omitempty"` // A developer-facing error message, which should be in English. Any @@ -56,16 +54,16 @@ type Status struct { Message string `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"` // A list of messages that carry the error details. There is a common set of // message types for APIs to use. - Details *anypb.Any `protobuf:"bytes,3,opt,name=details,proto3" json:"details,omitempty"` + Details *anypb.Any `protobuf:"bytes,3,opt,name=details,proto3" json:"details,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *Status) Reset() { *x = Status{} - if protoimpl.UnsafeEnabled { - mi := &file_status_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_status_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *Status) String() string { @@ -76,7 +74,7 @@ func (*Status) ProtoMessage() {} func (x *Status) ProtoReflect() protoreflect.Message { mi := &file_status_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -114,7 +112,7 @@ func (x *Status) GetDetails() *anypb.Any { var File_status_proto protoreflect.FileDescriptor -var file_status_proto_rawDesc = []byte{ +var file_status_proto_rawDesc = string([]byte{ 0x0a, 0x0c, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0a, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x72, 0x70, 0x63, 0x1a, 0x19, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x61, 0x6e, 0x79, 0x2e, @@ -134,22 +132,22 @@ var file_status_proto_rawDesc = []byte{ 0x70, 0x69, 0x73, 0x2f, 0x72, 0x70, 0x63, 0x2f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x3b, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0xf8, 0x01, 0x01, 0xa2, 0x02, 0x03, 0x52, 0x50, 0x43, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} +}) var ( file_status_proto_rawDescOnce sync.Once - file_status_proto_rawDescData = file_status_proto_rawDesc + file_status_proto_rawDescData []byte ) func file_status_proto_rawDescGZIP() []byte { file_status_proto_rawDescOnce.Do(func() { - file_status_proto_rawDescData = protoimpl.X.CompressGZIP(file_status_proto_rawDescData) + file_status_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_status_proto_rawDesc), len(file_status_proto_rawDesc))) }) return file_status_proto_rawDescData } var file_status_proto_msgTypes = make([]protoimpl.MessageInfo, 1) -var file_status_proto_goTypes = []interface{}{ +var file_status_proto_goTypes = []any{ (*Status)(nil), // 0: google.rpc.Status (code.Code)(0), // 1: google.rpc.Code (*anypb.Any)(nil), // 2: google.protobuf.Any @@ -169,25 +167,11 @@ func file_status_proto_init() { if File_status_proto != nil { return } - if !protoimpl.UnsafeEnabled { - file_status_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Status); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_status_proto_rawDesc, + RawDescriptor: unsafe.Slice(unsafe.StringData(file_status_proto_rawDesc), len(file_status_proto_rawDesc)), NumEnums: 0, NumMessages: 1, NumExtensions: 0, @@ -198,7 +182,6 @@ func file_status_proto_init() { MessageInfos: file_status_proto_msgTypes, }.Build() File_status_proto = out.File - file_status_proto_rawDesc = nil file_status_proto_goTypes = nil file_status_proto_depIdxs = nil } diff --git a/protos/streams.proto b/protos/streams.proto index 54c0f0b9..f708df48 100644 --- a/protos/streams.proto +++ b/protos/streams.proto @@ -1,7 +1,7 @@ syntax = "proto3"; package event_store.client.streams; option java_package = "com.eventstore.dbclient.proto.streams"; -option go_package = "github.com/EventStore/EventStore-Client-Go/v4/protos/streams"; +option go_package = "github.com/EventStore/EventStore-Client-Go/v1/protos/streams"; import "shared.proto"; import "status.proto"; diff --git a/protos/streams/streams.pb.go b/protos/streams/streams.pb.go index ea499d3d..153b97fd 100644 --- a/protos/streams/streams.pb.go +++ b/protos/streams/streams.pb.go @@ -1,13 +1,13 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.33.0 -// protoc v3.20.0 +// protoc-gen-go v1.36.5 +// protoc v5.26.0 // source: streams.proto package streams import ( - shared "github.com/EventStore/EventStore-Client-Go/v4/protos/shared" + shared "github.com/EventStore/EventStore-Client-Go/v1/protos/shared" status "google.golang.org/genproto/googleapis/rpc/status" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" @@ -16,6 +16,7 @@ import ( timestamppb "google.golang.org/protobuf/types/known/timestamppb" reflect "reflect" sync "sync" + unsafe "unsafe" ) const ( @@ -72,20 +73,17 @@ func (ReadReq_Options_ReadDirection) EnumDescriptor() ([]byte, []int) { } type ReadReq struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Options *ReadReq_Options `protobuf:"bytes,1,opt,name=options,proto3" json:"options,omitempty"` unknownFields protoimpl.UnknownFields - - Options *ReadReq_Options `protobuf:"bytes,1,opt,name=options,proto3" json:"options,omitempty"` + sizeCache protoimpl.SizeCache } func (x *ReadReq) Reset() { *x = ReadReq{} - if protoimpl.UnsafeEnabled { - mi := &file_streams_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_streams_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *ReadReq) String() string { @@ -96,7 +94,7 @@ func (*ReadReq) ProtoMessage() {} func (x *ReadReq) ProtoReflect() protoreflect.Message { mi := &file_streams_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -119,11 +117,8 @@ func (x *ReadReq) GetOptions() *ReadReq_Options { } type ReadResp struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Types that are assignable to Content: + state protoimpl.MessageState `protogen:"open.v1"` + // Types that are valid to be assigned to Content: // // *ReadResp_Event // *ReadResp_Confirmation @@ -134,16 +129,16 @@ type ReadResp struct { // *ReadResp_LastAllStreamPosition // *ReadResp_CaughtUp_ // *ReadResp_FellBehind_ - Content isReadResp_Content `protobuf_oneof:"content"` + Content isReadResp_Content `protobuf_oneof:"content"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *ReadResp) Reset() { *x = ReadResp{} - if protoimpl.UnsafeEnabled { - mi := &file_streams_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_streams_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *ReadResp) String() string { @@ -154,7 +149,7 @@ func (*ReadResp) ProtoMessage() {} func (x *ReadResp) ProtoReflect() protoreflect.Message { mi := &file_streams_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -169,72 +164,90 @@ func (*ReadResp) Descriptor() ([]byte, []int) { return file_streams_proto_rawDescGZIP(), []int{1} } -func (m *ReadResp) GetContent() isReadResp_Content { - if m != nil { - return m.Content +func (x *ReadResp) GetContent() isReadResp_Content { + if x != nil { + return x.Content } return nil } func (x *ReadResp) GetEvent() *ReadResp_ReadEvent { - if x, ok := x.GetContent().(*ReadResp_Event); ok { - return x.Event + if x != nil { + if x, ok := x.Content.(*ReadResp_Event); ok { + return x.Event + } } return nil } func (x *ReadResp) GetConfirmation() *ReadResp_SubscriptionConfirmation { - if x, ok := x.GetContent().(*ReadResp_Confirmation); ok { - return x.Confirmation + if x != nil { + if x, ok := x.Content.(*ReadResp_Confirmation); ok { + return x.Confirmation + } } return nil } func (x *ReadResp) GetCheckpoint() *ReadResp_Checkpoint { - if x, ok := x.GetContent().(*ReadResp_Checkpoint_); ok { - return x.Checkpoint + if x != nil { + if x, ok := x.Content.(*ReadResp_Checkpoint_); ok { + return x.Checkpoint + } } return nil } func (x *ReadResp) GetStreamNotFound() *ReadResp_StreamNotFound { - if x, ok := x.GetContent().(*ReadResp_StreamNotFound_); ok { - return x.StreamNotFound + if x != nil { + if x, ok := x.Content.(*ReadResp_StreamNotFound_); ok { + return x.StreamNotFound + } } return nil } func (x *ReadResp) GetFirstStreamPosition() uint64 { - if x, ok := x.GetContent().(*ReadResp_FirstStreamPosition); ok { - return x.FirstStreamPosition + if x != nil { + if x, ok := x.Content.(*ReadResp_FirstStreamPosition); ok { + return x.FirstStreamPosition + } } return 0 } func (x *ReadResp) GetLastStreamPosition() uint64 { - if x, ok := x.GetContent().(*ReadResp_LastStreamPosition); ok { - return x.LastStreamPosition + if x != nil { + if x, ok := x.Content.(*ReadResp_LastStreamPosition); ok { + return x.LastStreamPosition + } } return 0 } func (x *ReadResp) GetLastAllStreamPosition() *shared.AllStreamPosition { - if x, ok := x.GetContent().(*ReadResp_LastAllStreamPosition); ok { - return x.LastAllStreamPosition + if x != nil { + if x, ok := x.Content.(*ReadResp_LastAllStreamPosition); ok { + return x.LastAllStreamPosition + } } return nil } func (x *ReadResp) GetCaughtUp() *ReadResp_CaughtUp { - if x, ok := x.GetContent().(*ReadResp_CaughtUp_); ok { - return x.CaughtUp + if x != nil { + if x, ok := x.Content.(*ReadResp_CaughtUp_); ok { + return x.CaughtUp + } } return nil } func (x *ReadResp) GetFellBehind() *ReadResp_FellBehind { - if x, ok := x.GetContent().(*ReadResp_FellBehind_); ok { - return x.FellBehind + if x != nil { + if x, ok := x.Content.(*ReadResp_FellBehind_); ok { + return x.FellBehind + } } return nil } @@ -298,24 +311,21 @@ func (*ReadResp_CaughtUp_) isReadResp_Content() {} func (*ReadResp_FellBehind_) isReadResp_Content() {} type AppendReq struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Types that are assignable to Content: + state protoimpl.MessageState `protogen:"open.v1"` + // Types that are valid to be assigned to Content: // // *AppendReq_Options_ // *AppendReq_ProposedMessage_ - Content isAppendReq_Content `protobuf_oneof:"content"` + Content isAppendReq_Content `protobuf_oneof:"content"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *AppendReq) Reset() { *x = AppendReq{} - if protoimpl.UnsafeEnabled { - mi := &file_streams_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_streams_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *AppendReq) String() string { @@ -326,7 +336,7 @@ func (*AppendReq) ProtoMessage() {} func (x *AppendReq) ProtoReflect() protoreflect.Message { mi := &file_streams_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -341,23 +351,27 @@ func (*AppendReq) Descriptor() ([]byte, []int) { return file_streams_proto_rawDescGZIP(), []int{2} } -func (m *AppendReq) GetContent() isAppendReq_Content { - if m != nil { - return m.Content +func (x *AppendReq) GetContent() isAppendReq_Content { + if x != nil { + return x.Content } return nil } func (x *AppendReq) GetOptions() *AppendReq_Options { - if x, ok := x.GetContent().(*AppendReq_Options_); ok { - return x.Options + if x != nil { + if x, ok := x.Content.(*AppendReq_Options_); ok { + return x.Options + } } return nil } func (x *AppendReq) GetProposedMessage() *AppendReq_ProposedMessage { - if x, ok := x.GetContent().(*AppendReq_ProposedMessage_); ok { - return x.ProposedMessage + if x != nil { + if x, ok := x.Content.(*AppendReq_ProposedMessage_); ok { + return x.ProposedMessage + } } return nil } @@ -379,24 +393,21 @@ func (*AppendReq_Options_) isAppendReq_Content() {} func (*AppendReq_ProposedMessage_) isAppendReq_Content() {} type AppendResp struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Types that are assignable to Result: + state protoimpl.MessageState `protogen:"open.v1"` + // Types that are valid to be assigned to Result: // // *AppendResp_Success_ // *AppendResp_WrongExpectedVersion_ - Result isAppendResp_Result `protobuf_oneof:"result"` + Result isAppendResp_Result `protobuf_oneof:"result"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *AppendResp) Reset() { *x = AppendResp{} - if protoimpl.UnsafeEnabled { - mi := &file_streams_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_streams_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *AppendResp) String() string { @@ -407,7 +418,7 @@ func (*AppendResp) ProtoMessage() {} func (x *AppendResp) ProtoReflect() protoreflect.Message { mi := &file_streams_proto_msgTypes[3] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -422,23 +433,27 @@ func (*AppendResp) Descriptor() ([]byte, []int) { return file_streams_proto_rawDescGZIP(), []int{3} } -func (m *AppendResp) GetResult() isAppendResp_Result { - if m != nil { - return m.Result +func (x *AppendResp) GetResult() isAppendResp_Result { + if x != nil { + return x.Result } return nil } func (x *AppendResp) GetSuccess() *AppendResp_Success { - if x, ok := x.GetResult().(*AppendResp_Success_); ok { - return x.Success + if x != nil { + if x, ok := x.Result.(*AppendResp_Success_); ok { + return x.Success + } } return nil } func (x *AppendResp) GetWrongExpectedVersion() *AppendResp_WrongExpectedVersion { - if x, ok := x.GetResult().(*AppendResp_WrongExpectedVersion_); ok { - return x.WrongExpectedVersion + if x != nil { + if x, ok := x.Result.(*AppendResp_WrongExpectedVersion_); ok { + return x.WrongExpectedVersion + } } return nil } @@ -460,23 +475,20 @@ func (*AppendResp_Success_) isAppendResp_Result() {} func (*AppendResp_WrongExpectedVersion_) isAppendResp_Result() {} type BatchAppendReq struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - + state protoimpl.MessageState `protogen:"open.v1"` CorrelationId *shared.UUID `protobuf:"bytes,1,opt,name=correlation_id,json=correlationId,proto3" json:"correlation_id,omitempty"` Options *BatchAppendReq_Options `protobuf:"bytes,2,opt,name=options,proto3" json:"options,omitempty"` ProposedMessages []*BatchAppendReq_ProposedMessage `protobuf:"bytes,3,rep,name=proposed_messages,json=proposedMessages,proto3" json:"proposed_messages,omitempty"` IsFinal bool `protobuf:"varint,4,opt,name=is_final,json=isFinal,proto3" json:"is_final,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *BatchAppendReq) Reset() { *x = BatchAppendReq{} - if protoimpl.UnsafeEnabled { - mi := &file_streams_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_streams_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *BatchAppendReq) String() string { @@ -487,7 +499,7 @@ func (*BatchAppendReq) ProtoMessage() {} func (x *BatchAppendReq) ProtoReflect() protoreflect.Message { mi := &file_streams_proto_msgTypes[4] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -531,33 +543,30 @@ func (x *BatchAppendReq) GetIsFinal() bool { } type BatchAppendResp struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - CorrelationId *shared.UUID `protobuf:"bytes,1,opt,name=correlation_id,json=correlationId,proto3" json:"correlation_id,omitempty"` - // Types that are assignable to Result: + state protoimpl.MessageState `protogen:"open.v1"` + CorrelationId *shared.UUID `protobuf:"bytes,1,opt,name=correlation_id,json=correlationId,proto3" json:"correlation_id,omitempty"` + // Types that are valid to be assigned to Result: // // *BatchAppendResp_Error // *BatchAppendResp_Success_ Result isBatchAppendResp_Result `protobuf_oneof:"result"` StreamIdentifier *shared.StreamIdentifier `protobuf:"bytes,4,opt,name=stream_identifier,json=streamIdentifier,proto3" json:"stream_identifier,omitempty"` - // Types that are assignable to ExpectedStreamPosition: + // Types that are valid to be assigned to ExpectedStreamPosition: // // *BatchAppendResp_StreamPosition // *BatchAppendResp_NoStream // *BatchAppendResp_Any // *BatchAppendResp_StreamExists ExpectedStreamPosition isBatchAppendResp_ExpectedStreamPosition `protobuf_oneof:"expected_stream_position"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *BatchAppendResp) Reset() { *x = BatchAppendResp{} - if protoimpl.UnsafeEnabled { - mi := &file_streams_proto_msgTypes[5] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_streams_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *BatchAppendResp) String() string { @@ -568,7 +577,7 @@ func (*BatchAppendResp) ProtoMessage() {} func (x *BatchAppendResp) ProtoReflect() protoreflect.Message { mi := &file_streams_proto_msgTypes[5] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -590,23 +599,27 @@ func (x *BatchAppendResp) GetCorrelationId() *shared.UUID { return nil } -func (m *BatchAppendResp) GetResult() isBatchAppendResp_Result { - if m != nil { - return m.Result +func (x *BatchAppendResp) GetResult() isBatchAppendResp_Result { + if x != nil { + return x.Result } return nil } func (x *BatchAppendResp) GetError() *status.Status { - if x, ok := x.GetResult().(*BatchAppendResp_Error); ok { - return x.Error + if x != nil { + if x, ok := x.Result.(*BatchAppendResp_Error); ok { + return x.Error + } } return nil } func (x *BatchAppendResp) GetSuccess() *BatchAppendResp_Success { - if x, ok := x.GetResult().(*BatchAppendResp_Success_); ok { - return x.Success + if x != nil { + if x, ok := x.Result.(*BatchAppendResp_Success_); ok { + return x.Success + } } return nil } @@ -618,37 +631,45 @@ func (x *BatchAppendResp) GetStreamIdentifier() *shared.StreamIdentifier { return nil } -func (m *BatchAppendResp) GetExpectedStreamPosition() isBatchAppendResp_ExpectedStreamPosition { - if m != nil { - return m.ExpectedStreamPosition +func (x *BatchAppendResp) GetExpectedStreamPosition() isBatchAppendResp_ExpectedStreamPosition { + if x != nil { + return x.ExpectedStreamPosition } return nil } func (x *BatchAppendResp) GetStreamPosition() uint64 { - if x, ok := x.GetExpectedStreamPosition().(*BatchAppendResp_StreamPosition); ok { - return x.StreamPosition + if x != nil { + if x, ok := x.ExpectedStreamPosition.(*BatchAppendResp_StreamPosition); ok { + return x.StreamPosition + } } return 0 } func (x *BatchAppendResp) GetNoStream() *emptypb.Empty { - if x, ok := x.GetExpectedStreamPosition().(*BatchAppendResp_NoStream); ok { - return x.NoStream + if x != nil { + if x, ok := x.ExpectedStreamPosition.(*BatchAppendResp_NoStream); ok { + return x.NoStream + } } return nil } func (x *BatchAppendResp) GetAny() *emptypb.Empty { - if x, ok := x.GetExpectedStreamPosition().(*BatchAppendResp_Any); ok { - return x.Any + if x != nil { + if x, ok := x.ExpectedStreamPosition.(*BatchAppendResp_Any); ok { + return x.Any + } } return nil } func (x *BatchAppendResp) GetStreamExists() *emptypb.Empty { - if x, ok := x.GetExpectedStreamPosition().(*BatchAppendResp_StreamExists); ok { - return x.StreamExists + if x != nil { + if x, ok := x.ExpectedStreamPosition.(*BatchAppendResp_StreamExists); ok { + return x.StreamExists + } } return nil } @@ -698,20 +719,17 @@ func (*BatchAppendResp_Any) isBatchAppendResp_ExpectedStreamPosition() {} func (*BatchAppendResp_StreamExists) isBatchAppendResp_ExpectedStreamPosition() {} type DeleteReq struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Options *DeleteReq_Options `protobuf:"bytes,1,opt,name=options,proto3" json:"options,omitempty"` unknownFields protoimpl.UnknownFields - - Options *DeleteReq_Options `protobuf:"bytes,1,opt,name=options,proto3" json:"options,omitempty"` + sizeCache protoimpl.SizeCache } func (x *DeleteReq) Reset() { *x = DeleteReq{} - if protoimpl.UnsafeEnabled { - mi := &file_streams_proto_msgTypes[6] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_streams_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *DeleteReq) String() string { @@ -722,7 +740,7 @@ func (*DeleteReq) ProtoMessage() {} func (x *DeleteReq) ProtoReflect() protoreflect.Message { mi := &file_streams_proto_msgTypes[6] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -745,24 +763,21 @@ func (x *DeleteReq) GetOptions() *DeleteReq_Options { } type DeleteResp struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Types that are assignable to PositionOption: + state protoimpl.MessageState `protogen:"open.v1"` + // Types that are valid to be assigned to PositionOption: // // *DeleteResp_Position_ // *DeleteResp_NoPosition PositionOption isDeleteResp_PositionOption `protobuf_oneof:"position_option"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *DeleteResp) Reset() { *x = DeleteResp{} - if protoimpl.UnsafeEnabled { - mi := &file_streams_proto_msgTypes[7] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_streams_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *DeleteResp) String() string { @@ -773,7 +788,7 @@ func (*DeleteResp) ProtoMessage() {} func (x *DeleteResp) ProtoReflect() protoreflect.Message { mi := &file_streams_proto_msgTypes[7] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -788,23 +803,27 @@ func (*DeleteResp) Descriptor() ([]byte, []int) { return file_streams_proto_rawDescGZIP(), []int{7} } -func (m *DeleteResp) GetPositionOption() isDeleteResp_PositionOption { - if m != nil { - return m.PositionOption +func (x *DeleteResp) GetPositionOption() isDeleteResp_PositionOption { + if x != nil { + return x.PositionOption } return nil } func (x *DeleteResp) GetPosition() *DeleteResp_Position { - if x, ok := x.GetPositionOption().(*DeleteResp_Position_); ok { - return x.Position + if x != nil { + if x, ok := x.PositionOption.(*DeleteResp_Position_); ok { + return x.Position + } } return nil } func (x *DeleteResp) GetNoPosition() *shared.Empty { - if x, ok := x.GetPositionOption().(*DeleteResp_NoPosition); ok { - return x.NoPosition + if x != nil { + if x, ok := x.PositionOption.(*DeleteResp_NoPosition); ok { + return x.NoPosition + } } return nil } @@ -826,20 +845,17 @@ func (*DeleteResp_Position_) isDeleteResp_PositionOption() {} func (*DeleteResp_NoPosition) isDeleteResp_PositionOption() {} type TombstoneReq struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Options *TombstoneReq_Options `protobuf:"bytes,1,opt,name=options,proto3" json:"options,omitempty"` unknownFields protoimpl.UnknownFields - - Options *TombstoneReq_Options `protobuf:"bytes,1,opt,name=options,proto3" json:"options,omitempty"` + sizeCache protoimpl.SizeCache } func (x *TombstoneReq) Reset() { *x = TombstoneReq{} - if protoimpl.UnsafeEnabled { - mi := &file_streams_proto_msgTypes[8] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_streams_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *TombstoneReq) String() string { @@ -850,7 +866,7 @@ func (*TombstoneReq) ProtoMessage() {} func (x *TombstoneReq) ProtoReflect() protoreflect.Message { mi := &file_streams_proto_msgTypes[8] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -873,24 +889,21 @@ func (x *TombstoneReq) GetOptions() *TombstoneReq_Options { } type TombstoneResp struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Types that are assignable to PositionOption: + state protoimpl.MessageState `protogen:"open.v1"` + // Types that are valid to be assigned to PositionOption: // // *TombstoneResp_Position_ // *TombstoneResp_NoPosition PositionOption isTombstoneResp_PositionOption `protobuf_oneof:"position_option"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *TombstoneResp) Reset() { *x = TombstoneResp{} - if protoimpl.UnsafeEnabled { - mi := &file_streams_proto_msgTypes[9] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_streams_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *TombstoneResp) String() string { @@ -901,7 +914,7 @@ func (*TombstoneResp) ProtoMessage() {} func (x *TombstoneResp) ProtoReflect() protoreflect.Message { mi := &file_streams_proto_msgTypes[9] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -916,23 +929,27 @@ func (*TombstoneResp) Descriptor() ([]byte, []int) { return file_streams_proto_rawDescGZIP(), []int{9} } -func (m *TombstoneResp) GetPositionOption() isTombstoneResp_PositionOption { - if m != nil { - return m.PositionOption +func (x *TombstoneResp) GetPositionOption() isTombstoneResp_PositionOption { + if x != nil { + return x.PositionOption } return nil } func (x *TombstoneResp) GetPosition() *TombstoneResp_Position { - if x, ok := x.GetPositionOption().(*TombstoneResp_Position_); ok { - return x.Position + if x != nil { + if x, ok := x.PositionOption.(*TombstoneResp_Position_); ok { + return x.Position + } } return nil } func (x *TombstoneResp) GetNoPosition() *shared.Empty { - if x, ok := x.GetPositionOption().(*TombstoneResp_NoPosition); ok { - return x.NoPosition + if x != nil { + if x, ok := x.PositionOption.(*TombstoneResp_NoPosition); ok { + return x.NoPosition + } } return nil } @@ -954,38 +971,35 @@ func (*TombstoneResp_Position_) isTombstoneResp_PositionOption() {} func (*TombstoneResp_NoPosition) isTombstoneResp_PositionOption() {} type ReadReq_Options struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Types that are assignable to StreamOption: + state protoimpl.MessageState `protogen:"open.v1"` + // Types that are valid to be assigned to StreamOption: // // *ReadReq_Options_Stream // *ReadReq_Options_All StreamOption isReadReq_Options_StreamOption `protobuf_oneof:"stream_option"` ReadDirection ReadReq_Options_ReadDirection `protobuf:"varint,3,opt,name=read_direction,json=readDirection,proto3,enum=event_store.client.streams.ReadReq_Options_ReadDirection" json:"read_direction,omitempty"` ResolveLinks bool `protobuf:"varint,4,opt,name=resolve_links,json=resolveLinks,proto3" json:"resolve_links,omitempty"` - // Types that are assignable to CountOption: + // Types that are valid to be assigned to CountOption: // // *ReadReq_Options_Count // *ReadReq_Options_Subscription CountOption isReadReq_Options_CountOption `protobuf_oneof:"count_option"` - // Types that are assignable to FilterOption: + // Types that are valid to be assigned to FilterOption: // // *ReadReq_Options_Filter // *ReadReq_Options_NoFilter FilterOption isReadReq_Options_FilterOption `protobuf_oneof:"filter_option"` UuidOption *ReadReq_Options_UUIDOption `protobuf:"bytes,9,opt,name=uuid_option,json=uuidOption,proto3" json:"uuid_option,omitempty"` ControlOption *ReadReq_Options_ControlOption `protobuf:"bytes,10,opt,name=control_option,json=controlOption,proto3" json:"control_option,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *ReadReq_Options) Reset() { *x = ReadReq_Options{} - if protoimpl.UnsafeEnabled { - mi := &file_streams_proto_msgTypes[10] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_streams_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *ReadReq_Options) String() string { @@ -996,7 +1010,7 @@ func (*ReadReq_Options) ProtoMessage() {} func (x *ReadReq_Options) ProtoReflect() protoreflect.Message { mi := &file_streams_proto_msgTypes[10] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -1011,23 +1025,27 @@ func (*ReadReq_Options) Descriptor() ([]byte, []int) { return file_streams_proto_rawDescGZIP(), []int{0, 0} } -func (m *ReadReq_Options) GetStreamOption() isReadReq_Options_StreamOption { - if m != nil { - return m.StreamOption +func (x *ReadReq_Options) GetStreamOption() isReadReq_Options_StreamOption { + if x != nil { + return x.StreamOption } return nil } func (x *ReadReq_Options) GetStream() *ReadReq_Options_StreamOptions { - if x, ok := x.GetStreamOption().(*ReadReq_Options_Stream); ok { - return x.Stream + if x != nil { + if x, ok := x.StreamOption.(*ReadReq_Options_Stream); ok { + return x.Stream + } } return nil } func (x *ReadReq_Options) GetAll() *ReadReq_Options_AllOptions { - if x, ok := x.GetStreamOption().(*ReadReq_Options_All); ok { - return x.All + if x != nil { + if x, ok := x.StreamOption.(*ReadReq_Options_All); ok { + return x.All + } } return nil } @@ -1046,44 +1064,52 @@ func (x *ReadReq_Options) GetResolveLinks() bool { return false } -func (m *ReadReq_Options) GetCountOption() isReadReq_Options_CountOption { - if m != nil { - return m.CountOption +func (x *ReadReq_Options) GetCountOption() isReadReq_Options_CountOption { + if x != nil { + return x.CountOption } return nil } func (x *ReadReq_Options) GetCount() uint64 { - if x, ok := x.GetCountOption().(*ReadReq_Options_Count); ok { - return x.Count + if x != nil { + if x, ok := x.CountOption.(*ReadReq_Options_Count); ok { + return x.Count + } } return 0 } func (x *ReadReq_Options) GetSubscription() *ReadReq_Options_SubscriptionOptions { - if x, ok := x.GetCountOption().(*ReadReq_Options_Subscription); ok { - return x.Subscription + if x != nil { + if x, ok := x.CountOption.(*ReadReq_Options_Subscription); ok { + return x.Subscription + } } return nil } -func (m *ReadReq_Options) GetFilterOption() isReadReq_Options_FilterOption { - if m != nil { - return m.FilterOption +func (x *ReadReq_Options) GetFilterOption() isReadReq_Options_FilterOption { + if x != nil { + return x.FilterOption } return nil } func (x *ReadReq_Options) GetFilter() *ReadReq_Options_FilterOptions { - if x, ok := x.GetFilterOption().(*ReadReq_Options_Filter); ok { - return x.Filter + if x != nil { + if x, ok := x.FilterOption.(*ReadReq_Options_Filter); ok { + return x.Filter + } } return nil } func (x *ReadReq_Options) GetNoFilter() *shared.Empty { - if x, ok := x.GetFilterOption().(*ReadReq_Options_NoFilter); ok { - return x.NoFilter + if x != nil { + if x, ok := x.FilterOption.(*ReadReq_Options_NoFilter); ok { + return x.NoFilter + } } return nil } @@ -1151,26 +1177,23 @@ func (*ReadReq_Options_Filter) isReadReq_Options_FilterOption() {} func (*ReadReq_Options_NoFilter) isReadReq_Options_FilterOption() {} type ReadReq_Options_StreamOptions struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - + state protoimpl.MessageState `protogen:"open.v1"` StreamIdentifier *shared.StreamIdentifier `protobuf:"bytes,1,opt,name=stream_identifier,json=streamIdentifier,proto3" json:"stream_identifier,omitempty"` - // Types that are assignable to RevisionOption: + // Types that are valid to be assigned to RevisionOption: // // *ReadReq_Options_StreamOptions_Revision // *ReadReq_Options_StreamOptions_Start // *ReadReq_Options_StreamOptions_End RevisionOption isReadReq_Options_StreamOptions_RevisionOption `protobuf_oneof:"revision_option"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *ReadReq_Options_StreamOptions) Reset() { *x = ReadReq_Options_StreamOptions{} - if protoimpl.UnsafeEnabled { - mi := &file_streams_proto_msgTypes[11] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_streams_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *ReadReq_Options_StreamOptions) String() string { @@ -1181,7 +1204,7 @@ func (*ReadReq_Options_StreamOptions) ProtoMessage() {} func (x *ReadReq_Options_StreamOptions) ProtoReflect() protoreflect.Message { mi := &file_streams_proto_msgTypes[11] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -1203,30 +1226,36 @@ func (x *ReadReq_Options_StreamOptions) GetStreamIdentifier() *shared.StreamIden return nil } -func (m *ReadReq_Options_StreamOptions) GetRevisionOption() isReadReq_Options_StreamOptions_RevisionOption { - if m != nil { - return m.RevisionOption +func (x *ReadReq_Options_StreamOptions) GetRevisionOption() isReadReq_Options_StreamOptions_RevisionOption { + if x != nil { + return x.RevisionOption } return nil } func (x *ReadReq_Options_StreamOptions) GetRevision() uint64 { - if x, ok := x.GetRevisionOption().(*ReadReq_Options_StreamOptions_Revision); ok { - return x.Revision + if x != nil { + if x, ok := x.RevisionOption.(*ReadReq_Options_StreamOptions_Revision); ok { + return x.Revision + } } return 0 } func (x *ReadReq_Options_StreamOptions) GetStart() *shared.Empty { - if x, ok := x.GetRevisionOption().(*ReadReq_Options_StreamOptions_Start); ok { - return x.Start + if x != nil { + if x, ok := x.RevisionOption.(*ReadReq_Options_StreamOptions_Start); ok { + return x.Start + } } return nil } func (x *ReadReq_Options_StreamOptions) GetEnd() *shared.Empty { - if x, ok := x.GetRevisionOption().(*ReadReq_Options_StreamOptions_End); ok { - return x.End + if x != nil { + if x, ok := x.RevisionOption.(*ReadReq_Options_StreamOptions_End); ok { + return x.End + } } return nil } @@ -1254,25 +1283,22 @@ func (*ReadReq_Options_StreamOptions_Start) isReadReq_Options_StreamOptions_Revi func (*ReadReq_Options_StreamOptions_End) isReadReq_Options_StreamOptions_RevisionOption() {} type ReadReq_Options_AllOptions struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Types that are assignable to AllOption: + state protoimpl.MessageState `protogen:"open.v1"` + // Types that are valid to be assigned to AllOption: // // *ReadReq_Options_AllOptions_Position // *ReadReq_Options_AllOptions_Start // *ReadReq_Options_AllOptions_End - AllOption isReadReq_Options_AllOptions_AllOption `protobuf_oneof:"all_option"` + AllOption isReadReq_Options_AllOptions_AllOption `protobuf_oneof:"all_option"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *ReadReq_Options_AllOptions) Reset() { *x = ReadReq_Options_AllOptions{} - if protoimpl.UnsafeEnabled { - mi := &file_streams_proto_msgTypes[12] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_streams_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *ReadReq_Options_AllOptions) String() string { @@ -1283,7 +1309,7 @@ func (*ReadReq_Options_AllOptions) ProtoMessage() {} func (x *ReadReq_Options_AllOptions) ProtoReflect() protoreflect.Message { mi := &file_streams_proto_msgTypes[12] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -1298,30 +1324,36 @@ func (*ReadReq_Options_AllOptions) Descriptor() ([]byte, []int) { return file_streams_proto_rawDescGZIP(), []int{0, 0, 1} } -func (m *ReadReq_Options_AllOptions) GetAllOption() isReadReq_Options_AllOptions_AllOption { - if m != nil { - return m.AllOption +func (x *ReadReq_Options_AllOptions) GetAllOption() isReadReq_Options_AllOptions_AllOption { + if x != nil { + return x.AllOption } return nil } func (x *ReadReq_Options_AllOptions) GetPosition() *ReadReq_Options_Position { - if x, ok := x.GetAllOption().(*ReadReq_Options_AllOptions_Position); ok { - return x.Position + if x != nil { + if x, ok := x.AllOption.(*ReadReq_Options_AllOptions_Position); ok { + return x.Position + } } return nil } func (x *ReadReq_Options_AllOptions) GetStart() *shared.Empty { - if x, ok := x.GetAllOption().(*ReadReq_Options_AllOptions_Start); ok { - return x.Start + if x != nil { + if x, ok := x.AllOption.(*ReadReq_Options_AllOptions_Start); ok { + return x.Start + } } return nil } func (x *ReadReq_Options_AllOptions) GetEnd() *shared.Empty { - if x, ok := x.GetAllOption().(*ReadReq_Options_AllOptions_End); ok { - return x.End + if x != nil { + if x, ok := x.AllOption.(*ReadReq_Options_AllOptions_End); ok { + return x.End + } } return nil } @@ -1349,18 +1381,16 @@ func (*ReadReq_Options_AllOptions_Start) isReadReq_Options_AllOptions_AllOption( func (*ReadReq_Options_AllOptions_End) isReadReq_Options_AllOptions_AllOption() {} type ReadReq_Options_SubscriptionOptions struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *ReadReq_Options_SubscriptionOptions) Reset() { *x = ReadReq_Options_SubscriptionOptions{} - if protoimpl.UnsafeEnabled { - mi := &file_streams_proto_msgTypes[13] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_streams_proto_msgTypes[13] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *ReadReq_Options_SubscriptionOptions) String() string { @@ -1371,7 +1401,7 @@ func (*ReadReq_Options_SubscriptionOptions) ProtoMessage() {} func (x *ReadReq_Options_SubscriptionOptions) ProtoReflect() protoreflect.Message { mi := &file_streams_proto_msgTypes[13] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -1387,21 +1417,18 @@ func (*ReadReq_Options_SubscriptionOptions) Descriptor() ([]byte, []int) { } type ReadReq_Options_Position struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - CommitPosition uint64 `protobuf:"varint,1,opt,name=commit_position,json=commitPosition,proto3" json:"commit_position,omitempty"` - PreparePosition uint64 `protobuf:"varint,2,opt,name=prepare_position,json=preparePosition,proto3" json:"prepare_position,omitempty"` + state protoimpl.MessageState `protogen:"open.v1"` + CommitPosition uint64 `protobuf:"varint,1,opt,name=commit_position,json=commitPosition,proto3" json:"commit_position,omitempty"` + PreparePosition uint64 `protobuf:"varint,2,opt,name=prepare_position,json=preparePosition,proto3" json:"prepare_position,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *ReadReq_Options_Position) Reset() { *x = ReadReq_Options_Position{} - if protoimpl.UnsafeEnabled { - mi := &file_streams_proto_msgTypes[14] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_streams_proto_msgTypes[14] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *ReadReq_Options_Position) String() string { @@ -1412,7 +1439,7 @@ func (*ReadReq_Options_Position) ProtoMessage() {} func (x *ReadReq_Options_Position) ProtoReflect() protoreflect.Message { mi := &file_streams_proto_msgTypes[14] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -1442,30 +1469,27 @@ func (x *ReadReq_Options_Position) GetPreparePosition() uint64 { } type ReadReq_Options_FilterOptions struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Types that are assignable to Filter: + state protoimpl.MessageState `protogen:"open.v1"` + // Types that are valid to be assigned to Filter: // // *ReadReq_Options_FilterOptions_StreamIdentifier // *ReadReq_Options_FilterOptions_EventType Filter isReadReq_Options_FilterOptions_Filter `protobuf_oneof:"filter"` - // Types that are assignable to Window: + // Types that are valid to be assigned to Window: // // *ReadReq_Options_FilterOptions_Max // *ReadReq_Options_FilterOptions_Count Window isReadReq_Options_FilterOptions_Window `protobuf_oneof:"window"` CheckpointIntervalMultiplier uint32 `protobuf:"varint,5,opt,name=checkpointIntervalMultiplier,proto3" json:"checkpointIntervalMultiplier,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *ReadReq_Options_FilterOptions) Reset() { *x = ReadReq_Options_FilterOptions{} - if protoimpl.UnsafeEnabled { - mi := &file_streams_proto_msgTypes[15] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_streams_proto_msgTypes[15] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *ReadReq_Options_FilterOptions) String() string { @@ -1476,7 +1500,7 @@ func (*ReadReq_Options_FilterOptions) ProtoMessage() {} func (x *ReadReq_Options_FilterOptions) ProtoReflect() protoreflect.Message { mi := &file_streams_proto_msgTypes[15] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -1491,44 +1515,52 @@ func (*ReadReq_Options_FilterOptions) Descriptor() ([]byte, []int) { return file_streams_proto_rawDescGZIP(), []int{0, 0, 4} } -func (m *ReadReq_Options_FilterOptions) GetFilter() isReadReq_Options_FilterOptions_Filter { - if m != nil { - return m.Filter +func (x *ReadReq_Options_FilterOptions) GetFilter() isReadReq_Options_FilterOptions_Filter { + if x != nil { + return x.Filter } return nil } func (x *ReadReq_Options_FilterOptions) GetStreamIdentifier() *ReadReq_Options_FilterOptions_Expression { - if x, ok := x.GetFilter().(*ReadReq_Options_FilterOptions_StreamIdentifier); ok { - return x.StreamIdentifier + if x != nil { + if x, ok := x.Filter.(*ReadReq_Options_FilterOptions_StreamIdentifier); ok { + return x.StreamIdentifier + } } return nil } func (x *ReadReq_Options_FilterOptions) GetEventType() *ReadReq_Options_FilterOptions_Expression { - if x, ok := x.GetFilter().(*ReadReq_Options_FilterOptions_EventType); ok { - return x.EventType + if x != nil { + if x, ok := x.Filter.(*ReadReq_Options_FilterOptions_EventType); ok { + return x.EventType + } } return nil } -func (m *ReadReq_Options_FilterOptions) GetWindow() isReadReq_Options_FilterOptions_Window { - if m != nil { - return m.Window +func (x *ReadReq_Options_FilterOptions) GetWindow() isReadReq_Options_FilterOptions_Window { + if x != nil { + return x.Window } return nil } func (x *ReadReq_Options_FilterOptions) GetMax() uint32 { - if x, ok := x.GetWindow().(*ReadReq_Options_FilterOptions_Max); ok { - return x.Max + if x != nil { + if x, ok := x.Window.(*ReadReq_Options_FilterOptions_Max); ok { + return x.Max + } } return 0 } func (x *ReadReq_Options_FilterOptions) GetCount() *shared.Empty { - if x, ok := x.GetWindow().(*ReadReq_Options_FilterOptions_Count); ok { - return x.Count + if x != nil { + if x, ok := x.Window.(*ReadReq_Options_FilterOptions_Count); ok { + return x.Count + } } return nil } @@ -1573,24 +1605,21 @@ func (*ReadReq_Options_FilterOptions_Max) isReadReq_Options_FilterOptions_Window func (*ReadReq_Options_FilterOptions_Count) isReadReq_Options_FilterOptions_Window() {} type ReadReq_Options_UUIDOption struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Types that are assignable to Content: + state protoimpl.MessageState `protogen:"open.v1"` + // Types that are valid to be assigned to Content: // // *ReadReq_Options_UUIDOption_Structured // *ReadReq_Options_UUIDOption_String_ - Content isReadReq_Options_UUIDOption_Content `protobuf_oneof:"content"` + Content isReadReq_Options_UUIDOption_Content `protobuf_oneof:"content"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *ReadReq_Options_UUIDOption) Reset() { *x = ReadReq_Options_UUIDOption{} - if protoimpl.UnsafeEnabled { - mi := &file_streams_proto_msgTypes[16] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_streams_proto_msgTypes[16] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *ReadReq_Options_UUIDOption) String() string { @@ -1601,7 +1630,7 @@ func (*ReadReq_Options_UUIDOption) ProtoMessage() {} func (x *ReadReq_Options_UUIDOption) ProtoReflect() protoreflect.Message { mi := &file_streams_proto_msgTypes[16] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -1616,23 +1645,27 @@ func (*ReadReq_Options_UUIDOption) Descriptor() ([]byte, []int) { return file_streams_proto_rawDescGZIP(), []int{0, 0, 5} } -func (m *ReadReq_Options_UUIDOption) GetContent() isReadReq_Options_UUIDOption_Content { - if m != nil { - return m.Content +func (x *ReadReq_Options_UUIDOption) GetContent() isReadReq_Options_UUIDOption_Content { + if x != nil { + return x.Content } return nil } func (x *ReadReq_Options_UUIDOption) GetStructured() *shared.Empty { - if x, ok := x.GetContent().(*ReadReq_Options_UUIDOption_Structured); ok { - return x.Structured + if x != nil { + if x, ok := x.Content.(*ReadReq_Options_UUIDOption_Structured); ok { + return x.Structured + } } return nil } func (x *ReadReq_Options_UUIDOption) GetString_() *shared.Empty { - if x, ok := x.GetContent().(*ReadReq_Options_UUIDOption_String_); ok { - return x.String_ + if x != nil { + if x, ok := x.Content.(*ReadReq_Options_UUIDOption_String_); ok { + return x.String_ + } } return nil } @@ -1654,20 +1687,17 @@ func (*ReadReq_Options_UUIDOption_Structured) isReadReq_Options_UUIDOption_Conte func (*ReadReq_Options_UUIDOption_String_) isReadReq_Options_UUIDOption_Content() {} type ReadReq_Options_ControlOption struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Compatibility uint32 `protobuf:"varint,1,opt,name=compatibility,proto3" json:"compatibility,omitempty"` unknownFields protoimpl.UnknownFields - - Compatibility uint32 `protobuf:"varint,1,opt,name=compatibility,proto3" json:"compatibility,omitempty"` + sizeCache protoimpl.SizeCache } func (x *ReadReq_Options_ControlOption) Reset() { *x = ReadReq_Options_ControlOption{} - if protoimpl.UnsafeEnabled { - mi := &file_streams_proto_msgTypes[17] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_streams_proto_msgTypes[17] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *ReadReq_Options_ControlOption) String() string { @@ -1678,7 +1708,7 @@ func (*ReadReq_Options_ControlOption) ProtoMessage() {} func (x *ReadReq_Options_ControlOption) ProtoReflect() protoreflect.Message { mi := &file_streams_proto_msgTypes[17] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -1701,21 +1731,18 @@ func (x *ReadReq_Options_ControlOption) GetCompatibility() uint32 { } type ReadReq_Options_FilterOptions_Expression struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Regex string `protobuf:"bytes,1,opt,name=regex,proto3" json:"regex,omitempty"` + Prefix []string `protobuf:"bytes,2,rep,name=prefix,proto3" json:"prefix,omitempty"` unknownFields protoimpl.UnknownFields - - Regex string `protobuf:"bytes,1,opt,name=regex,proto3" json:"regex,omitempty"` - Prefix []string `protobuf:"bytes,2,rep,name=prefix,proto3" json:"prefix,omitempty"` + sizeCache protoimpl.SizeCache } func (x *ReadReq_Options_FilterOptions_Expression) Reset() { *x = ReadReq_Options_FilterOptions_Expression{} - if protoimpl.UnsafeEnabled { - mi := &file_streams_proto_msgTypes[18] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_streams_proto_msgTypes[18] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *ReadReq_Options_FilterOptions_Expression) String() string { @@ -1726,7 +1753,7 @@ func (*ReadReq_Options_FilterOptions_Expression) ProtoMessage() {} func (x *ReadReq_Options_FilterOptions_Expression) ProtoReflect() protoreflect.Message { mi := &file_streams_proto_msgTypes[18] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -1756,18 +1783,16 @@ func (x *ReadReq_Options_FilterOptions_Expression) GetPrefix() []string { } type ReadResp_CaughtUp struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *ReadResp_CaughtUp) Reset() { *x = ReadResp_CaughtUp{} - if protoimpl.UnsafeEnabled { - mi := &file_streams_proto_msgTypes[19] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_streams_proto_msgTypes[19] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *ReadResp_CaughtUp) String() string { @@ -1778,7 +1803,7 @@ func (*ReadResp_CaughtUp) ProtoMessage() {} func (x *ReadResp_CaughtUp) ProtoReflect() protoreflect.Message { mi := &file_streams_proto_msgTypes[19] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -1794,18 +1819,16 @@ func (*ReadResp_CaughtUp) Descriptor() ([]byte, []int) { } type ReadResp_FellBehind struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *ReadResp_FellBehind) Reset() { *x = ReadResp_FellBehind{} - if protoimpl.UnsafeEnabled { - mi := &file_streams_proto_msgTypes[20] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_streams_proto_msgTypes[20] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *ReadResp_FellBehind) String() string { @@ -1816,7 +1839,7 @@ func (*ReadResp_FellBehind) ProtoMessage() {} func (x *ReadResp_FellBehind) ProtoReflect() protoreflect.Message { mi := &file_streams_proto_msgTypes[20] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -1829,29 +1852,26 @@ func (x *ReadResp_FellBehind) ProtoReflect() protoreflect.Message { // Deprecated: Use ReadResp_FellBehind.ProtoReflect.Descriptor instead. func (*ReadResp_FellBehind) Descriptor() ([]byte, []int) { return file_streams_proto_rawDescGZIP(), []int{1, 1} -} - -type ReadResp_ReadEvent struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields +} +type ReadResp_ReadEvent struct { + state protoimpl.MessageState `protogen:"open.v1"` Event *ReadResp_ReadEvent_RecordedEvent `protobuf:"bytes,1,opt,name=event,proto3" json:"event,omitempty"` Link *ReadResp_ReadEvent_RecordedEvent `protobuf:"bytes,2,opt,name=link,proto3" json:"link,omitempty"` - // Types that are assignable to Position: + // Types that are valid to be assigned to Position: // // *ReadResp_ReadEvent_CommitPosition // *ReadResp_ReadEvent_NoPosition - Position isReadResp_ReadEvent_Position `protobuf_oneof:"position"` + Position isReadResp_ReadEvent_Position `protobuf_oneof:"position"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *ReadResp_ReadEvent) Reset() { *x = ReadResp_ReadEvent{} - if protoimpl.UnsafeEnabled { - mi := &file_streams_proto_msgTypes[21] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_streams_proto_msgTypes[21] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *ReadResp_ReadEvent) String() string { @@ -1862,7 +1882,7 @@ func (*ReadResp_ReadEvent) ProtoMessage() {} func (x *ReadResp_ReadEvent) ProtoReflect() protoreflect.Message { mi := &file_streams_proto_msgTypes[21] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -1891,23 +1911,27 @@ func (x *ReadResp_ReadEvent) GetLink() *ReadResp_ReadEvent_RecordedEvent { return nil } -func (m *ReadResp_ReadEvent) GetPosition() isReadResp_ReadEvent_Position { - if m != nil { - return m.Position +func (x *ReadResp_ReadEvent) GetPosition() isReadResp_ReadEvent_Position { + if x != nil { + return x.Position } return nil } func (x *ReadResp_ReadEvent) GetCommitPosition() uint64 { - if x, ok := x.GetPosition().(*ReadResp_ReadEvent_CommitPosition); ok { - return x.CommitPosition + if x != nil { + if x, ok := x.Position.(*ReadResp_ReadEvent_CommitPosition); ok { + return x.CommitPosition + } } return 0 } func (x *ReadResp_ReadEvent) GetNoPosition() *shared.Empty { - if x, ok := x.GetPosition().(*ReadResp_ReadEvent_NoPosition); ok { - return x.NoPosition + if x != nil { + if x, ok := x.Position.(*ReadResp_ReadEvent_NoPosition); ok { + return x.NoPosition + } } return nil } @@ -1929,20 +1953,17 @@ func (*ReadResp_ReadEvent_CommitPosition) isReadResp_ReadEvent_Position() {} func (*ReadResp_ReadEvent_NoPosition) isReadResp_ReadEvent_Position() {} type ReadResp_SubscriptionConfirmation struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - SubscriptionId string `protobuf:"bytes,1,opt,name=subscription_id,json=subscriptionId,proto3" json:"subscription_id,omitempty"` + state protoimpl.MessageState `protogen:"open.v1"` + SubscriptionId string `protobuf:"bytes,1,opt,name=subscription_id,json=subscriptionId,proto3" json:"subscription_id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *ReadResp_SubscriptionConfirmation) Reset() { *x = ReadResp_SubscriptionConfirmation{} - if protoimpl.UnsafeEnabled { - mi := &file_streams_proto_msgTypes[22] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_streams_proto_msgTypes[22] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *ReadResp_SubscriptionConfirmation) String() string { @@ -1953,7 +1974,7 @@ func (*ReadResp_SubscriptionConfirmation) ProtoMessage() {} func (x *ReadResp_SubscriptionConfirmation) ProtoReflect() protoreflect.Message { mi := &file_streams_proto_msgTypes[22] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -1976,21 +1997,18 @@ func (x *ReadResp_SubscriptionConfirmation) GetSubscriptionId() string { } type ReadResp_Checkpoint struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - CommitPosition uint64 `protobuf:"varint,1,opt,name=commit_position,json=commitPosition,proto3" json:"commit_position,omitempty"` - PreparePosition uint64 `protobuf:"varint,2,opt,name=prepare_position,json=preparePosition,proto3" json:"prepare_position,omitempty"` + state protoimpl.MessageState `protogen:"open.v1"` + CommitPosition uint64 `protobuf:"varint,1,opt,name=commit_position,json=commitPosition,proto3" json:"commit_position,omitempty"` + PreparePosition uint64 `protobuf:"varint,2,opt,name=prepare_position,json=preparePosition,proto3" json:"prepare_position,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *ReadResp_Checkpoint) Reset() { *x = ReadResp_Checkpoint{} - if protoimpl.UnsafeEnabled { - mi := &file_streams_proto_msgTypes[23] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_streams_proto_msgTypes[23] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *ReadResp_Checkpoint) String() string { @@ -2001,7 +2019,7 @@ func (*ReadResp_Checkpoint) ProtoMessage() {} func (x *ReadResp_Checkpoint) ProtoReflect() protoreflect.Message { mi := &file_streams_proto_msgTypes[23] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -2031,20 +2049,17 @@ func (x *ReadResp_Checkpoint) GetPreparePosition() uint64 { } type ReadResp_StreamNotFound struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - + state protoimpl.MessageState `protogen:"open.v1"` StreamIdentifier *shared.StreamIdentifier `protobuf:"bytes,1,opt,name=stream_identifier,json=streamIdentifier,proto3" json:"stream_identifier,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *ReadResp_StreamNotFound) Reset() { *x = ReadResp_StreamNotFound{} - if protoimpl.UnsafeEnabled { - mi := &file_streams_proto_msgTypes[24] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_streams_proto_msgTypes[24] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *ReadResp_StreamNotFound) String() string { @@ -2055,7 +2070,7 @@ func (*ReadResp_StreamNotFound) ProtoMessage() {} func (x *ReadResp_StreamNotFound) ProtoReflect() protoreflect.Message { mi := &file_streams_proto_msgTypes[24] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -2078,27 +2093,24 @@ func (x *ReadResp_StreamNotFound) GetStreamIdentifier() *shared.StreamIdentifier } type ReadResp_ReadEvent_RecordedEvent struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - + state protoimpl.MessageState `protogen:"open.v1"` Id *shared.UUID `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` StreamIdentifier *shared.StreamIdentifier `protobuf:"bytes,2,opt,name=stream_identifier,json=streamIdentifier,proto3" json:"stream_identifier,omitempty"` StreamRevision uint64 `protobuf:"varint,3,opt,name=stream_revision,json=streamRevision,proto3" json:"stream_revision,omitempty"` PreparePosition uint64 `protobuf:"varint,4,opt,name=prepare_position,json=preparePosition,proto3" json:"prepare_position,omitempty"` CommitPosition uint64 `protobuf:"varint,5,opt,name=commit_position,json=commitPosition,proto3" json:"commit_position,omitempty"` - Metadata map[string]string `protobuf:"bytes,6,rep,name=metadata,proto3" json:"metadata,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + Metadata map[string]string `protobuf:"bytes,6,rep,name=metadata,proto3" json:"metadata,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` CustomMetadata []byte `protobuf:"bytes,7,opt,name=custom_metadata,json=customMetadata,proto3" json:"custom_metadata,omitempty"` Data []byte `protobuf:"bytes,8,opt,name=data,proto3" json:"data,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *ReadResp_ReadEvent_RecordedEvent) Reset() { *x = ReadResp_ReadEvent_RecordedEvent{} - if protoimpl.UnsafeEnabled { - mi := &file_streams_proto_msgTypes[25] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_streams_proto_msgTypes[25] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *ReadResp_ReadEvent_RecordedEvent) String() string { @@ -2109,7 +2121,7 @@ func (*ReadResp_ReadEvent_RecordedEvent) ProtoMessage() {} func (x *ReadResp_ReadEvent_RecordedEvent) ProtoReflect() protoreflect.Message { mi := &file_streams_proto_msgTypes[25] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -2181,27 +2193,24 @@ func (x *ReadResp_ReadEvent_RecordedEvent) GetData() []byte { } type AppendReq_Options struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - + state protoimpl.MessageState `protogen:"open.v1"` StreamIdentifier *shared.StreamIdentifier `protobuf:"bytes,1,opt,name=stream_identifier,json=streamIdentifier,proto3" json:"stream_identifier,omitempty"` - // Types that are assignable to ExpectedStreamRevision: + // Types that are valid to be assigned to ExpectedStreamRevision: // // *AppendReq_Options_Revision // *AppendReq_Options_NoStream // *AppendReq_Options_Any // *AppendReq_Options_StreamExists ExpectedStreamRevision isAppendReq_Options_ExpectedStreamRevision `protobuf_oneof:"expected_stream_revision"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *AppendReq_Options) Reset() { *x = AppendReq_Options{} - if protoimpl.UnsafeEnabled { - mi := &file_streams_proto_msgTypes[27] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_streams_proto_msgTypes[27] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *AppendReq_Options) String() string { @@ -2212,7 +2221,7 @@ func (*AppendReq_Options) ProtoMessage() {} func (x *AppendReq_Options) ProtoReflect() protoreflect.Message { mi := &file_streams_proto_msgTypes[27] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -2234,37 +2243,45 @@ func (x *AppendReq_Options) GetStreamIdentifier() *shared.StreamIdentifier { return nil } -func (m *AppendReq_Options) GetExpectedStreamRevision() isAppendReq_Options_ExpectedStreamRevision { - if m != nil { - return m.ExpectedStreamRevision +func (x *AppendReq_Options) GetExpectedStreamRevision() isAppendReq_Options_ExpectedStreamRevision { + if x != nil { + return x.ExpectedStreamRevision } return nil } func (x *AppendReq_Options) GetRevision() uint64 { - if x, ok := x.GetExpectedStreamRevision().(*AppendReq_Options_Revision); ok { - return x.Revision + if x != nil { + if x, ok := x.ExpectedStreamRevision.(*AppendReq_Options_Revision); ok { + return x.Revision + } } return 0 } func (x *AppendReq_Options) GetNoStream() *shared.Empty { - if x, ok := x.GetExpectedStreamRevision().(*AppendReq_Options_NoStream); ok { - return x.NoStream + if x != nil { + if x, ok := x.ExpectedStreamRevision.(*AppendReq_Options_NoStream); ok { + return x.NoStream + } } return nil } func (x *AppendReq_Options) GetAny() *shared.Empty { - if x, ok := x.GetExpectedStreamRevision().(*AppendReq_Options_Any); ok { - return x.Any + if x != nil { + if x, ok := x.ExpectedStreamRevision.(*AppendReq_Options_Any); ok { + return x.Any + } } return nil } func (x *AppendReq_Options) GetStreamExists() *shared.Empty { - if x, ok := x.GetExpectedStreamRevision().(*AppendReq_Options_StreamExists); ok { - return x.StreamExists + if x != nil { + if x, ok := x.ExpectedStreamRevision.(*AppendReq_Options_StreamExists); ok { + return x.StreamExists + } } return nil } @@ -2298,23 +2315,20 @@ func (*AppendReq_Options_Any) isAppendReq_Options_ExpectedStreamRevision() {} func (*AppendReq_Options_StreamExists) isAppendReq_Options_ExpectedStreamRevision() {} type AppendReq_ProposedMessage struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Id *shared.UUID `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` - Metadata map[string]string `protobuf:"bytes,2,rep,name=metadata,proto3" json:"metadata,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` - CustomMetadata []byte `protobuf:"bytes,3,opt,name=custom_metadata,json=customMetadata,proto3" json:"custom_metadata,omitempty"` - Data []byte `protobuf:"bytes,4,opt,name=data,proto3" json:"data,omitempty"` + state protoimpl.MessageState `protogen:"open.v1"` + Id *shared.UUID `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + Metadata map[string]string `protobuf:"bytes,2,rep,name=metadata,proto3" json:"metadata,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` + CustomMetadata []byte `protobuf:"bytes,3,opt,name=custom_metadata,json=customMetadata,proto3" json:"custom_metadata,omitempty"` + Data []byte `protobuf:"bytes,4,opt,name=data,proto3" json:"data,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *AppendReq_ProposedMessage) Reset() { *x = AppendReq_ProposedMessage{} - if protoimpl.UnsafeEnabled { - mi := &file_streams_proto_msgTypes[28] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_streams_proto_msgTypes[28] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *AppendReq_ProposedMessage) String() string { @@ -2325,7 +2339,7 @@ func (*AppendReq_ProposedMessage) ProtoMessage() {} func (x *AppendReq_ProposedMessage) ProtoReflect() protoreflect.Message { mi := &file_streams_proto_msgTypes[28] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -2369,21 +2383,18 @@ func (x *AppendReq_ProposedMessage) GetData() []byte { } type AppendResp_Position struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - CommitPosition uint64 `protobuf:"varint,1,opt,name=commit_position,json=commitPosition,proto3" json:"commit_position,omitempty"` - PreparePosition uint64 `protobuf:"varint,2,opt,name=prepare_position,json=preparePosition,proto3" json:"prepare_position,omitempty"` + state protoimpl.MessageState `protogen:"open.v1"` + CommitPosition uint64 `protobuf:"varint,1,opt,name=commit_position,json=commitPosition,proto3" json:"commit_position,omitempty"` + PreparePosition uint64 `protobuf:"varint,2,opt,name=prepare_position,json=preparePosition,proto3" json:"prepare_position,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *AppendResp_Position) Reset() { *x = AppendResp_Position{} - if protoimpl.UnsafeEnabled { - mi := &file_streams_proto_msgTypes[30] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_streams_proto_msgTypes[30] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *AppendResp_Position) String() string { @@ -2394,7 +2405,7 @@ func (*AppendResp_Position) ProtoMessage() {} func (x *AppendResp_Position) ProtoReflect() protoreflect.Message { mi := &file_streams_proto_msgTypes[30] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -2424,29 +2435,26 @@ func (x *AppendResp_Position) GetPreparePosition() uint64 { } type AppendResp_Success struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Types that are assignable to CurrentRevisionOption: + state protoimpl.MessageState `protogen:"open.v1"` + // Types that are valid to be assigned to CurrentRevisionOption: // // *AppendResp_Success_CurrentRevision // *AppendResp_Success_NoStream CurrentRevisionOption isAppendResp_Success_CurrentRevisionOption `protobuf_oneof:"current_revision_option"` - // Types that are assignable to PositionOption: + // Types that are valid to be assigned to PositionOption: // // *AppendResp_Success_Position // *AppendResp_Success_NoPosition PositionOption isAppendResp_Success_PositionOption `protobuf_oneof:"position_option"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *AppendResp_Success) Reset() { *x = AppendResp_Success{} - if protoimpl.UnsafeEnabled { - mi := &file_streams_proto_msgTypes[31] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_streams_proto_msgTypes[31] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *AppendResp_Success) String() string { @@ -2457,7 +2465,7 @@ func (*AppendResp_Success) ProtoMessage() {} func (x *AppendResp_Success) ProtoReflect() protoreflect.Message { mi := &file_streams_proto_msgTypes[31] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -2472,44 +2480,52 @@ func (*AppendResp_Success) Descriptor() ([]byte, []int) { return file_streams_proto_rawDescGZIP(), []int{3, 1} } -func (m *AppendResp_Success) GetCurrentRevisionOption() isAppendResp_Success_CurrentRevisionOption { - if m != nil { - return m.CurrentRevisionOption +func (x *AppendResp_Success) GetCurrentRevisionOption() isAppendResp_Success_CurrentRevisionOption { + if x != nil { + return x.CurrentRevisionOption } return nil } func (x *AppendResp_Success) GetCurrentRevision() uint64 { - if x, ok := x.GetCurrentRevisionOption().(*AppendResp_Success_CurrentRevision); ok { - return x.CurrentRevision + if x != nil { + if x, ok := x.CurrentRevisionOption.(*AppendResp_Success_CurrentRevision); ok { + return x.CurrentRevision + } } return 0 } func (x *AppendResp_Success) GetNoStream() *shared.Empty { - if x, ok := x.GetCurrentRevisionOption().(*AppendResp_Success_NoStream); ok { - return x.NoStream + if x != nil { + if x, ok := x.CurrentRevisionOption.(*AppendResp_Success_NoStream); ok { + return x.NoStream + } } return nil } -func (m *AppendResp_Success) GetPositionOption() isAppendResp_Success_PositionOption { - if m != nil { - return m.PositionOption +func (x *AppendResp_Success) GetPositionOption() isAppendResp_Success_PositionOption { + if x != nil { + return x.PositionOption } return nil } func (x *AppendResp_Success) GetPosition() *AppendResp_Position { - if x, ok := x.GetPositionOption().(*AppendResp_Success_Position); ok { - return x.Position + if x != nil { + if x, ok := x.PositionOption.(*AppendResp_Success_Position); ok { + return x.Position + } } return nil } func (x *AppendResp_Success) GetNoPosition() *shared.Empty { - if x, ok := x.GetPositionOption().(*AppendResp_Success_NoPosition); ok { - return x.NoPosition + if x != nil { + if x, ok := x.PositionOption.(*AppendResp_Success_NoPosition); ok { + return x.NoPosition + } } return nil } @@ -2547,42 +2563,39 @@ func (*AppendResp_Success_Position) isAppendResp_Success_PositionOption() {} func (*AppendResp_Success_NoPosition) isAppendResp_Success_PositionOption() {} type AppendResp_WrongExpectedVersion struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Types that are assignable to CurrentRevisionOption_20_6_0: + state protoimpl.MessageState `protogen:"open.v1"` + // Types that are valid to be assigned to CurrentRevisionOption_20_6_0: // // *AppendResp_WrongExpectedVersion_CurrentRevision_20_6_0 // *AppendResp_WrongExpectedVersion_NoStream_20_6_0 CurrentRevisionOption_20_6_0 isAppendResp_WrongExpectedVersion_CurrentRevisionOption_20_6_0 `protobuf_oneof:"current_revision_option_20_6_0"` - // Types that are assignable to ExpectedRevisionOption_20_6_0: + // Types that are valid to be assigned to ExpectedRevisionOption_20_6_0: // // *AppendResp_WrongExpectedVersion_ExpectedRevision_20_6_0 // *AppendResp_WrongExpectedVersion_Any_20_6_0 // *AppendResp_WrongExpectedVersion_StreamExists_20_6_0 ExpectedRevisionOption_20_6_0 isAppendResp_WrongExpectedVersion_ExpectedRevisionOption_20_6_0 `protobuf_oneof:"expected_revision_option_20_6_0"` - // Types that are assignable to CurrentRevisionOption: + // Types that are valid to be assigned to CurrentRevisionOption: // // *AppendResp_WrongExpectedVersion_CurrentRevision // *AppendResp_WrongExpectedVersion_CurrentNoStream CurrentRevisionOption isAppendResp_WrongExpectedVersion_CurrentRevisionOption `protobuf_oneof:"current_revision_option"` - // Types that are assignable to ExpectedRevisionOption: + // Types that are valid to be assigned to ExpectedRevisionOption: // // *AppendResp_WrongExpectedVersion_ExpectedRevision // *AppendResp_WrongExpectedVersion_ExpectedAny // *AppendResp_WrongExpectedVersion_ExpectedStreamExists // *AppendResp_WrongExpectedVersion_ExpectedNoStream ExpectedRevisionOption isAppendResp_WrongExpectedVersion_ExpectedRevisionOption `protobuf_oneof:"expected_revision_option"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *AppendResp_WrongExpectedVersion) Reset() { *x = AppendResp_WrongExpectedVersion{} - if protoimpl.UnsafeEnabled { - mi := &file_streams_proto_msgTypes[32] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_streams_proto_msgTypes[32] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *AppendResp_WrongExpectedVersion) String() string { @@ -2593,7 +2606,7 @@ func (*AppendResp_WrongExpectedVersion) ProtoMessage() {} func (x *AppendResp_WrongExpectedVersion) ProtoReflect() protoreflect.Message { mi := &file_streams_proto_msgTypes[32] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -2608,107 +2621,129 @@ func (*AppendResp_WrongExpectedVersion) Descriptor() ([]byte, []int) { return file_streams_proto_rawDescGZIP(), []int{3, 2} } -func (m *AppendResp_WrongExpectedVersion) GetCurrentRevisionOption_20_6_0() isAppendResp_WrongExpectedVersion_CurrentRevisionOption_20_6_0 { - if m != nil { - return m.CurrentRevisionOption_20_6_0 +func (x *AppendResp_WrongExpectedVersion) GetCurrentRevisionOption_20_6_0() isAppendResp_WrongExpectedVersion_CurrentRevisionOption_20_6_0 { + if x != nil { + return x.CurrentRevisionOption_20_6_0 } return nil } func (x *AppendResp_WrongExpectedVersion) GetCurrentRevision_20_6_0() uint64 { - if x, ok := x.GetCurrentRevisionOption_20_6_0().(*AppendResp_WrongExpectedVersion_CurrentRevision_20_6_0); ok { - return x.CurrentRevision_20_6_0 + if x != nil { + if x, ok := x.CurrentRevisionOption_20_6_0.(*AppendResp_WrongExpectedVersion_CurrentRevision_20_6_0); ok { + return x.CurrentRevision_20_6_0 + } } return 0 } func (x *AppendResp_WrongExpectedVersion) GetNoStream_20_6_0() *shared.Empty { - if x, ok := x.GetCurrentRevisionOption_20_6_0().(*AppendResp_WrongExpectedVersion_NoStream_20_6_0); ok { - return x.NoStream_20_6_0 + if x != nil { + if x, ok := x.CurrentRevisionOption_20_6_0.(*AppendResp_WrongExpectedVersion_NoStream_20_6_0); ok { + return x.NoStream_20_6_0 + } } return nil } -func (m *AppendResp_WrongExpectedVersion) GetExpectedRevisionOption_20_6_0() isAppendResp_WrongExpectedVersion_ExpectedRevisionOption_20_6_0 { - if m != nil { - return m.ExpectedRevisionOption_20_6_0 +func (x *AppendResp_WrongExpectedVersion) GetExpectedRevisionOption_20_6_0() isAppendResp_WrongExpectedVersion_ExpectedRevisionOption_20_6_0 { + if x != nil { + return x.ExpectedRevisionOption_20_6_0 } return nil } func (x *AppendResp_WrongExpectedVersion) GetExpectedRevision_20_6_0() uint64 { - if x, ok := x.GetExpectedRevisionOption_20_6_0().(*AppendResp_WrongExpectedVersion_ExpectedRevision_20_6_0); ok { - return x.ExpectedRevision_20_6_0 + if x != nil { + if x, ok := x.ExpectedRevisionOption_20_6_0.(*AppendResp_WrongExpectedVersion_ExpectedRevision_20_6_0); ok { + return x.ExpectedRevision_20_6_0 + } } return 0 } func (x *AppendResp_WrongExpectedVersion) GetAny_20_6_0() *shared.Empty { - if x, ok := x.GetExpectedRevisionOption_20_6_0().(*AppendResp_WrongExpectedVersion_Any_20_6_0); ok { - return x.Any_20_6_0 + if x != nil { + if x, ok := x.ExpectedRevisionOption_20_6_0.(*AppendResp_WrongExpectedVersion_Any_20_6_0); ok { + return x.Any_20_6_0 + } } return nil } func (x *AppendResp_WrongExpectedVersion) GetStreamExists_20_6_0() *shared.Empty { - if x, ok := x.GetExpectedRevisionOption_20_6_0().(*AppendResp_WrongExpectedVersion_StreamExists_20_6_0); ok { - return x.StreamExists_20_6_0 + if x != nil { + if x, ok := x.ExpectedRevisionOption_20_6_0.(*AppendResp_WrongExpectedVersion_StreamExists_20_6_0); ok { + return x.StreamExists_20_6_0 + } } return nil } -func (m *AppendResp_WrongExpectedVersion) GetCurrentRevisionOption() isAppendResp_WrongExpectedVersion_CurrentRevisionOption { - if m != nil { - return m.CurrentRevisionOption +func (x *AppendResp_WrongExpectedVersion) GetCurrentRevisionOption() isAppendResp_WrongExpectedVersion_CurrentRevisionOption { + if x != nil { + return x.CurrentRevisionOption } return nil } func (x *AppendResp_WrongExpectedVersion) GetCurrentRevision() uint64 { - if x, ok := x.GetCurrentRevisionOption().(*AppendResp_WrongExpectedVersion_CurrentRevision); ok { - return x.CurrentRevision + if x != nil { + if x, ok := x.CurrentRevisionOption.(*AppendResp_WrongExpectedVersion_CurrentRevision); ok { + return x.CurrentRevision + } } return 0 } func (x *AppendResp_WrongExpectedVersion) GetCurrentNoStream() *shared.Empty { - if x, ok := x.GetCurrentRevisionOption().(*AppendResp_WrongExpectedVersion_CurrentNoStream); ok { - return x.CurrentNoStream + if x != nil { + if x, ok := x.CurrentRevisionOption.(*AppendResp_WrongExpectedVersion_CurrentNoStream); ok { + return x.CurrentNoStream + } } return nil } -func (m *AppendResp_WrongExpectedVersion) GetExpectedRevisionOption() isAppendResp_WrongExpectedVersion_ExpectedRevisionOption { - if m != nil { - return m.ExpectedRevisionOption +func (x *AppendResp_WrongExpectedVersion) GetExpectedRevisionOption() isAppendResp_WrongExpectedVersion_ExpectedRevisionOption { + if x != nil { + return x.ExpectedRevisionOption } return nil } func (x *AppendResp_WrongExpectedVersion) GetExpectedRevision() uint64 { - if x, ok := x.GetExpectedRevisionOption().(*AppendResp_WrongExpectedVersion_ExpectedRevision); ok { - return x.ExpectedRevision + if x != nil { + if x, ok := x.ExpectedRevisionOption.(*AppendResp_WrongExpectedVersion_ExpectedRevision); ok { + return x.ExpectedRevision + } } return 0 } func (x *AppendResp_WrongExpectedVersion) GetExpectedAny() *shared.Empty { - if x, ok := x.GetExpectedRevisionOption().(*AppendResp_WrongExpectedVersion_ExpectedAny); ok { - return x.ExpectedAny + if x != nil { + if x, ok := x.ExpectedRevisionOption.(*AppendResp_WrongExpectedVersion_ExpectedAny); ok { + return x.ExpectedAny + } } return nil } func (x *AppendResp_WrongExpectedVersion) GetExpectedStreamExists() *shared.Empty { - if x, ok := x.GetExpectedRevisionOption().(*AppendResp_WrongExpectedVersion_ExpectedStreamExists); ok { - return x.ExpectedStreamExists + if x != nil { + if x, ok := x.ExpectedRevisionOption.(*AppendResp_WrongExpectedVersion_ExpectedStreamExists); ok { + return x.ExpectedStreamExists + } } return nil } func (x *AppendResp_WrongExpectedVersion) GetExpectedNoStream() *shared.Empty { - if x, ok := x.GetExpectedRevisionOption().(*AppendResp_WrongExpectedVersion_ExpectedNoStream); ok { - return x.ExpectedNoStream + if x != nil { + if x, ok := x.ExpectedRevisionOption.(*AppendResp_WrongExpectedVersion_ExpectedNoStream); ok { + return x.ExpectedNoStream + } } return nil } @@ -2807,32 +2842,29 @@ func (*AppendResp_WrongExpectedVersion_ExpectedNoStream) isAppendResp_WrongExpec } type BatchAppendReq_Options struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - + state protoimpl.MessageState `protogen:"open.v1"` StreamIdentifier *shared.StreamIdentifier `protobuf:"bytes,1,opt,name=stream_identifier,json=streamIdentifier,proto3" json:"stream_identifier,omitempty"` - // Types that are assignable to ExpectedStreamPosition: + // Types that are valid to be assigned to ExpectedStreamPosition: // // *BatchAppendReq_Options_StreamPosition // *BatchAppendReq_Options_NoStream // *BatchAppendReq_Options_Any // *BatchAppendReq_Options_StreamExists ExpectedStreamPosition isBatchAppendReq_Options_ExpectedStreamPosition `protobuf_oneof:"expected_stream_position"` - // Types that are assignable to DeadlineOption: + // Types that are valid to be assigned to DeadlineOption: // // *BatchAppendReq_Options_Deadline_21_10_0 // *BatchAppendReq_Options_Deadline DeadlineOption isBatchAppendReq_Options_DeadlineOption `protobuf_oneof:"deadline_option"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *BatchAppendReq_Options) Reset() { *x = BatchAppendReq_Options{} - if protoimpl.UnsafeEnabled { - mi := &file_streams_proto_msgTypes[33] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_streams_proto_msgTypes[33] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *BatchAppendReq_Options) String() string { @@ -2843,7 +2875,7 @@ func (*BatchAppendReq_Options) ProtoMessage() {} func (x *BatchAppendReq_Options) ProtoReflect() protoreflect.Message { mi := &file_streams_proto_msgTypes[33] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -2865,58 +2897,70 @@ func (x *BatchAppendReq_Options) GetStreamIdentifier() *shared.StreamIdentifier return nil } -func (m *BatchAppendReq_Options) GetExpectedStreamPosition() isBatchAppendReq_Options_ExpectedStreamPosition { - if m != nil { - return m.ExpectedStreamPosition +func (x *BatchAppendReq_Options) GetExpectedStreamPosition() isBatchAppendReq_Options_ExpectedStreamPosition { + if x != nil { + return x.ExpectedStreamPosition } return nil } func (x *BatchAppendReq_Options) GetStreamPosition() uint64 { - if x, ok := x.GetExpectedStreamPosition().(*BatchAppendReq_Options_StreamPosition); ok { - return x.StreamPosition + if x != nil { + if x, ok := x.ExpectedStreamPosition.(*BatchAppendReq_Options_StreamPosition); ok { + return x.StreamPosition + } } return 0 } func (x *BatchAppendReq_Options) GetNoStream() *emptypb.Empty { - if x, ok := x.GetExpectedStreamPosition().(*BatchAppendReq_Options_NoStream); ok { - return x.NoStream + if x != nil { + if x, ok := x.ExpectedStreamPosition.(*BatchAppendReq_Options_NoStream); ok { + return x.NoStream + } } return nil } func (x *BatchAppendReq_Options) GetAny() *emptypb.Empty { - if x, ok := x.GetExpectedStreamPosition().(*BatchAppendReq_Options_Any); ok { - return x.Any + if x != nil { + if x, ok := x.ExpectedStreamPosition.(*BatchAppendReq_Options_Any); ok { + return x.Any + } } return nil } func (x *BatchAppendReq_Options) GetStreamExists() *emptypb.Empty { - if x, ok := x.GetExpectedStreamPosition().(*BatchAppendReq_Options_StreamExists); ok { - return x.StreamExists + if x != nil { + if x, ok := x.ExpectedStreamPosition.(*BatchAppendReq_Options_StreamExists); ok { + return x.StreamExists + } } return nil } -func (m *BatchAppendReq_Options) GetDeadlineOption() isBatchAppendReq_Options_DeadlineOption { - if m != nil { - return m.DeadlineOption +func (x *BatchAppendReq_Options) GetDeadlineOption() isBatchAppendReq_Options_DeadlineOption { + if x != nil { + return x.DeadlineOption } return nil } func (x *BatchAppendReq_Options) GetDeadline_21_10_0() *timestamppb.Timestamp { - if x, ok := x.GetDeadlineOption().(*BatchAppendReq_Options_Deadline_21_10_0); ok { - return x.Deadline_21_10_0 + if x != nil { + if x, ok := x.DeadlineOption.(*BatchAppendReq_Options_Deadline_21_10_0); ok { + return x.Deadline_21_10_0 + } } return nil } func (x *BatchAppendReq_Options) GetDeadline() *durationpb.Duration { - if x, ok := x.GetDeadlineOption().(*BatchAppendReq_Options_Deadline); ok { - return x.Deadline + if x != nil { + if x, ok := x.DeadlineOption.(*BatchAppendReq_Options_Deadline); ok { + return x.Deadline + } } return nil } @@ -2966,23 +3010,20 @@ func (*BatchAppendReq_Options_Deadline_21_10_0) isBatchAppendReq_Options_Deadlin func (*BatchAppendReq_Options_Deadline) isBatchAppendReq_Options_DeadlineOption() {} type BatchAppendReq_ProposedMessage struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Id *shared.UUID `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` - Metadata map[string]string `protobuf:"bytes,2,rep,name=metadata,proto3" json:"metadata,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` - CustomMetadata []byte `protobuf:"bytes,3,opt,name=custom_metadata,json=customMetadata,proto3" json:"custom_metadata,omitempty"` - Data []byte `protobuf:"bytes,4,opt,name=data,proto3" json:"data,omitempty"` + state protoimpl.MessageState `protogen:"open.v1"` + Id *shared.UUID `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + Metadata map[string]string `protobuf:"bytes,2,rep,name=metadata,proto3" json:"metadata,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` + CustomMetadata []byte `protobuf:"bytes,3,opt,name=custom_metadata,json=customMetadata,proto3" json:"custom_metadata,omitempty"` + Data []byte `protobuf:"bytes,4,opt,name=data,proto3" json:"data,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *BatchAppendReq_ProposedMessage) Reset() { *x = BatchAppendReq_ProposedMessage{} - if protoimpl.UnsafeEnabled { - mi := &file_streams_proto_msgTypes[34] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_streams_proto_msgTypes[34] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *BatchAppendReq_ProposedMessage) String() string { @@ -2993,7 +3034,7 @@ func (*BatchAppendReq_ProposedMessage) ProtoMessage() {} func (x *BatchAppendReq_ProposedMessage) ProtoReflect() protoreflect.Message { mi := &file_streams_proto_msgTypes[34] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -3037,29 +3078,26 @@ func (x *BatchAppendReq_ProposedMessage) GetData() []byte { } type BatchAppendResp_Success struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Types that are assignable to CurrentRevisionOption: + state protoimpl.MessageState `protogen:"open.v1"` + // Types that are valid to be assigned to CurrentRevisionOption: // // *BatchAppendResp_Success_CurrentRevision // *BatchAppendResp_Success_NoStream CurrentRevisionOption isBatchAppendResp_Success_CurrentRevisionOption `protobuf_oneof:"current_revision_option"` - // Types that are assignable to PositionOption: + // Types that are valid to be assigned to PositionOption: // // *BatchAppendResp_Success_Position // *BatchAppendResp_Success_NoPosition PositionOption isBatchAppendResp_Success_PositionOption `protobuf_oneof:"position_option"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *BatchAppendResp_Success) Reset() { *x = BatchAppendResp_Success{} - if protoimpl.UnsafeEnabled { - mi := &file_streams_proto_msgTypes[36] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_streams_proto_msgTypes[36] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *BatchAppendResp_Success) String() string { @@ -3070,7 +3108,7 @@ func (*BatchAppendResp_Success) ProtoMessage() {} func (x *BatchAppendResp_Success) ProtoReflect() protoreflect.Message { mi := &file_streams_proto_msgTypes[36] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -3085,44 +3123,52 @@ func (*BatchAppendResp_Success) Descriptor() ([]byte, []int) { return file_streams_proto_rawDescGZIP(), []int{5, 0} } -func (m *BatchAppendResp_Success) GetCurrentRevisionOption() isBatchAppendResp_Success_CurrentRevisionOption { - if m != nil { - return m.CurrentRevisionOption +func (x *BatchAppendResp_Success) GetCurrentRevisionOption() isBatchAppendResp_Success_CurrentRevisionOption { + if x != nil { + return x.CurrentRevisionOption } return nil } func (x *BatchAppendResp_Success) GetCurrentRevision() uint64 { - if x, ok := x.GetCurrentRevisionOption().(*BatchAppendResp_Success_CurrentRevision); ok { - return x.CurrentRevision + if x != nil { + if x, ok := x.CurrentRevisionOption.(*BatchAppendResp_Success_CurrentRevision); ok { + return x.CurrentRevision + } } return 0 } func (x *BatchAppendResp_Success) GetNoStream() *emptypb.Empty { - if x, ok := x.GetCurrentRevisionOption().(*BatchAppendResp_Success_NoStream); ok { - return x.NoStream + if x != nil { + if x, ok := x.CurrentRevisionOption.(*BatchAppendResp_Success_NoStream); ok { + return x.NoStream + } } return nil } -func (m *BatchAppendResp_Success) GetPositionOption() isBatchAppendResp_Success_PositionOption { - if m != nil { - return m.PositionOption +func (x *BatchAppendResp_Success) GetPositionOption() isBatchAppendResp_Success_PositionOption { + if x != nil { + return x.PositionOption } return nil } func (x *BatchAppendResp_Success) GetPosition() *shared.AllStreamPosition { - if x, ok := x.GetPositionOption().(*BatchAppendResp_Success_Position); ok { - return x.Position + if x != nil { + if x, ok := x.PositionOption.(*BatchAppendResp_Success_Position); ok { + return x.Position + } } return nil } func (x *BatchAppendResp_Success) GetNoPosition() *emptypb.Empty { - if x, ok := x.GetPositionOption().(*BatchAppendResp_Success_NoPosition); ok { - return x.NoPosition + if x != nil { + if x, ok := x.PositionOption.(*BatchAppendResp_Success_NoPosition); ok { + return x.NoPosition + } } return nil } @@ -3160,27 +3206,24 @@ func (*BatchAppendResp_Success_Position) isBatchAppendResp_Success_PositionOptio func (*BatchAppendResp_Success_NoPosition) isBatchAppendResp_Success_PositionOption() {} type DeleteReq_Options struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - + state protoimpl.MessageState `protogen:"open.v1"` StreamIdentifier *shared.StreamIdentifier `protobuf:"bytes,1,opt,name=stream_identifier,json=streamIdentifier,proto3" json:"stream_identifier,omitempty"` - // Types that are assignable to ExpectedStreamRevision: + // Types that are valid to be assigned to ExpectedStreamRevision: // // *DeleteReq_Options_Revision // *DeleteReq_Options_NoStream // *DeleteReq_Options_Any // *DeleteReq_Options_StreamExists ExpectedStreamRevision isDeleteReq_Options_ExpectedStreamRevision `protobuf_oneof:"expected_stream_revision"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *DeleteReq_Options) Reset() { *x = DeleteReq_Options{} - if protoimpl.UnsafeEnabled { - mi := &file_streams_proto_msgTypes[37] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_streams_proto_msgTypes[37] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *DeleteReq_Options) String() string { @@ -3191,7 +3234,7 @@ func (*DeleteReq_Options) ProtoMessage() {} func (x *DeleteReq_Options) ProtoReflect() protoreflect.Message { mi := &file_streams_proto_msgTypes[37] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -3213,37 +3256,45 @@ func (x *DeleteReq_Options) GetStreamIdentifier() *shared.StreamIdentifier { return nil } -func (m *DeleteReq_Options) GetExpectedStreamRevision() isDeleteReq_Options_ExpectedStreamRevision { - if m != nil { - return m.ExpectedStreamRevision +func (x *DeleteReq_Options) GetExpectedStreamRevision() isDeleteReq_Options_ExpectedStreamRevision { + if x != nil { + return x.ExpectedStreamRevision } return nil } func (x *DeleteReq_Options) GetRevision() uint64 { - if x, ok := x.GetExpectedStreamRevision().(*DeleteReq_Options_Revision); ok { - return x.Revision + if x != nil { + if x, ok := x.ExpectedStreamRevision.(*DeleteReq_Options_Revision); ok { + return x.Revision + } } return 0 } func (x *DeleteReq_Options) GetNoStream() *shared.Empty { - if x, ok := x.GetExpectedStreamRevision().(*DeleteReq_Options_NoStream); ok { - return x.NoStream + if x != nil { + if x, ok := x.ExpectedStreamRevision.(*DeleteReq_Options_NoStream); ok { + return x.NoStream + } } return nil } func (x *DeleteReq_Options) GetAny() *shared.Empty { - if x, ok := x.GetExpectedStreamRevision().(*DeleteReq_Options_Any); ok { - return x.Any + if x != nil { + if x, ok := x.ExpectedStreamRevision.(*DeleteReq_Options_Any); ok { + return x.Any + } } return nil } func (x *DeleteReq_Options) GetStreamExists() *shared.Empty { - if x, ok := x.GetExpectedStreamRevision().(*DeleteReq_Options_StreamExists); ok { - return x.StreamExists + if x != nil { + if x, ok := x.ExpectedStreamRevision.(*DeleteReq_Options_StreamExists); ok { + return x.StreamExists + } } return nil } @@ -3277,21 +3328,18 @@ func (*DeleteReq_Options_Any) isDeleteReq_Options_ExpectedStreamRevision() {} func (*DeleteReq_Options_StreamExists) isDeleteReq_Options_ExpectedStreamRevision() {} type DeleteResp_Position struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - CommitPosition uint64 `protobuf:"varint,1,opt,name=commit_position,json=commitPosition,proto3" json:"commit_position,omitempty"` - PreparePosition uint64 `protobuf:"varint,2,opt,name=prepare_position,json=preparePosition,proto3" json:"prepare_position,omitempty"` + state protoimpl.MessageState `protogen:"open.v1"` + CommitPosition uint64 `protobuf:"varint,1,opt,name=commit_position,json=commitPosition,proto3" json:"commit_position,omitempty"` + PreparePosition uint64 `protobuf:"varint,2,opt,name=prepare_position,json=preparePosition,proto3" json:"prepare_position,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *DeleteResp_Position) Reset() { *x = DeleteResp_Position{} - if protoimpl.UnsafeEnabled { - mi := &file_streams_proto_msgTypes[38] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_streams_proto_msgTypes[38] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *DeleteResp_Position) String() string { @@ -3302,7 +3350,7 @@ func (*DeleteResp_Position) ProtoMessage() {} func (x *DeleteResp_Position) ProtoReflect() protoreflect.Message { mi := &file_streams_proto_msgTypes[38] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -3332,27 +3380,24 @@ func (x *DeleteResp_Position) GetPreparePosition() uint64 { } type TombstoneReq_Options struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - + state protoimpl.MessageState `protogen:"open.v1"` StreamIdentifier *shared.StreamIdentifier `protobuf:"bytes,1,opt,name=stream_identifier,json=streamIdentifier,proto3" json:"stream_identifier,omitempty"` - // Types that are assignable to ExpectedStreamRevision: + // Types that are valid to be assigned to ExpectedStreamRevision: // // *TombstoneReq_Options_Revision // *TombstoneReq_Options_NoStream // *TombstoneReq_Options_Any // *TombstoneReq_Options_StreamExists ExpectedStreamRevision isTombstoneReq_Options_ExpectedStreamRevision `protobuf_oneof:"expected_stream_revision"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *TombstoneReq_Options) Reset() { *x = TombstoneReq_Options{} - if protoimpl.UnsafeEnabled { - mi := &file_streams_proto_msgTypes[39] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_streams_proto_msgTypes[39] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *TombstoneReq_Options) String() string { @@ -3363,7 +3408,7 @@ func (*TombstoneReq_Options) ProtoMessage() {} func (x *TombstoneReq_Options) ProtoReflect() protoreflect.Message { mi := &file_streams_proto_msgTypes[39] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -3385,37 +3430,45 @@ func (x *TombstoneReq_Options) GetStreamIdentifier() *shared.StreamIdentifier { return nil } -func (m *TombstoneReq_Options) GetExpectedStreamRevision() isTombstoneReq_Options_ExpectedStreamRevision { - if m != nil { - return m.ExpectedStreamRevision +func (x *TombstoneReq_Options) GetExpectedStreamRevision() isTombstoneReq_Options_ExpectedStreamRevision { + if x != nil { + return x.ExpectedStreamRevision } return nil } func (x *TombstoneReq_Options) GetRevision() uint64 { - if x, ok := x.GetExpectedStreamRevision().(*TombstoneReq_Options_Revision); ok { - return x.Revision + if x != nil { + if x, ok := x.ExpectedStreamRevision.(*TombstoneReq_Options_Revision); ok { + return x.Revision + } } return 0 } func (x *TombstoneReq_Options) GetNoStream() *shared.Empty { - if x, ok := x.GetExpectedStreamRevision().(*TombstoneReq_Options_NoStream); ok { - return x.NoStream + if x != nil { + if x, ok := x.ExpectedStreamRevision.(*TombstoneReq_Options_NoStream); ok { + return x.NoStream + } } return nil } func (x *TombstoneReq_Options) GetAny() *shared.Empty { - if x, ok := x.GetExpectedStreamRevision().(*TombstoneReq_Options_Any); ok { - return x.Any + if x != nil { + if x, ok := x.ExpectedStreamRevision.(*TombstoneReq_Options_Any); ok { + return x.Any + } } return nil } func (x *TombstoneReq_Options) GetStreamExists() *shared.Empty { - if x, ok := x.GetExpectedStreamRevision().(*TombstoneReq_Options_StreamExists); ok { - return x.StreamExists + if x != nil { + if x, ok := x.ExpectedStreamRevision.(*TombstoneReq_Options_StreamExists); ok { + return x.StreamExists + } } return nil } @@ -3449,21 +3502,18 @@ func (*TombstoneReq_Options_Any) isTombstoneReq_Options_ExpectedStreamRevision() func (*TombstoneReq_Options_StreamExists) isTombstoneReq_Options_ExpectedStreamRevision() {} type TombstoneResp_Position struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - CommitPosition uint64 `protobuf:"varint,1,opt,name=commit_position,json=commitPosition,proto3" json:"commit_position,omitempty"` - PreparePosition uint64 `protobuf:"varint,2,opt,name=prepare_position,json=preparePosition,proto3" json:"prepare_position,omitempty"` + state protoimpl.MessageState `protogen:"open.v1"` + CommitPosition uint64 `protobuf:"varint,1,opt,name=commit_position,json=commitPosition,proto3" json:"commit_position,omitempty"` + PreparePosition uint64 `protobuf:"varint,2,opt,name=prepare_position,json=preparePosition,proto3" json:"prepare_position,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *TombstoneResp_Position) Reset() { *x = TombstoneResp_Position{} - if protoimpl.UnsafeEnabled { - mi := &file_streams_proto_msgTypes[40] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_streams_proto_msgTypes[40] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *TombstoneResp_Position) String() string { @@ -3474,7 +3524,7 @@ func (*TombstoneResp_Position) ProtoMessage() {} func (x *TombstoneResp_Position) ProtoReflect() protoreflect.Message { mi := &file_streams_proto_msgTypes[40] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -3505,7 +3555,7 @@ func (x *TombstoneResp_Position) GetPreparePosition() uint64 { var File_streams_proto protoreflect.FileDescriptor -var file_streams_proto_rawDesc = []byte{ +var file_streams_proto_rawDesc = string([]byte{ 0x0a, 0x0d, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x1a, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x5f, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x2e, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x73, 0x1a, 0x0c, 0x73, 0x68, 0x61, @@ -4147,26 +4197,26 @@ var file_streams_proto_rawDesc = []byte{ 0x6f, 0x74, 0x6f, 0x2e, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x73, 0x5a, 0x3c, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x2f, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x2d, 0x43, 0x6c, - 0x69, 0x65, 0x6e, 0x74, 0x2d, 0x47, 0x6f, 0x2f, 0x76, 0x34, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x69, 0x65, 0x6e, 0x74, 0x2d, 0x47, 0x6f, 0x2f, 0x76, 0x31, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2f, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} +}) var ( file_streams_proto_rawDescOnce sync.Once - file_streams_proto_rawDescData = file_streams_proto_rawDesc + file_streams_proto_rawDescData []byte ) func file_streams_proto_rawDescGZIP() []byte { file_streams_proto_rawDescOnce.Do(func() { - file_streams_proto_rawDescData = protoimpl.X.CompressGZIP(file_streams_proto_rawDescData) + file_streams_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_streams_proto_rawDesc), len(file_streams_proto_rawDesc))) }) return file_streams_proto_rawDescData } var file_streams_proto_enumTypes = make([]protoimpl.EnumInfo, 1) var file_streams_proto_msgTypes = make([]protoimpl.MessageInfo, 41) -var file_streams_proto_goTypes = []interface{}{ +var file_streams_proto_goTypes = []any{ (ReadReq_Options_ReadDirection)(0), // 0: event_store.client.streams.ReadReq.Options.ReadDirection (*ReadReq)(nil), // 1: event_store.client.streams.ReadReq (*ReadResp)(nil), // 2: event_store.client.streams.ReadResp @@ -4330,465 +4380,7 @@ func file_streams_proto_init() { if File_streams_proto != nil { return } - if !protoimpl.UnsafeEnabled { - file_streams_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ReadReq); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_streams_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ReadResp); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_streams_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AppendReq); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_streams_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AppendResp); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_streams_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*BatchAppendReq); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_streams_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*BatchAppendResp); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_streams_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*DeleteReq); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_streams_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*DeleteResp); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_streams_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*TombstoneReq); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_streams_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*TombstoneResp); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_streams_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ReadReq_Options); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_streams_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ReadReq_Options_StreamOptions); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_streams_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ReadReq_Options_AllOptions); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_streams_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ReadReq_Options_SubscriptionOptions); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_streams_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ReadReq_Options_Position); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_streams_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ReadReq_Options_FilterOptions); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_streams_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ReadReq_Options_UUIDOption); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_streams_proto_msgTypes[17].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ReadReq_Options_ControlOption); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_streams_proto_msgTypes[18].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ReadReq_Options_FilterOptions_Expression); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_streams_proto_msgTypes[19].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ReadResp_CaughtUp); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_streams_proto_msgTypes[20].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ReadResp_FellBehind); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_streams_proto_msgTypes[21].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ReadResp_ReadEvent); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_streams_proto_msgTypes[22].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ReadResp_SubscriptionConfirmation); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_streams_proto_msgTypes[23].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ReadResp_Checkpoint); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_streams_proto_msgTypes[24].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ReadResp_StreamNotFound); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_streams_proto_msgTypes[25].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ReadResp_ReadEvent_RecordedEvent); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_streams_proto_msgTypes[27].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AppendReq_Options); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_streams_proto_msgTypes[28].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AppendReq_ProposedMessage); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_streams_proto_msgTypes[30].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AppendResp_Position); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_streams_proto_msgTypes[31].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AppendResp_Success); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_streams_proto_msgTypes[32].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AppendResp_WrongExpectedVersion); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_streams_proto_msgTypes[33].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*BatchAppendReq_Options); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_streams_proto_msgTypes[34].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*BatchAppendReq_ProposedMessage); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_streams_proto_msgTypes[36].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*BatchAppendResp_Success); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_streams_proto_msgTypes[37].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*DeleteReq_Options); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_streams_proto_msgTypes[38].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*DeleteResp_Position); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_streams_proto_msgTypes[39].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*TombstoneReq_Options); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_streams_proto_msgTypes[40].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*TombstoneResp_Position); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - file_streams_proto_msgTypes[1].OneofWrappers = []interface{}{ + file_streams_proto_msgTypes[1].OneofWrappers = []any{ (*ReadResp_Event)(nil), (*ReadResp_Confirmation)(nil), (*ReadResp_Checkpoint_)(nil), @@ -4799,15 +4391,15 @@ func file_streams_proto_init() { (*ReadResp_CaughtUp_)(nil), (*ReadResp_FellBehind_)(nil), } - file_streams_proto_msgTypes[2].OneofWrappers = []interface{}{ + file_streams_proto_msgTypes[2].OneofWrappers = []any{ (*AppendReq_Options_)(nil), (*AppendReq_ProposedMessage_)(nil), } - file_streams_proto_msgTypes[3].OneofWrappers = []interface{}{ + file_streams_proto_msgTypes[3].OneofWrappers = []any{ (*AppendResp_Success_)(nil), (*AppendResp_WrongExpectedVersion_)(nil), } - file_streams_proto_msgTypes[5].OneofWrappers = []interface{}{ + file_streams_proto_msgTypes[5].OneofWrappers = []any{ (*BatchAppendResp_Error)(nil), (*BatchAppendResp_Success_)(nil), (*BatchAppendResp_StreamPosition)(nil), @@ -4815,15 +4407,15 @@ func file_streams_proto_init() { (*BatchAppendResp_Any)(nil), (*BatchAppendResp_StreamExists)(nil), } - file_streams_proto_msgTypes[7].OneofWrappers = []interface{}{ + file_streams_proto_msgTypes[7].OneofWrappers = []any{ (*DeleteResp_Position_)(nil), (*DeleteResp_NoPosition)(nil), } - file_streams_proto_msgTypes[9].OneofWrappers = []interface{}{ + file_streams_proto_msgTypes[9].OneofWrappers = []any{ (*TombstoneResp_Position_)(nil), (*TombstoneResp_NoPosition)(nil), } - file_streams_proto_msgTypes[10].OneofWrappers = []interface{}{ + file_streams_proto_msgTypes[10].OneofWrappers = []any{ (*ReadReq_Options_Stream)(nil), (*ReadReq_Options_All)(nil), (*ReadReq_Options_Count)(nil), @@ -4831,43 +4423,43 @@ func file_streams_proto_init() { (*ReadReq_Options_Filter)(nil), (*ReadReq_Options_NoFilter)(nil), } - file_streams_proto_msgTypes[11].OneofWrappers = []interface{}{ + file_streams_proto_msgTypes[11].OneofWrappers = []any{ (*ReadReq_Options_StreamOptions_Revision)(nil), (*ReadReq_Options_StreamOptions_Start)(nil), (*ReadReq_Options_StreamOptions_End)(nil), } - file_streams_proto_msgTypes[12].OneofWrappers = []interface{}{ + file_streams_proto_msgTypes[12].OneofWrappers = []any{ (*ReadReq_Options_AllOptions_Position)(nil), (*ReadReq_Options_AllOptions_Start)(nil), (*ReadReq_Options_AllOptions_End)(nil), } - file_streams_proto_msgTypes[15].OneofWrappers = []interface{}{ + file_streams_proto_msgTypes[15].OneofWrappers = []any{ (*ReadReq_Options_FilterOptions_StreamIdentifier)(nil), (*ReadReq_Options_FilterOptions_EventType)(nil), (*ReadReq_Options_FilterOptions_Max)(nil), (*ReadReq_Options_FilterOptions_Count)(nil), } - file_streams_proto_msgTypes[16].OneofWrappers = []interface{}{ + file_streams_proto_msgTypes[16].OneofWrappers = []any{ (*ReadReq_Options_UUIDOption_Structured)(nil), (*ReadReq_Options_UUIDOption_String_)(nil), } - file_streams_proto_msgTypes[21].OneofWrappers = []interface{}{ + file_streams_proto_msgTypes[21].OneofWrappers = []any{ (*ReadResp_ReadEvent_CommitPosition)(nil), (*ReadResp_ReadEvent_NoPosition)(nil), } - file_streams_proto_msgTypes[27].OneofWrappers = []interface{}{ + file_streams_proto_msgTypes[27].OneofWrappers = []any{ (*AppendReq_Options_Revision)(nil), (*AppendReq_Options_NoStream)(nil), (*AppendReq_Options_Any)(nil), (*AppendReq_Options_StreamExists)(nil), } - file_streams_proto_msgTypes[31].OneofWrappers = []interface{}{ + file_streams_proto_msgTypes[31].OneofWrappers = []any{ (*AppendResp_Success_CurrentRevision)(nil), (*AppendResp_Success_NoStream)(nil), (*AppendResp_Success_Position)(nil), (*AppendResp_Success_NoPosition)(nil), } - file_streams_proto_msgTypes[32].OneofWrappers = []interface{}{ + file_streams_proto_msgTypes[32].OneofWrappers = []any{ (*AppendResp_WrongExpectedVersion_CurrentRevision_20_6_0)(nil), (*AppendResp_WrongExpectedVersion_NoStream_20_6_0)(nil), (*AppendResp_WrongExpectedVersion_ExpectedRevision_20_6_0)(nil), @@ -4880,7 +4472,7 @@ func file_streams_proto_init() { (*AppendResp_WrongExpectedVersion_ExpectedStreamExists)(nil), (*AppendResp_WrongExpectedVersion_ExpectedNoStream)(nil), } - file_streams_proto_msgTypes[33].OneofWrappers = []interface{}{ + file_streams_proto_msgTypes[33].OneofWrappers = []any{ (*BatchAppendReq_Options_StreamPosition)(nil), (*BatchAppendReq_Options_NoStream)(nil), (*BatchAppendReq_Options_Any)(nil), @@ -4888,19 +4480,19 @@ func file_streams_proto_init() { (*BatchAppendReq_Options_Deadline_21_10_0)(nil), (*BatchAppendReq_Options_Deadline)(nil), } - file_streams_proto_msgTypes[36].OneofWrappers = []interface{}{ + file_streams_proto_msgTypes[36].OneofWrappers = []any{ (*BatchAppendResp_Success_CurrentRevision)(nil), (*BatchAppendResp_Success_NoStream)(nil), (*BatchAppendResp_Success_Position)(nil), (*BatchAppendResp_Success_NoPosition)(nil), } - file_streams_proto_msgTypes[37].OneofWrappers = []interface{}{ + file_streams_proto_msgTypes[37].OneofWrappers = []any{ (*DeleteReq_Options_Revision)(nil), (*DeleteReq_Options_NoStream)(nil), (*DeleteReq_Options_Any)(nil), (*DeleteReq_Options_StreamExists)(nil), } - file_streams_proto_msgTypes[39].OneofWrappers = []interface{}{ + file_streams_proto_msgTypes[39].OneofWrappers = []any{ (*TombstoneReq_Options_Revision)(nil), (*TombstoneReq_Options_NoStream)(nil), (*TombstoneReq_Options_Any)(nil), @@ -4910,7 +4502,7 @@ func file_streams_proto_init() { out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_streams_proto_rawDesc, + RawDescriptor: unsafe.Slice(unsafe.StringData(file_streams_proto_rawDesc), len(file_streams_proto_rawDesc)), NumEnums: 1, NumMessages: 41, NumExtensions: 0, @@ -4922,7 +4514,6 @@ func file_streams_proto_init() { MessageInfos: file_streams_proto_msgTypes, }.Build() File_streams_proto = out.File - file_streams_proto_rawDesc = nil file_streams_proto_goTypes = nil file_streams_proto_depIdxs = nil } diff --git a/protos/streams/streams_grpc.pb.go b/protos/streams/streams_grpc.pb.go index 2849db88..1fd6f556 100644 --- a/protos/streams/streams_grpc.pb.go +++ b/protos/streams/streams_grpc.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.3.0 -// - protoc v3.20.0 +// - protoc-gen-go-grpc v1.5.1 +// - protoc v5.26.0 // source: streams.proto package streams @@ -15,8 +15,8 @@ import ( // This is a compile-time assertion to ensure that this generated file // is compatible with the grpc package it is being compiled against. -// Requires gRPC-Go v1.32.0 or later. -const _ = grpc.SupportPackageIsVersion7 +// Requires gRPC-Go v1.64.0 or later. +const _ = grpc.SupportPackageIsVersion9 const ( Streams_Read_FullMethodName = "/event_store.client.streams.Streams/Read" @@ -30,11 +30,11 @@ const ( // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. type StreamsClient interface { - Read(ctx context.Context, in *ReadReq, opts ...grpc.CallOption) (Streams_ReadClient, error) - Append(ctx context.Context, opts ...grpc.CallOption) (Streams_AppendClient, error) + Read(ctx context.Context, in *ReadReq, opts ...grpc.CallOption) (grpc.ServerStreamingClient[ReadResp], error) + Append(ctx context.Context, opts ...grpc.CallOption) (grpc.ClientStreamingClient[AppendReq, AppendResp], error) Delete(ctx context.Context, in *DeleteReq, opts ...grpc.CallOption) (*DeleteResp, error) Tombstone(ctx context.Context, in *TombstoneReq, opts ...grpc.CallOption) (*TombstoneResp, error) - BatchAppend(ctx context.Context, opts ...grpc.CallOption) (Streams_BatchAppendClient, error) + BatchAppend(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[BatchAppendReq, BatchAppendResp], error) } type streamsClient struct { @@ -45,12 +45,13 @@ func NewStreamsClient(cc grpc.ClientConnInterface) StreamsClient { return &streamsClient{cc} } -func (c *streamsClient) Read(ctx context.Context, in *ReadReq, opts ...grpc.CallOption) (Streams_ReadClient, error) { - stream, err := c.cc.NewStream(ctx, &Streams_ServiceDesc.Streams[0], Streams_Read_FullMethodName, opts...) +func (c *streamsClient) Read(ctx context.Context, in *ReadReq, opts ...grpc.CallOption) (grpc.ServerStreamingClient[ReadResp], error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + stream, err := c.cc.NewStream(ctx, &Streams_ServiceDesc.Streams[0], Streams_Read_FullMethodName, cOpts...) if err != nil { return nil, err } - x := &streamsReadClient{stream} + x := &grpc.GenericClientStream[ReadReq, ReadResp]{ClientStream: stream} if err := x.ClientStream.SendMsg(in); err != nil { return nil, err } @@ -60,60 +61,26 @@ func (c *streamsClient) Read(ctx context.Context, in *ReadReq, opts ...grpc.Call return x, nil } -type Streams_ReadClient interface { - Recv() (*ReadResp, error) - grpc.ClientStream -} - -type streamsReadClient struct { - grpc.ClientStream -} - -func (x *streamsReadClient) Recv() (*ReadResp, error) { - m := new(ReadResp) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} +// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. +type Streams_ReadClient = grpc.ServerStreamingClient[ReadResp] -func (c *streamsClient) Append(ctx context.Context, opts ...grpc.CallOption) (Streams_AppendClient, error) { - stream, err := c.cc.NewStream(ctx, &Streams_ServiceDesc.Streams[1], Streams_Append_FullMethodName, opts...) +func (c *streamsClient) Append(ctx context.Context, opts ...grpc.CallOption) (grpc.ClientStreamingClient[AppendReq, AppendResp], error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + stream, err := c.cc.NewStream(ctx, &Streams_ServiceDesc.Streams[1], Streams_Append_FullMethodName, cOpts...) if err != nil { return nil, err } - x := &streamsAppendClient{stream} + x := &grpc.GenericClientStream[AppendReq, AppendResp]{ClientStream: stream} return x, nil } -type Streams_AppendClient interface { - Send(*AppendReq) error - CloseAndRecv() (*AppendResp, error) - grpc.ClientStream -} - -type streamsAppendClient struct { - grpc.ClientStream -} - -func (x *streamsAppendClient) Send(m *AppendReq) error { - return x.ClientStream.SendMsg(m) -} - -func (x *streamsAppendClient) CloseAndRecv() (*AppendResp, error) { - if err := x.ClientStream.CloseSend(); err != nil { - return nil, err - } - m := new(AppendResp) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} +// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. +type Streams_AppendClient = grpc.ClientStreamingClient[AppendReq, AppendResp] func (c *streamsClient) Delete(ctx context.Context, in *DeleteReq, opts ...grpc.CallOption) (*DeleteResp, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(DeleteResp) - err := c.cc.Invoke(ctx, Streams_Delete_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, Streams_Delete_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } @@ -121,65 +88,51 @@ func (c *streamsClient) Delete(ctx context.Context, in *DeleteReq, opts ...grpc. } func (c *streamsClient) Tombstone(ctx context.Context, in *TombstoneReq, opts ...grpc.CallOption) (*TombstoneResp, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(TombstoneResp) - err := c.cc.Invoke(ctx, Streams_Tombstone_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, Streams_Tombstone_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } return out, nil } -func (c *streamsClient) BatchAppend(ctx context.Context, opts ...grpc.CallOption) (Streams_BatchAppendClient, error) { - stream, err := c.cc.NewStream(ctx, &Streams_ServiceDesc.Streams[2], Streams_BatchAppend_FullMethodName, opts...) +func (c *streamsClient) BatchAppend(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[BatchAppendReq, BatchAppendResp], error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + stream, err := c.cc.NewStream(ctx, &Streams_ServiceDesc.Streams[2], Streams_BatchAppend_FullMethodName, cOpts...) if err != nil { return nil, err } - x := &streamsBatchAppendClient{stream} + x := &grpc.GenericClientStream[BatchAppendReq, BatchAppendResp]{ClientStream: stream} return x, nil } -type Streams_BatchAppendClient interface { - Send(*BatchAppendReq) error - Recv() (*BatchAppendResp, error) - grpc.ClientStream -} - -type streamsBatchAppendClient struct { - grpc.ClientStream -} - -func (x *streamsBatchAppendClient) Send(m *BatchAppendReq) error { - return x.ClientStream.SendMsg(m) -} - -func (x *streamsBatchAppendClient) Recv() (*BatchAppendResp, error) { - m := new(BatchAppendResp) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} +// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. +type Streams_BatchAppendClient = grpc.BidiStreamingClient[BatchAppendReq, BatchAppendResp] // StreamsServer is the server API for Streams service. // All implementations must embed UnimplementedStreamsServer -// for forward compatibility +// for forward compatibility. type StreamsServer interface { - Read(*ReadReq, Streams_ReadServer) error - Append(Streams_AppendServer) error + Read(*ReadReq, grpc.ServerStreamingServer[ReadResp]) error + Append(grpc.ClientStreamingServer[AppendReq, AppendResp]) error Delete(context.Context, *DeleteReq) (*DeleteResp, error) Tombstone(context.Context, *TombstoneReq) (*TombstoneResp, error) - BatchAppend(Streams_BatchAppendServer) error + BatchAppend(grpc.BidiStreamingServer[BatchAppendReq, BatchAppendResp]) error mustEmbedUnimplementedStreamsServer() } -// UnimplementedStreamsServer must be embedded to have forward compatible implementations. -type UnimplementedStreamsServer struct { -} +// UnimplementedStreamsServer must be embedded to have +// forward compatible implementations. +// +// NOTE: this should be embedded by value instead of pointer to avoid a nil +// pointer dereference when methods are called. +type UnimplementedStreamsServer struct{} -func (UnimplementedStreamsServer) Read(*ReadReq, Streams_ReadServer) error { +func (UnimplementedStreamsServer) Read(*ReadReq, grpc.ServerStreamingServer[ReadResp]) error { return status.Errorf(codes.Unimplemented, "method Read not implemented") } -func (UnimplementedStreamsServer) Append(Streams_AppendServer) error { +func (UnimplementedStreamsServer) Append(grpc.ClientStreamingServer[AppendReq, AppendResp]) error { return status.Errorf(codes.Unimplemented, "method Append not implemented") } func (UnimplementedStreamsServer) Delete(context.Context, *DeleteReq) (*DeleteResp, error) { @@ -188,10 +141,11 @@ func (UnimplementedStreamsServer) Delete(context.Context, *DeleteReq) (*DeleteRe func (UnimplementedStreamsServer) Tombstone(context.Context, *TombstoneReq) (*TombstoneResp, error) { return nil, status.Errorf(codes.Unimplemented, "method Tombstone not implemented") } -func (UnimplementedStreamsServer) BatchAppend(Streams_BatchAppendServer) error { +func (UnimplementedStreamsServer) BatchAppend(grpc.BidiStreamingServer[BatchAppendReq, BatchAppendResp]) error { return status.Errorf(codes.Unimplemented, "method BatchAppend not implemented") } func (UnimplementedStreamsServer) mustEmbedUnimplementedStreamsServer() {} +func (UnimplementedStreamsServer) testEmbeddedByValue() {} // UnsafeStreamsServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to StreamsServer will @@ -201,6 +155,13 @@ type UnsafeStreamsServer interface { } func RegisterStreamsServer(s grpc.ServiceRegistrar, srv StreamsServer) { + // If the following call pancis, it indicates UnimplementedStreamsServer was + // embedded by pointer and is nil. This will cause panics if an + // unimplemented method is ever invoked, so we test this at initialization + // time to prevent it from happening at runtime later due to I/O. + if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { + t.testEmbeddedByValue() + } s.RegisterService(&Streams_ServiceDesc, srv) } @@ -209,47 +170,18 @@ func _Streams_Read_Handler(srv interface{}, stream grpc.ServerStream) error { if err := stream.RecvMsg(m); err != nil { return err } - return srv.(StreamsServer).Read(m, &streamsReadServer{stream}) -} - -type Streams_ReadServer interface { - Send(*ReadResp) error - grpc.ServerStream -} - -type streamsReadServer struct { - grpc.ServerStream + return srv.(StreamsServer).Read(m, &grpc.GenericServerStream[ReadReq, ReadResp]{ServerStream: stream}) } -func (x *streamsReadServer) Send(m *ReadResp) error { - return x.ServerStream.SendMsg(m) -} +// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. +type Streams_ReadServer = grpc.ServerStreamingServer[ReadResp] func _Streams_Append_Handler(srv interface{}, stream grpc.ServerStream) error { - return srv.(StreamsServer).Append(&streamsAppendServer{stream}) -} - -type Streams_AppendServer interface { - SendAndClose(*AppendResp) error - Recv() (*AppendReq, error) - grpc.ServerStream + return srv.(StreamsServer).Append(&grpc.GenericServerStream[AppendReq, AppendResp]{ServerStream: stream}) } -type streamsAppendServer struct { - grpc.ServerStream -} - -func (x *streamsAppendServer) SendAndClose(m *AppendResp) error { - return x.ServerStream.SendMsg(m) -} - -func (x *streamsAppendServer) Recv() (*AppendReq, error) { - m := new(AppendReq) - if err := x.ServerStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} +// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. +type Streams_AppendServer = grpc.ClientStreamingServer[AppendReq, AppendResp] func _Streams_Delete_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(DeleteReq) @@ -288,30 +220,11 @@ func _Streams_Tombstone_Handler(srv interface{}, ctx context.Context, dec func(i } func _Streams_BatchAppend_Handler(srv interface{}, stream grpc.ServerStream) error { - return srv.(StreamsServer).BatchAppend(&streamsBatchAppendServer{stream}) + return srv.(StreamsServer).BatchAppend(&grpc.GenericServerStream[BatchAppendReq, BatchAppendResp]{ServerStream: stream}) } -type Streams_BatchAppendServer interface { - Send(*BatchAppendResp) error - Recv() (*BatchAppendReq, error) - grpc.ServerStream -} - -type streamsBatchAppendServer struct { - grpc.ServerStream -} - -func (x *streamsBatchAppendServer) Send(m *BatchAppendResp) error { - return x.ServerStream.SendMsg(m) -} - -func (x *streamsBatchAppendServer) Recv() (*BatchAppendReq, error) { - m := new(BatchAppendReq) - if err := x.ServerStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} +// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. +type Streams_BatchAppendServer = grpc.BidiStreamingServer[BatchAppendReq, BatchAppendResp] // Streams_ServiceDesc is the grpc.ServiceDesc for Streams service. // It's only intended for direct use with grpc.RegisterService, diff --git a/samples/appendingEvents.go b/samples/appendingEvents.go index 636ae8c5..7b4502a7 100644 --- a/samples/appendingEvents.go +++ b/samples/appendingEvents.go @@ -6,7 +6,7 @@ import ( "github.com/google/uuid" "log" - "github.com/EventStore/EventStore-Client-Go/v4/esdb" + "github.com/EventStore/EventStore-Client-Go/v1/kurrentdb" ) type TestEvent struct { @@ -14,7 +14,7 @@ type TestEvent struct { ImportantData string } -func AppendToStream(db *esdb.Client) { +func AppendToStream(db *kurrentdb.Client) { // region append-to-stream data := TestEvent{ Id: "1", @@ -26,12 +26,12 @@ func AppendToStream(db *esdb.Client) { panic(err) } - options := esdb.AppendToStreamOptions{ - ExpectedRevision: esdb.NoStream{}, + options := kurrentdb.AppendToStreamOptions{ + ExpectedRevision: kurrentdb.NoStream{}, } - result, err := db.AppendToStream(context.Background(), "some-stream", options, esdb.EventData{ - ContentType: esdb.ContentTypeJson, + result, err := db.AppendToStream(context.Background(), "some-stream", options, kurrentdb.EventData{ + ContentType: kurrentdb.ContentTypeJson, EventType: "some-event", Data: bytes, }) @@ -40,7 +40,7 @@ func AppendToStream(db *esdb.Client) { log.Printf("Result: %v", result) } -func AppendWithSameId(db *esdb.Client) { +func AppendWithSameId(db *kurrentdb.Client) { // region append-duplicate-event data := TestEvent{ Id: "1", @@ -53,21 +53,21 @@ func AppendWithSameId(db *esdb.Client) { } id := uuid.New() - event := esdb.EventData{ - ContentType: esdb.ContentTypeJson, + event := kurrentdb.EventData{ + ContentType: kurrentdb.ContentTypeJson, EventType: "some-event", EventID: id, Data: bytes, } - _, err = db.AppendToStream(context.Background(), "some-stream", esdb.AppendToStreamOptions{}, event) + _, err = db.AppendToStream(context.Background(), "some-stream", kurrentdb.AppendToStreamOptions{}, event) if err != nil { panic(err) } // attempt to append the same event again - _, err = db.AppendToStream(context.Background(), "some-stream", esdb.AppendToStreamOptions{}, event) + _, err = db.AppendToStream(context.Background(), "some-stream", kurrentdb.AppendToStreamOptions{}, event) if err != nil { panic(err) @@ -76,7 +76,7 @@ func AppendWithSameId(db *esdb.Client) { // endregion append-duplicate-event } -func AppendWithNoStream(db *esdb.Client) { +func AppendWithNoStream(db *kurrentdb.Client) { // region append-with-no-stream data := TestEvent{ Id: "1", @@ -88,12 +88,12 @@ func AppendWithNoStream(db *esdb.Client) { panic(err) } - options := esdb.AppendToStreamOptions{ - ExpectedRevision: esdb.NoStream{}, + options := kurrentdb.AppendToStreamOptions{ + ExpectedRevision: kurrentdb.NoStream{}, } - _, err = db.AppendToStream(context.Background(), "same-event-stream", options, esdb.EventData{ - ContentType: esdb.ContentTypeJson, + _, err = db.AppendToStream(context.Background(), "same-event-stream", options, kurrentdb.EventData{ + ContentType: kurrentdb.ContentTypeJson, EventType: "some-event", Data: bytes, }) @@ -111,19 +111,19 @@ func AppendWithNoStream(db *esdb.Client) { } // attempt to append the same event again - _, err = db.AppendToStream(context.Background(), "same-event-stream", options, esdb.EventData{ - ContentType: esdb.ContentTypeJson, + _, err = db.AppendToStream(context.Background(), "same-event-stream", options, kurrentdb.EventData{ + ContentType: kurrentdb.ContentTypeJson, EventType: "some-event", Data: bytes, }) // endregion append-with-no-stream } -func AppendWithConcurrencyCheck(db *esdb.Client) { +func AppendWithConcurrencyCheck(db *kurrentdb.Client) { // region append-with-concurrency-check - ropts := esdb.ReadStreamOptions{ - Direction: esdb.Backwards, - From: esdb.End{}, + ropts := kurrentdb.ReadStreamOptions{ + Direction: kurrentdb.Backwards, + From: kurrentdb.End{}, } stream, err := db.ReadStream(context.Background(), "concurrency-stream", ropts, 1) @@ -150,12 +150,12 @@ func AppendWithConcurrencyCheck(db *esdb.Client) { panic(err) } - aopts := esdb.AppendToStreamOptions{ + aopts := kurrentdb.AppendToStreamOptions{ ExpectedRevision: lastEvent.OriginalStreamRevision(), } - _, err = db.AppendToStream(context.Background(), "concurrency-stream", aopts, esdb.EventData{ - ContentType: esdb.ContentTypeJson, + _, err = db.AppendToStream(context.Background(), "concurrency-stream", aopts, kurrentdb.EventData{ + ContentType: kurrentdb.ContentTypeJson, EventType: "some-event", Data: bytes, }) @@ -169,15 +169,15 @@ func AppendWithConcurrencyCheck(db *esdb.Client) { panic(err) } - _, err = db.AppendToStream(context.Background(), "concurrency-stream", aopts, esdb.EventData{ - ContentType: esdb.ContentTypeJson, + _, err = db.AppendToStream(context.Background(), "concurrency-stream", aopts, kurrentdb.EventData{ + ContentType: kurrentdb.ContentTypeJson, EventType: "some-event", Data: bytes, }) // endregion append-with-concurrency-check } -func AppendToStreamOverridingUserCredentials(db *esdb.Client) { +func AppendToStreamOverridingUserCredentials(db *kurrentdb.Client) { data := TestEvent{ Id: "1", ImportantData: "some value", @@ -188,16 +188,16 @@ func AppendToStreamOverridingUserCredentials(db *esdb.Client) { panic(err) } - event := esdb.EventData{ - ContentType: esdb.ContentTypeJson, + event := kurrentdb.EventData{ + ContentType: kurrentdb.ContentTypeJson, EventType: "some-event", Data: bytes, } // region overriding-user-credentials - credentials := &esdb.Credentials{Login: "admin", Password: "changeit"} + credentials := &kurrentdb.Credentials{Login: "admin", Password: "changeit"} - result, err := db.AppendToStream(context.Background(), "some-stream", esdb.AppendToStreamOptions{Authenticated: credentials}, event) + result, err := db.AppendToStream(context.Background(), "some-stream", kurrentdb.AppendToStreamOptions{Authenticated: credentials}, event) // endregion overriding-user-credentials log.Printf("Result: %v", result) diff --git a/samples/persistentSubscriptions.go b/samples/persistentSubscriptions.go index f5beb94e..4a1880ae 100644 --- a/samples/persistentSubscriptions.go +++ b/samples/persistentSubscriptions.go @@ -6,12 +6,12 @@ import ( "log" "strings" - "github.com/EventStore/EventStore-Client-Go/v4/esdb" + "github.com/EventStore/EventStore-Client-Go/v1/kurrentdb" ) -func createPersistentSubscription(client *esdb.Client) { +func createPersistentSubscription(client *kurrentdb.Client) { // #region create-persistent-subscription-to-stream - err := client.CreatePersistentSubscription(context.Background(), "test-stream", "subscription-group", esdb.PersistentStreamSubscriptionOptions{}) + err := client.CreatePersistentSubscription(context.Background(), "test-stream", "subscription-group", kurrentdb.PersistentStreamSubscriptionOptions{}) if err != nil { panic(err) @@ -19,9 +19,9 @@ func createPersistentSubscription(client *esdb.Client) { // #endregion create-persistent-subscription-to-stream } -func connectToPersistentSubscriptionToStream(client *esdb.Client) { +func connectToPersistentSubscriptionToStream(client *kurrentdb.Client) { // #region subscribe-to-persistent-subscription-to-stream - sub, err := client.SubscribeToPersistentSubscription(context.Background(), "test-stream", "subscription-group", esdb.SubscribeToPersistentSubscriptionOptions{}) + sub, err := client.SubscribeToPersistentSubscription(context.Background(), "test-stream", "subscription-group", kurrentdb.SubscribeToPersistentSubscriptionOptions{}) if err != nil { panic(err) @@ -41,9 +41,9 @@ func connectToPersistentSubscriptionToStream(client *esdb.Client) { // #endregion subscribe-to-persistent-subscription-to-stream } -func connectToPersistentSubscriptionToAll(client *esdb.Client) { +func connectToPersistentSubscriptionToAll(client *kurrentdb.Client) { // #region subscribe-to-persistent-subscription-to-all - sub, err := client.SubscribeToPersistentSubscriptionToAll(context.Background(), "subscription-group", esdb.SubscribeToPersistentSubscriptionOptions{}) + sub, err := client.SubscribeToPersistentSubscriptionToAll(context.Background(), "subscription-group", kurrentdb.SubscribeToPersistentSubscriptionOptions{}) if err != nil { panic(err) @@ -63,11 +63,11 @@ func connectToPersistentSubscriptionToAll(client *esdb.Client) { // #endregion subscribe-to-persistent-subscription-to-all } -func createPersistentSubscriptionToAll(client *esdb.Client) { +func createPersistentSubscriptionToAll(client *kurrentdb.Client) { // #region create-persistent-subscription-to-all - options := esdb.PersistentAllSubscriptionOptions{ - Filter: &esdb.SubscriptionFilter{ - Type: esdb.StreamFilterType, + options := kurrentdb.PersistentAllSubscriptionOptions{ + Filter: &kurrentdb.SubscriptionFilter{ + Type: kurrentdb.StreamFilterType, Prefixes: []string{"test"}, }, } @@ -80,9 +80,9 @@ func createPersistentSubscriptionToAll(client *esdb.Client) { // #endregion create-persistent-subscription-to-all } -func connectToPersistentSubscriptionWithManualAcks(client *esdb.Client) { +func connectToPersistentSubscriptionWithManualAcks(client *kurrentdb.Client) { // #region subscribe-to-persistent-subscription-with-manual-acks - sub, err := client.SubscribeToPersistentSubscription(context.Background(), "test-stream", "subscription-group", esdb.SubscribeToPersistentSubscriptionOptions{}) + sub, err := client.SubscribeToPersistentSubscription(context.Background(), "test-stream", "subscription-group", kurrentdb.SubscribeToPersistentSubscriptionOptions{}) if err != nil { panic(err) @@ -102,10 +102,10 @@ func connectToPersistentSubscriptionWithManualAcks(client *esdb.Client) { // #endregion subscribe-to-persistent-subscription-with-manual-acks } -func updatePersistentSubscription(client *esdb.Client) { +func updatePersistentSubscription(client *kurrentdb.Client) { // #region update-persistent-subscription - options := esdb.PersistentStreamSubscriptionOptions{ - Settings: &esdb.PersistentSubscriptionSettings{ + options := kurrentdb.PersistentStreamSubscriptionOptions{ + Settings: &kurrentdb.PersistentSubscriptionSettings{ ResolveLinkTos: true, CheckpointLowerBound: 20, }, @@ -119,9 +119,9 @@ func updatePersistentSubscription(client *esdb.Client) { // #endregion update-persistent-subscription } -func deletePersistentSubscription(client *esdb.Client) { +func deletePersistentSubscription(client *kurrentdb.Client) { // #region delete-persistent-subscription - err := client.DeletePersistentSubscription(context.Background(), "test-stream", "subscription-group", esdb.DeletePersistentSubscriptionOptions{}) + err := client.DeletePersistentSubscription(context.Background(), "test-stream", "subscription-group", kurrentdb.DeletePersistentSubscriptionOptions{}) if err != nil { panic(err) @@ -129,9 +129,9 @@ func deletePersistentSubscription(client *esdb.Client) { // #endregion delete-persistent-subscription } -func deletePersistentSubscriptionToAll(client *esdb.Client) { +func deletePersistentSubscriptionToAll(client *kurrentdb.Client) { // #region delete-persistent-subscription-all - err := client.DeletePersistentSubscriptionToAll(context.Background(), "test-stream", esdb.DeletePersistentSubscriptionOptions{}) + err := client.DeletePersistentSubscriptionToAll(context.Background(), "test-stream", kurrentdb.DeletePersistentSubscriptionOptions{}) if err != nil { panic(err) @@ -139,9 +139,9 @@ func deletePersistentSubscriptionToAll(client *esdb.Client) { // #endregion delete-persistent-subscription-all } -func getPersistentSubscriptionToStreamInfo(client *esdb.Client) { +func getPersistentSubscriptionToStreamInfo(client *kurrentdb.Client) { // #region get-persistent-subscription-to-stream-info - info, err := client.GetPersistentSubscriptionInfo(context.Background(), "test-stream", "subscription-group", esdb.GetPersistentSubscriptionOptions{}) + info, err := client.GetPersistentSubscriptionInfo(context.Background(), "test-stream", "subscription-group", kurrentdb.GetPersistentSubscriptionOptions{}) if err != nil { panic(err) @@ -151,9 +151,9 @@ func getPersistentSubscriptionToStreamInfo(client *esdb.Client) { // #endregion get-persistent-subscription-to-stream-info } -func getPersistentSubscriptionToAllInfo(client *esdb.Client) { +func getPersistentSubscriptionToAllInfo(client *kurrentdb.Client) { // #region get-persistent-subscription-to-all-info - info, err := client.GetPersistentSubscriptionInfoToAll(context.Background(), "subscription-group", esdb.GetPersistentSubscriptionOptions{}) + info, err := client.GetPersistentSubscriptionInfoToAll(context.Background(), "subscription-group", kurrentdb.GetPersistentSubscriptionOptions{}) if err != nil { panic(err) @@ -163,9 +163,9 @@ func getPersistentSubscriptionToAllInfo(client *esdb.Client) { // #endregion get-persistent-subscription-to-all-info } -func replayParkedToStream(client *esdb.Client) { +func replayParkedToStream(client *kurrentdb.Client) { // #region replay-parked-of-persistent-subscription-to-stream - err := client.ReplayParkedMessages(context.Background(), "test-stream", "subscription-group", esdb.ReplayParkedMessagesOptions{ + err := client.ReplayParkedMessages(context.Background(), "test-stream", "subscription-group", kurrentdb.ReplayParkedMessagesOptions{ StopAt: 10, }) @@ -175,9 +175,9 @@ func replayParkedToStream(client *esdb.Client) { // #endregion replay-parked-of-persistent-subscription-to-stream } -func replayParkedToAll(client *esdb.Client) { +func replayParkedToAll(client *kurrentdb.Client) { // #region replay-parked-of-persistent-subscription-to-all - err := client.ReplayParkedMessagesToAll(context.Background(), "subscription-group", esdb.ReplayParkedMessagesOptions{ + err := client.ReplayParkedMessagesToAll(context.Background(), "subscription-group", kurrentdb.ReplayParkedMessagesOptions{ StopAt: 10, }) @@ -187,9 +187,9 @@ func replayParkedToAll(client *esdb.Client) { // #endregion replay-parked-of-persistent-subscription-to-all } -func listPersistentSubscriptionsToStream(client *esdb.Client) { +func listPersistentSubscriptionsToStream(client *kurrentdb.Client) { // #region list-persistent-subscriptions-to-stream - subs, err := client.ListPersistentSubscriptionsForStream(context.Background(), "test-stream", esdb.ListPersistentSubscriptionsOptions{}) + subs, err := client.ListPersistentSubscriptionsForStream(context.Background(), "test-stream", kurrentdb.ListPersistentSubscriptionsOptions{}) if err != nil { panic(err) @@ -213,9 +213,9 @@ func listPersistentSubscriptionsToStream(client *esdb.Client) { // #endregion list-persistent-subscriptions-to-stream } -func listPersistentSubscriptionsToAll(client *esdb.Client) { +func listPersistentSubscriptionsToAll(client *kurrentdb.Client) { // #region list-persistent-subscriptions-to-all - subs, err := client.ListPersistentSubscriptionsToAll(context.Background(), esdb.ListPersistentSubscriptionsOptions{}) + subs, err := client.ListPersistentSubscriptionsToAll(context.Background(), kurrentdb.ListPersistentSubscriptionsOptions{}) if err != nil { panic(err) @@ -239,9 +239,9 @@ func listPersistentSubscriptionsToAll(client *esdb.Client) { // #endregion list-persistent-subscriptions-to-all } -func restartPersistentSubscriptionSubsystem(client *esdb.Client) { +func restartPersistentSubscriptionSubsystem(client *kurrentdb.Client) { // #region restart-persistent-subscription-subsystem - err := client.RestartPersistentSubscriptionSubsystem(context.Background(), esdb.RestartPersistentSubscriptionSubsystemOptions{}) + err := client.RestartPersistentSubscriptionSubsystem(context.Background(), kurrentdb.RestartPersistentSubscriptionSubsystemOptions{}) if err != nil { panic(err) diff --git a/samples/projectionManagement.go b/samples/projectionManagement.go index 2905a0dd..5bd1a8b5 100644 --- a/samples/projectionManagement.go +++ b/samples/projectionManagement.go @@ -8,18 +8,18 @@ import ( "log" "strings" - "github.com/EventStore/EventStore-Client-Go/v4/esdb" + "github.com/EventStore/EventStore-Client-Go/v1/kurrentdb" ) func CreateClient(connectionString string) { // region createClient - conf, err := esdb.ParseConnectionString(connectionString) + conf, err := kurrentdb.ParseConnectionString(connectionString) if err != nil { panic(err) } - client, err := esdb.NewProjectionClient(conf) + client, err := kurrentdb.NewProjectionClient(conf) if err != nil { panic(err) @@ -29,9 +29,9 @@ func CreateClient(connectionString string) { defer client.Close() } -func Disable(client *esdb.ProjectionClient) { +func Disable(client *kurrentdb.ProjectionClient) { // region disable - err := client.Disable(context.Background(), "$by_category", esdb.GenericProjectionOptions{}) + err := client.Disable(context.Background(), "$by_category", kurrentdb.GenericProjectionOptions{}) if err != nil { panic(err) @@ -39,12 +39,12 @@ func Disable(client *esdb.ProjectionClient) { // endregion disable } -func DisableNotFound(client *esdb.ProjectionClient) { +func DisableNotFound(client *kurrentdb.ProjectionClient) { // region disableNotFound - err := client.Disable(context.Background(), "projection that doesn't exist", esdb.GenericProjectionOptions{}) + err := client.Disable(context.Background(), "projection that doesn't exist", kurrentdb.GenericProjectionOptions{}) - if esdbError, ok := esdb.FromError(err); !ok { - if esdbError.IsErrorCode(esdb.ErrorCodeResourceNotFound) { + if esdbError, ok := kurrentdb.FromError(err); !ok { + if esdbError.IsErrorCode(kurrentdb.ErrorCodeResourceNotFound) { log.Printf("projection not found") return } @@ -52,9 +52,9 @@ func DisableNotFound(client *esdb.ProjectionClient) { // endregion disableNotFound } -func Enable(client *esdb.ProjectionClient) { +func Enable(client *kurrentdb.ProjectionClient) { // region enable - err := client.Enable(context.Background(), "$by_category", esdb.GenericProjectionOptions{}) + err := client.Enable(context.Background(), "$by_category", kurrentdb.GenericProjectionOptions{}) if err != nil { panic(err) @@ -62,12 +62,12 @@ func Enable(client *esdb.ProjectionClient) { // endregion enable } -func EnableNotFound(client *esdb.ProjectionClient) { +func EnableNotFound(client *kurrentdb.ProjectionClient) { // region enableNotFound - err := client.Enable(context.Background(), "projection that doesn't exist", esdb.GenericProjectionOptions{}) + err := client.Enable(context.Background(), "projection that doesn't exist", kurrentdb.GenericProjectionOptions{}) - if esdbError, ok := esdb.FromError(err); !ok { - if esdbError.IsErrorCode(esdb.ErrorCodeResourceNotFound) { + if esdbError, ok := kurrentdb.FromError(err); !ok { + if esdbError.IsErrorCode(kurrentdb.ErrorCodeResourceNotFound) { log.Printf("projection not found") return } @@ -75,9 +75,9 @@ func EnableNotFound(client *esdb.ProjectionClient) { // endregion enableNotFound } -func Delete(client *esdb.ProjectionClient) { +func Delete(client *kurrentdb.ProjectionClient) { // region delete - err := client.Delete(context.Background(), "$by_category", esdb.DeleteProjectionOptions{}) + err := client.Delete(context.Background(), "$by_category", kurrentdb.DeleteProjectionOptions{}) if err != nil { panic(err) @@ -85,12 +85,12 @@ func Delete(client *esdb.ProjectionClient) { // endregion delete } -func DeleteNotFound(client *esdb.ProjectionClient) { +func DeleteNotFound(client *kurrentdb.ProjectionClient) { // region deleteNotFound - err := client.Delete(context.Background(), "projection that doesn't exist", esdb.DeleteProjectionOptions{}) + err := client.Delete(context.Background(), "projection that doesn't exist", kurrentdb.DeleteProjectionOptions{}) - if esdbError, ok := esdb.FromError(err); !ok { - if esdbError.IsErrorCode(esdb.ErrorCodeResourceNotFound) { + if esdbError, ok := kurrentdb.FromError(err); !ok { + if esdbError.IsErrorCode(kurrentdb.ErrorCodeResourceNotFound) { log.Printf("projection not found") return } @@ -98,9 +98,9 @@ func DeleteNotFound(client *esdb.ProjectionClient) { // endregion deleteNotFound } -func Abort(client *esdb.ProjectionClient) { +func Abort(client *kurrentdb.ProjectionClient) { // region abort - err := client.Abort(context.Background(), "$by_category", esdb.GenericProjectionOptions{}) + err := client.Abort(context.Background(), "$by_category", kurrentdb.GenericProjectionOptions{}) if err != nil { panic(err) @@ -108,12 +108,12 @@ func Abort(client *esdb.ProjectionClient) { // endregion abort } -func AbortNotFound(client *esdb.ProjectionClient) { +func AbortNotFound(client *kurrentdb.ProjectionClient) { // region abortNotFound - err := client.Abort(context.Background(), "projection that doesn't exist", esdb.GenericProjectionOptions{}) + err := client.Abort(context.Background(), "projection that doesn't exist", kurrentdb.GenericProjectionOptions{}) - if esdbError, ok := esdb.FromError(err); !ok { - if esdbError.IsErrorCode(esdb.ErrorCodeResourceNotFound) { + if esdbError, ok := kurrentdb.FromError(err); !ok { + if esdbError.IsErrorCode(kurrentdb.ErrorCodeResourceNotFound) { log.Printf("projection not found") return } @@ -121,9 +121,9 @@ func AbortNotFound(client *esdb.ProjectionClient) { // endregion abortNotFound } -func Reset(client *esdb.ProjectionClient) { +func Reset(client *kurrentdb.ProjectionClient) { // region reset - err := client.Reset(context.Background(), "$by_category", esdb.ResetProjectionOptions{}) + err := client.Reset(context.Background(), "$by_category", kurrentdb.ResetProjectionOptions{}) if err != nil { panic(err) @@ -131,12 +131,12 @@ func Reset(client *esdb.ProjectionClient) { // endregion reset } -func ResetNotFound(client *esdb.ProjectionClient) { +func ResetNotFound(client *kurrentdb.ProjectionClient) { // region resetNotFound - err := client.Reset(context.Background(), "projection that doesn't exist", esdb.ResetProjectionOptions{}) + err := client.Reset(context.Background(), "projection that doesn't exist", kurrentdb.ResetProjectionOptions{}) - if esdbError, ok := esdb.FromError(err); !ok { - if esdbError.IsErrorCode(esdb.ErrorCodeResourceNotFound) { + if esdbError, ok := kurrentdb.FromError(err); !ok { + if esdbError.IsErrorCode(kurrentdb.ErrorCodeResourceNotFound) { log.Printf("projection not found") return } @@ -144,7 +144,7 @@ func ResetNotFound(client *esdb.ProjectionClient) { // endregion resetNotFound } -func Create(client *esdb.ProjectionClient) { +func Create(client *kurrentdb.ProjectionClient) { // region createContinuous script := ` fromAll() @@ -164,7 +164,7 @@ fromAll() .outputState() ` name := fmt.Sprintf("countEvent_Create_%s", uuid.New()) - err := client.Create(context.Background(), name, script, esdb.CreateProjectionOptions{}) + err := client.Create(context.Background(), name, script, kurrentdb.CreateProjectionOptions{}) if err != nil { panic(err) @@ -173,15 +173,15 @@ fromAll() // endregion createContinuous } -func CreateConflict(client *esdb.ProjectionClient) { +func CreateConflict(client *kurrentdb.ProjectionClient) { script := "" name := "" // region createContinuousConflict - err := client.Create(context.Background(), name, script, esdb.CreateProjectionOptions{}) + err := client.Create(context.Background(), name, script, kurrentdb.CreateProjectionOptions{}) - if esdbErr, ok := esdb.FromError(err); !ok { - if esdbErr.IsErrorCode(esdb.ErrorCodeUnknown) && strings.Contains(esdbErr.Err().Error(), "Conflict") { + if esdbErr, ok := kurrentdb.FromError(err); !ok { + if esdbErr.IsErrorCode(kurrentdb.ErrorCodeUnknown) && strings.Contains(esdbErr.Err().Error(), "Conflict") { log.Printf("projection %s already exists", name) return } @@ -189,19 +189,19 @@ func CreateConflict(client *esdb.ProjectionClient) { // endregion createContinuousConflict } -func Update(client *esdb.ProjectionClient) { +func Update(client *kurrentdb.ProjectionClient) { script := "" newScript := "" name := "" // region update - err := client.Create(context.Background(), name, script, esdb.CreateProjectionOptions{}) + err := client.Create(context.Background(), name, script, kurrentdb.CreateProjectionOptions{}) if err != nil { panic(err) } - err = client.Update(context.Background(), name, newScript, esdb.UpdateProjectionOptions{}) + err = client.Update(context.Background(), name, newScript, kurrentdb.UpdateProjectionOptions{}) if err != nil { panic(err) @@ -210,14 +210,14 @@ func Update(client *esdb.ProjectionClient) { } -func UpdateNotFound(client *esdb.ProjectionClient) { +func UpdateNotFound(client *kurrentdb.ProjectionClient) { script := "" // region updateNotFound - err := client.Update(context.Background(), "projection that doesn't exist", script, esdb.UpdateProjectionOptions{}) + err := client.Update(context.Background(), "projection that doesn't exist", script, kurrentdb.UpdateProjectionOptions{}) - if esdbError, ok := esdb.FromError(err); !ok { - if esdbError.IsErrorCode(esdb.ErrorCodeResourceNotFound) { + if esdbError, ok := kurrentdb.FromError(err); !ok { + if esdbError.IsErrorCode(kurrentdb.ErrorCodeResourceNotFound) { log.Printf("projection not found") return } @@ -225,9 +225,9 @@ func UpdateNotFound(client *esdb.ProjectionClient) { // endregion updateNotFound } -func ListAll(client *esdb.ProjectionClient) { +func ListAll(client *kurrentdb.ProjectionClient) { // region listAll - projections, err := client.ListAll(context.Background(), esdb.GenericProjectionOptions{}) + projections, err := client.ListAll(context.Background(), kurrentdb.GenericProjectionOptions{}) if err != nil { panic(err) @@ -248,9 +248,9 @@ func ListAll(client *esdb.ProjectionClient) { // endregion listAll } -func List(client *esdb.ProjectionClient) { +func List(client *kurrentdb.ProjectionClient) { // region listContinuous - projections, err := client.ListContinuous(context.Background(), esdb.GenericProjectionOptions{}) + projections, err := client.ListContinuous(context.Background(), kurrentdb.GenericProjectionOptions{}) if err != nil { panic(err) @@ -271,9 +271,9 @@ func List(client *esdb.ProjectionClient) { // endregion listContinuous } -func GetStatus(client *esdb.ProjectionClient) { +func GetStatus(client *kurrentdb.ProjectionClient) { // region getStatus - projection, err := client.GetStatus(context.Background(), "$by_category", esdb.GenericProjectionOptions{}) + projection, err := client.GetStatus(context.Background(), "$by_category", kurrentdb.GenericProjectionOptions{}) if err != nil { panic(err) @@ -290,14 +290,14 @@ func GetStatus(client *esdb.ProjectionClient) { // endregion getStatus } -func GetState(client *esdb.ProjectionClient) { +func GetState(client *kurrentdb.ProjectionClient) { projectionName := "" // region getState type Foobar struct { Count int64 } - value, err := client.GetState(context.Background(), projectionName, esdb.GetStateProjectionOptions{}) + value, err := client.GetState(context.Background(), projectionName, kurrentdb.GetStateProjectionOptions{}) if err != nil { panic(err) @@ -319,14 +319,14 @@ func GetState(client *esdb.ProjectionClient) { // endregion getState } -func GetResult(client *esdb.ProjectionClient) { +func GetResult(client *kurrentdb.ProjectionClient) { projectionName := "" // region getResult type Baz struct { Result int64 } - value, err := client.GetResult(context.Background(), projectionName, esdb.GetResultProjectionOptions{}) + value, err := client.GetResult(context.Background(), projectionName, kurrentdb.GetResultProjectionOptions{}) if err != nil { panic(err) @@ -348,9 +348,9 @@ func GetResult(client *esdb.ProjectionClient) { // endregion getResult } -func RestartSubSystem(client *esdb.ProjectionClient) { +func RestartSubSystem(client *kurrentdb.ProjectionClient) { // region restartSubsystem - err := client.RestartSubsystem(context.Background(), esdb.GenericProjectionOptions{}) + err := client.RestartSubsystem(context.Background(), kurrentdb.GenericProjectionOptions{}) if err != nil { panic(err) diff --git a/samples/quickstart.go b/samples/quickstart.go index f232f7d9..e517fffb 100644 --- a/samples/quickstart.go +++ b/samples/quickstart.go @@ -8,18 +8,18 @@ import ( "github.com/google/uuid" "io" - "github.com/EventStore/EventStore-Client-Go/v4/esdb" + "github.com/EventStore/EventStore-Client-Go/v1/kurrentdb" ) func Run() { // region createClient - settings, err := esdb.ParseConnectionString("{connectionString}") + settings, err := kurrentdb.ParseConnectionString("{connectionString}") if err != nil { panic(err) } - db, err := esdb.NewClient(settings) + db, err := kurrentdb.NewClient(settings) // endregion createClient if err != nil { @@ -38,15 +38,15 @@ func Run() { panic(err) } - eventData := esdb.EventData{ - ContentType: esdb.ContentTypeJson, + eventData := kurrentdb.EventData{ + ContentType: kurrentdb.ContentTypeJson, EventType: "TestEvent", Data: data, } // endregion createEvent // region appendEvents - _, err = db.AppendToStream(context.Background(), "some-stream", esdb.AppendToStreamOptions{}, eventData) + _, err = db.AppendToStream(context.Background(), "some-stream", kurrentdb.AppendToStreamOptions{}, eventData) // endregion appendEvents if err != nil { @@ -54,7 +54,7 @@ func Run() { } // region readStream - stream, err := db.ReadStream(context.Background(), "some-stream", esdb.ReadStreamOptions{}, 10) + stream, err := db.ReadStream(context.Background(), "some-stream", kurrentdb.ReadStreamOptions{}, 10) if err != nil { panic(err) diff --git a/samples/readingEvents.go b/samples/readingEvents.go index 7bf3e3d2..4e9db79e 100644 --- a/samples/readingEvents.go +++ b/samples/readingEvents.go @@ -7,14 +7,14 @@ import ( "io" "strings" - "github.com/EventStore/EventStore-Client-Go/v4/esdb" + "github.com/EventStore/EventStore-Client-Go/v1/kurrentdb" ) -func ReadFromStream(db *esdb.Client) { +func ReadFromStream(db *kurrentdb.Client) { // region read-from-stream - options := esdb.ReadStreamOptions{ - From: esdb.Start{}, - Direction: esdb.Forwards, + options := kurrentdb.ReadStreamOptions{ + From: kurrentdb.Start{}, + Direction: kurrentdb.Forwards, } stream, err := db.ReadStream(context.Background(), "some-stream", options, 100) @@ -41,10 +41,10 @@ func ReadFromStream(db *esdb.Client) { // endregion iterate-stream } -func ReadFromStreamPosition(db *esdb.Client) { +func ReadFromStreamPosition(db *kurrentdb.Client) { // region read-from-stream-position - ropts := esdb.ReadStreamOptions{ - From: esdb.Revision(10), + ropts := kurrentdb.ReadStreamOptions{ + From: kurrentdb.Revision(10), } stream, err := db.ReadStream(context.Background(), "some-stream", ropts, 20) @@ -72,11 +72,11 @@ func ReadFromStreamPosition(db *esdb.Client) { // endregion iterate-stream } -func ReadStreamOverridingUserCredentials(db *esdb.Client) { +func ReadStreamOverridingUserCredentials(db *kurrentdb.Client) { // region overriding-user-credentials - options := esdb.ReadStreamOptions{ - From: esdb.Start{}, - Authenticated: &esdb.Credentials{ + options := kurrentdb.ReadStreamOptions{ + From: kurrentdb.Start{}, + Authenticated: &kurrentdb.Credentials{ Login: "admin", Password: "changeit", }, @@ -91,10 +91,10 @@ func ReadStreamOverridingUserCredentials(db *esdb.Client) { stream.Close() } -func ReadFromStreamPositionCheck(db *esdb.Client) { +func ReadFromStreamPositionCheck(db *kurrentdb.Client) { // region checking-for-stream-presence - ropts := esdb.ReadStreamOptions{ - From: esdb.Revision(10), + ropts := kurrentdb.ReadStreamOptions{ + From: kurrentdb.Revision(10), } stream, err := db.ReadStream(context.Background(), "some-stream", ropts, 100) @@ -108,8 +108,8 @@ func ReadFromStreamPositionCheck(db *esdb.Client) { for { event, err := stream.Recv() - if err, ok := esdb.FromError(err); !ok { - if err.Code() == esdb.ErrorCodeResourceNotFound { + if err, ok := kurrentdb.FromError(err); !ok { + if err.Code() == kurrentdb.ErrorCodeResourceNotFound { fmt.Print("Stream not found") } else if errors.Is(err, io.EOF) { break @@ -123,11 +123,11 @@ func ReadFromStreamPositionCheck(db *esdb.Client) { // endregion checking-for-stream-presence } -func ReadStreamBackwards(db *esdb.Client) { +func ReadStreamBackwards(db *kurrentdb.Client) { // region reading-backwards - ropts := esdb.ReadStreamOptions{ - Direction: esdb.Backwards, - From: esdb.End{}, + ropts := kurrentdb.ReadStreamOptions{ + Direction: kurrentdb.Backwards, + From: kurrentdb.End{}, } stream, err := db.ReadStream(context.Background(), "some-stream", ropts, 10) @@ -154,11 +154,11 @@ func ReadStreamBackwards(db *esdb.Client) { // endregion reading-backwards } -func ReadFromAllStream(db *esdb.Client) { +func ReadFromAllStream(db *kurrentdb.Client) { // region read-from-all-stream - options := esdb.ReadAllOptions{ - From: esdb.Start{}, - Direction: esdb.Forwards, + options := kurrentdb.ReadAllOptions{ + From: kurrentdb.Start{}, + Direction: kurrentdb.Forwards, } stream, err := db.ReadAll(context.Background(), options, 100) @@ -185,9 +185,9 @@ func ReadFromAllStream(db *esdb.Client) { // endregion read-from-all-stream-iterate } -func IgnoreSystemEvents(db *esdb.Client) { +func IgnoreSystemEvents(db *kurrentdb.Client) { // region ignore-system-events - stream, err := db.ReadAll(context.Background(), esdb.ReadAllOptions{}, 100) + stream, err := db.ReadAll(context.Background(), kurrentdb.ReadAllOptions{}, 100) if err != nil { panic(err) @@ -217,11 +217,11 @@ func IgnoreSystemEvents(db *esdb.Client) { // endregion ignore-system-events } -func ReadFromAllBackwards(db *esdb.Client) { +func ReadFromAllBackwards(db *kurrentdb.Client) { // region read-from-all-stream-backwards - ropts := esdb.ReadAllOptions{ - Direction: esdb.Backwards, - From: esdb.End{}, + ropts := kurrentdb.ReadAllOptions{ + Direction: kurrentdb.Backwards, + From: kurrentdb.End{}, } stream, err := db.ReadAll(context.Background(), ropts, 100) @@ -249,9 +249,9 @@ func ReadFromAllBackwards(db *esdb.Client) { // endregion read-from-all-stream-backwards-iterate } -func ReadFromStreamResolvingLinkToS(db *esdb.Client) { +func ReadFromStreamResolvingLinkToS(db *kurrentdb.Client) { // region read-from-all-stream-resolving-link-Tos - ropts := esdb.ReadAllOptions{ + ropts := kurrentdb.ReadAllOptions{ ResolveLinkTos: true, } @@ -265,11 +265,11 @@ func ReadFromStreamResolvingLinkToS(db *esdb.Client) { defer stream.Close() } -func ReadAllOverridingUserCredentials(db *esdb.Client) { +func ReadAllOverridingUserCredentials(db *kurrentdb.Client) { // region read-all-overriding-user-credentials - ropts := esdb.ReadAllOptions{ - From: esdb.Start{}, - Authenticated: &esdb.Credentials{ + ropts := kurrentdb.ReadAllOptions{ + From: kurrentdb.Start{}, + Authenticated: &kurrentdb.Credentials{ Login: "admin", Password: "changeit", }, diff --git a/samples/serverSideFiltering.go b/samples/serverSideFiltering.go index 2fc936f0..846456e4 100644 --- a/samples/serverSideFiltering.go +++ b/samples/serverSideFiltering.go @@ -4,13 +4,13 @@ import ( "context" "fmt" - "github.com/EventStore/EventStore-Client-Go/v4/esdb" + "github.com/EventStore/EventStore-Client-Go/v1/kurrentdb" ) -func ExcludeSystemEvents(db *esdb.Client) { +func ExcludeSystemEvents(db *kurrentdb.Client) { // region exclude-system - sub, err := db.SubscribeToAll(context.Background(), esdb.SubscribeToAllOptions{ - Filter: esdb.ExcludeSystemEventsFilter(), + sub, err := db.SubscribeToAll(context.Background(), kurrentdb.SubscribeToAllOptions{ + Filter: kurrentdb.ExcludeSystemEventsFilter(), }) if err != nil { @@ -37,11 +37,11 @@ func ExcludeSystemEvents(db *esdb.Client) { // endregion exclude-system } -func EventTypePrefix(db *esdb.Client) { +func EventTypePrefix(db *kurrentdb.Client) { // region event-type-prefix - sub, err := db.SubscribeToAll(context.Background(), esdb.SubscribeToAllOptions{ - Filter: &esdb.SubscriptionFilter{ - Type: esdb.EventFilterType, + sub, err := db.SubscribeToAll(context.Background(), kurrentdb.SubscribeToAllOptions{ + Filter: &kurrentdb.SubscriptionFilter{ + Type: kurrentdb.EventFilterType, Prefixes: []string{"customer-"}, }, }) @@ -70,11 +70,11 @@ func EventTypePrefix(db *esdb.Client) { // endregion event-type-prefix } -func EventTypeRegex(db *esdb.Client) { +func EventTypeRegex(db *kurrentdb.Client) { // region event-type-regex - sub, err := db.SubscribeToAll(context.Background(), esdb.SubscribeToAllOptions{ - Filter: &esdb.SubscriptionFilter{ - Type: esdb.EventFilterType, + sub, err := db.SubscribeToAll(context.Background(), kurrentdb.SubscribeToAllOptions{ + Filter: &kurrentdb.SubscriptionFilter{ + Type: kurrentdb.EventFilterType, Regex: "^user|^company", }, }) @@ -103,11 +103,11 @@ func EventTypeRegex(db *esdb.Client) { // endregion event-type-regex } -func StreamPrefix(db *esdb.Client) { +func StreamPrefix(db *kurrentdb.Client) { // region stream-prefix - sub, err := db.SubscribeToAll(context.Background(), esdb.SubscribeToAllOptions{ - Filter: &esdb.SubscriptionFilter{ - Type: esdb.StreamFilterType, + sub, err := db.SubscribeToAll(context.Background(), kurrentdb.SubscribeToAllOptions{ + Filter: &kurrentdb.SubscriptionFilter{ + Type: kurrentdb.StreamFilterType, Prefixes: []string{"user-"}, }, }) @@ -136,11 +136,11 @@ func StreamPrefix(db *esdb.Client) { // endregion stream-prefix } -func StreamRegex(db *esdb.Client) { +func StreamRegex(db *kurrentdb.Client) { // region stream-regex - sub, err := db.SubscribeToAll(context.Background(), esdb.SubscribeToAllOptions{ - Filter: &esdb.SubscriptionFilter{ - Type: esdb.StreamFilterType, + sub, err := db.SubscribeToAll(context.Background(), kurrentdb.SubscribeToAllOptions{ + Filter: &kurrentdb.SubscriptionFilter{ + Type: kurrentdb.StreamFilterType, Regex: "^user|^company", }, }) @@ -169,11 +169,11 @@ func StreamRegex(db *esdb.Client) { // endregion stream-regex } -func CheckpointCallbackWithInterval(db *esdb.Client) { +func CheckpointCallbackWithInterval(db *kurrentdb.Client) { // region checkpoint-with-interval - sub, err := db.SubscribeToAll(context.Background(), esdb.SubscribeToAllOptions{ - Filter: &esdb.SubscriptionFilter{ - Type: esdb.EventFilterType, + sub, err := db.SubscribeToAll(context.Background(), kurrentdb.SubscribeToAllOptions{ + Filter: &kurrentdb.SubscriptionFilter{ + Type: kurrentdb.EventFilterType, Regex: "/^[^\\$].*/", }, }) diff --git a/samples/subscribingToStream.go b/samples/subscribingToStream.go index 15630a2a..83cbd6d5 100644 --- a/samples/subscribingToStream.go +++ b/samples/subscribingToStream.go @@ -4,13 +4,13 @@ import ( "context" "time" - "github.com/EventStore/EventStore-Client-Go/v4/esdb" + "github.com/EventStore/EventStore-Client-Go/v1/kurrentdb" ) -func SubscribeToStream(db *esdb.Client) { - options := esdb.SubscribeToStreamOptions{} +func SubscribeToStream(db *kurrentdb.Client) { + options := kurrentdb.SubscribeToStreamOptions{} // region subscribe-to-stream - stream, err := db.SubscribeToStream(context.Background(), "some-stream", esdb.SubscribeToStreamOptions{}) + stream, err := db.SubscribeToStream(context.Background(), "some-stream", kurrentdb.SubscribeToStreamOptions{}) if err != nil { panic(err) @@ -32,22 +32,22 @@ func SubscribeToStream(db *esdb.Client) { // endregion subscribe-to-stream // region subscribe-to-stream-from-position - db.SubscribeToStream(context.Background(), "some-stream", esdb.SubscribeToStreamOptions{ - From: esdb.Revision(20), + db.SubscribeToStream(context.Background(), "some-stream", kurrentdb.SubscribeToStreamOptions{ + From: kurrentdb.Revision(20), }) // endregion subscribe-to-stream-from-position // region subscribe-to-stream-live - options = esdb.SubscribeToStreamOptions{ - From: esdb.End{}, + options = kurrentdb.SubscribeToStreamOptions{ + From: kurrentdb.End{}, } db.SubscribeToStream(context.Background(), "some-stream", options) // endregion subscribe-to-stream-live // region subscribe-to-stream-resolving-linktos - options = esdb.SubscribeToStreamOptions{ - From: esdb.Start{}, + options = kurrentdb.SubscribeToStreamOptions{ + From: kurrentdb.Start{}, ResolveLinkTos: true, } @@ -55,8 +55,8 @@ func SubscribeToStream(db *esdb.Client) { // endregion subscribe-to-stream-resolving-linktos // region subscribe-to-stream-subscription-dropped - options = esdb.SubscribeToStreamOptions{ - From: esdb.Start{}, + options = kurrentdb.SubscribeToStreamOptions{ + From: kurrentdb.Start{}, } for { @@ -78,17 +78,17 @@ func SubscribeToStream(db *esdb.Client) { if event.EventAppeared != nil { // handles the event... - options.From = esdb.Revision(event.EventAppeared.OriginalEvent().EventNumber) + options.From = kurrentdb.Revision(event.EventAppeared.OriginalEvent().EventNumber) } } } // endregion subscribe-to-stream-subscription-dropped } -func SubscribeToAll(db *esdb.Client) { - options := esdb.SubscribeToAllOptions{} +func SubscribeToAll(db *kurrentdb.Client) { + options := kurrentdb.SubscribeToAllOptions{} // region subscribe-to-all - stream, err := db.SubscribeToAll(context.Background(), esdb.SubscribeToAllOptions{}) + stream, err := db.SubscribeToAll(context.Background(), kurrentdb.SubscribeToAllOptions{}) if err != nil { panic(err) @@ -110,8 +110,8 @@ func SubscribeToAll(db *esdb.Client) { // endregion subscribe-to-all // region subscribe-to-all-from-position - db.SubscribeToAll(context.Background(), esdb.SubscribeToAllOptions{ - From: esdb.Position{ + db.SubscribeToAll(context.Background(), kurrentdb.SubscribeToAllOptions{ + From: kurrentdb.Position{ Commit: 1_056, Prepare: 1_056, }, @@ -119,14 +119,14 @@ func SubscribeToAll(db *esdb.Client) { // endregion subscribe-to-all-from-position // region subscribe-to-all-live - db.SubscribeToAll(context.Background(), esdb.SubscribeToAllOptions{ - From: esdb.End{}, + db.SubscribeToAll(context.Background(), kurrentdb.SubscribeToAllOptions{ + From: kurrentdb.End{}, }) // endregion subscribe-to-all-live // region subscribe-to-all-subscription-dropped - options = esdb.SubscribeToAllOptions{ - From: esdb.Start{}, + options = kurrentdb.SubscribeToAllOptions{ + From: kurrentdb.Start{}, } for { @@ -154,29 +154,29 @@ func SubscribeToAll(db *esdb.Client) { // endregion subscribe-to-all-subscription-dropped } -func SubscribeToFiltered(db *esdb.Client) { +func SubscribeToFiltered(db *kurrentdb.Client) { // region stream-prefix-filtered-subscription - db.SubscribeToAll(context.Background(), esdb.SubscribeToAllOptions{ - Filter: &esdb.SubscriptionFilter{ - Type: esdb.StreamFilterType, + db.SubscribeToAll(context.Background(), kurrentdb.SubscribeToAllOptions{ + Filter: &kurrentdb.SubscriptionFilter{ + Type: kurrentdb.StreamFilterType, Prefixes: []string{"test-"}, }, }) // endregion stream-prefix-filtered-subscription // region stream-regex-filtered-subscription - db.SubscribeToAll(context.Background(), esdb.SubscribeToAllOptions{ - Filter: &esdb.SubscriptionFilter{ - Type: esdb.StreamFilterType, + db.SubscribeToAll(context.Background(), kurrentdb.SubscribeToAllOptions{ + Filter: &kurrentdb.SubscriptionFilter{ + Type: kurrentdb.StreamFilterType, Regex: "/invoice-\\d\\d\\d/g", }, }) // endregion stream-regex-filtered-subscription } -func SubscribeToAllOverridingUserCredentials(db *esdb.Client) { +func SubscribeToAllOverridingUserCredentials(db *kurrentdb.Client) { // region overriding-user-credentials - db.SubscribeToAll(context.Background(), esdb.SubscribeToAllOptions{ - Authenticated: &esdb.Credentials{ + db.SubscribeToAll(context.Background(), kurrentdb.SubscribeToAllOptions{ + Authenticated: &kurrentdb.Credentials{ Login: "admin", Password: "changeit", }, diff --git a/samples/userCertificates.go b/samples/userCertificates.go index 8d27e1e0..cbda839f 100644 --- a/samples/userCertificates.go +++ b/samples/userCertificates.go @@ -1,18 +1,18 @@ package samples import ( - "github.com/EventStore/EventStore-Client-Go/v4/esdb" + "github.com/EventStore/EventStore-Client-Go/v1/kurrentdb" ) func UserCertificates() { // region client-with-user-certificates - settings, err := esdb.ParseConnectionString("esdb://admin:changeit@{endpoint}?tls=true&userCertFile={pathToCaFile}&userKeyFile={pathToKeyFile}") + settings, err := kurrentdb.ParseConnectionString("esdb://admin:changeit@{endpoint}?tls=true&userCertFile={pathToCaFile}&userKeyFile={pathToKeyFile}") if err != nil { panic(err) } - db, err := esdb.NewClient(settings) + db, err := kurrentdb.NewClient(settings) // endregion client-with-user-certificates if err != nil {