Skip to content

Commit

Permalink
refactor: move datastores into a separate repo (#113)
Browse files Browse the repository at this point in the history
  • Loading branch information
Tochemey authored Dec 26, 2024
1 parent 4c39445 commit 55ce85e
Show file tree
Hide file tree
Showing 39 changed files with 61 additions and 4,966 deletions.
9 changes: 4 additions & 5 deletions durable_state_actor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,15 @@ import (
"github.com/google/uuid"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
memory "github.com/tochemey/ego-contrib/durablestore/memory"
pgstore "github.com/tochemey/ego-contrib/durablestore/postgres"
"github.com/tochemey/goakt/v2/actors"
"github.com/tochemey/goakt/v2/log"
"google.golang.org/protobuf/proto"

"github.com/tochemey/ego/v3/egopb"
"github.com/tochemey/ego/v3/eventstream"
"github.com/tochemey/ego/v3/internal/lib"
"github.com/tochemey/ego/v3/internal/postgres"
"github.com/tochemey/ego/v3/plugins/statestore/memory"
pgstore "github.com/tochemey/ego/v3/plugins/statestore/postgres"
testpb "github.com/tochemey/ego/v3/test/data/pb/v3"
)

Expand Down Expand Up @@ -253,7 +252,7 @@ func TestDurableStateBehavior(t *testing.T) {
testDatabasePassword = "testPass"
)

testContainer := postgres.NewTestContainer(testDatabase, testUser, testDatabasePassword)
testContainer := pgstore.NewTestContainer(testDatabase, testUser, testDatabasePassword)
db := testContainer.GetTestDB()
require.NoError(t, db.Connect(ctx))
schemaUtils := pgstore.NewSchemaUtils(db)
Expand All @@ -267,7 +266,7 @@ func TestDurableStateBehavior(t *testing.T) {
DBPassword: testDatabasePassword,
DBSchema: testContainer.Schema(),
}
durableStore := pgstore.NewStateStore(config)
durableStore := pgstore.NewDurableStore(config)
require.NoError(t, durableStore.Connect(ctx))

lib.Pause(time.Second)
Expand Down
6 changes: 3 additions & 3 deletions engine_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,15 @@ import (
"github.com/travisjeffery/go-dynaport"
"google.golang.org/protobuf/proto"

memstore "github.com/tochemey/ego-contrib/durablestore/memory"
memory "github.com/tochemey/ego-contrib/eventstore/memory"
offsetstore "github.com/tochemey/ego-contrib/offsetstore/memory"
"github.com/tochemey/goakt/v2/log"
mockdisco "github.com/tochemey/goakt/v2/mocks/discovery"

"github.com/tochemey/ego/v3/egopb"
samplepb "github.com/tochemey/ego/v3/example/pbs/sample/pb/v1"
"github.com/tochemey/ego/v3/internal/lib"
offsetstore "github.com/tochemey/ego/v3/offsetstore/memory"
"github.com/tochemey/ego/v3/plugins/eventstore/memory"
memstore "github.com/tochemey/ego/v3/plugins/statestore/memory"
"github.com/tochemey/ego/v3/projection"
testpb "github.com/tochemey/ego/v3/test/data/pb/v3"
)
Expand Down
7 changes: 3 additions & 4 deletions event_sourced_actor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,14 @@ import (
"google.golang.org/protobuf/proto"
"google.golang.org/protobuf/types/known/emptypb"

memory "github.com/tochemey/ego-contrib/eventstore/memory"
pgstore "github.com/tochemey/ego-contrib/eventstore/postgres"
"github.com/tochemey/goakt/v2/actors"
"github.com/tochemey/goakt/v2/log"

"github.com/tochemey/ego/v3/egopb"
"github.com/tochemey/ego/v3/eventstream"
"github.com/tochemey/ego/v3/internal/lib"
"github.com/tochemey/ego/v3/internal/postgres"
"github.com/tochemey/ego/v3/plugins/eventstore/memory"
pgstore "github.com/tochemey/ego/v3/plugins/eventstore/postgres"
testpb "github.com/tochemey/ego/v3/test/data/pb/v3"
)

Expand Down Expand Up @@ -333,7 +332,7 @@ func TestEventSourcedActor(t *testing.T) {
testDatabasePassword = "testPass"
)

testContainer := postgres.NewTestContainer(testDatabase, testUser, testDatabasePassword)
testContainer := pgstore.NewTestContainer(testDatabase, testUser, testDatabasePassword)
db := testContainer.GetTestDB()
// create the event store table
require.NoError(t, db.Connect(ctx))
Expand Down
2 changes: 1 addition & 1 deletion example/durablestate/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@ import (
"time"

"github.com/google/uuid"
memory "github.com/tochemey/ego-contrib/durablestore/memory"
"google.golang.org/protobuf/proto"

"github.com/tochemey/ego/v3"
samplepb "github.com/tochemey/ego/v3/example/pbs/sample/pb/v1"
"github.com/tochemey/ego/v3/plugins/statestore/memory"
)

func main() {
Expand Down
2 changes: 1 addition & 1 deletion example/eventssourced/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@ import (
"time"

"github.com/google/uuid"
memory "github.com/tochemey/ego-contrib/eventstore/memory"
"google.golang.org/protobuf/proto"

"github.com/tochemey/ego/v3"
samplepb "github.com/tochemey/ego/v3/example/pbs/sample/pb/v1"
"github.com/tochemey/ego/v3/plugins/eventstore/memory"
)

func main() {
Expand Down
23 changes: 14 additions & 9 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,14 @@ module github.com/tochemey/ego/v3
go 1.22.0

require (
github.com/Masterminds/squirrel v1.5.4
github.com/deckarep/golang-set/v2 v2.7.0
github.com/flowchartsman/retry v1.2.0
github.com/georgysavva/scany/v2 v2.1.3
github.com/google/uuid v1.6.0
github.com/hashicorp/go-memdb v1.3.4
github.com/jackc/pgx/v5 v5.7.2
github.com/lib/pq v1.10.9
github.com/ory/dockertest/v3 v3.11.0
github.com/stretchr/testify v1.10.0
github.com/tochemey/ego-contrib/durablestore/memory v0.0.0-20241226194523-04ecdcbf3fb3
github.com/tochemey/ego-contrib/durablestore/postgres v0.0.0-20241226194523-04ecdcbf3fb3
github.com/tochemey/ego-contrib/eventstore/memory v0.0.0-20241226194523-04ecdcbf3fb3
github.com/tochemey/ego-contrib/eventstore/postgres v0.0.0-20241226194523-04ecdcbf3fb3
github.com/tochemey/ego-contrib/offsetstore/memory v0.0.0-20241226194523-04ecdcbf3fb3
github.com/tochemey/goakt/v2 v2.11.0
github.com/travisjeffery/go-dynaport v1.0.0
go.uber.org/atomic v1.11.0
Expand All @@ -26,6 +24,7 @@ require (
connectrpc.com/connect v1.17.0 // indirect
dario.cat/mergo v1.0.1 // indirect
github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 // indirect
github.com/Masterminds/squirrel v1.5.4 // indirect
github.com/Microsoft/go-winio v0.6.2 // indirect
github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5 // indirect
github.com/RoaringBitmap/roaring v1.9.4 // indirect
Expand All @@ -38,13 +37,15 @@ require (
github.com/cespare/xxhash/v2 v2.3.0 // indirect
github.com/containerd/continuity v0.4.5 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/deckarep/golang-set/v2 v2.7.0 // indirect
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
github.com/docker/cli v27.4.0+incompatible // indirect
github.com/docker/docker v27.4.0+incompatible // indirect
github.com/docker/cli v27.4.1+incompatible // indirect
github.com/docker/docker v27.4.1+incompatible // indirect
github.com/docker/go-connections v0.5.0 // indirect
github.com/docker/go-units v0.5.0 // indirect
github.com/emicklei/go-restful/v3 v3.12.1 // indirect
github.com/fxamacker/cbor/v2 v2.7.0 // indirect
github.com/georgysavva/scany/v2 v2.1.3 // indirect
github.com/go-logr/logr v1.4.2 // indirect
github.com/go-openapi/jsonpointer v0.21.0 // indirect
github.com/go-openapi/jsonreference v0.21.0 // indirect
Expand All @@ -59,6 +60,7 @@ require (
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect
github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/hashicorp/go-immutable-radix v1.3.1 // indirect
github.com/hashicorp/go-memdb v1.3.4 // indirect
github.com/hashicorp/go-msgpack/v2 v2.1.2 // indirect
github.com/hashicorp/go-multierror v1.1.1 // indirect
github.com/hashicorp/go-sockaddr v1.0.7 // indirect
Expand All @@ -67,12 +69,14 @@ require (
github.com/hashicorp/memberlist v0.5.1 // indirect
github.com/jackc/pgpassfile v1.0.0 // indirect
github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 // indirect
github.com/jackc/pgx/v5 v5.7.2 // indirect
github.com/jackc/puddle/v2 v2.2.2 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/klauspost/cpuid/v2 v2.2.9 // indirect
github.com/lann/builder v0.0.0-20180802200727-47ae307949d0 // indirect
github.com/lann/ps v0.0.0-20150810152359-62de8c46ede0 // indirect
github.com/lib/pq v1.10.9 // indirect
github.com/mailru/easyjson v0.9.0 // indirect
github.com/miekg/dns v1.1.62 // indirect
github.com/moby/docker-image-spec v1.3.1 // indirect
Expand All @@ -85,6 +89,7 @@ require (
github.com/opencontainers/go-digest v1.0.0 // indirect
github.com/opencontainers/image-spec v1.1.0 // indirect
github.com/opencontainers/runc v1.2.3 // indirect
github.com/ory/dockertest/v3 v3.11.0 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/redis/go-redis/v9 v9.7.0 // indirect
Expand Down
28 changes: 24 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,10 @@ github.com/deckarep/golang-set/v2 v2.7.0/go.mod h1:VAky9rY/yGXJOLEDv3OMci+7wtDpO
github.com/dgryski/go-ddmin v0.0.0-20210904190556-96a6d69f1034/go.mod h1:zz4KxBkcXUWKjIcrc+uphJ1gPh/t18ymGm3PmQ+VGTk=
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f h1:lO4WD4F/rVNCu3HqELle0jiPLLBs70cWOduZpkS1E78=
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f/go.mod h1:cuUVRXasLTGF7a8hSLbxyZXjz+1KgoB3wDUb6vlszIc=
github.com/docker/cli v27.4.0+incompatible h1:/nJzWkcI1MDMN+U+px/YXnQWJqnu4J+QKGTfD6ptiTc=
github.com/docker/cli v27.4.0+incompatible/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8=
github.com/docker/docker v27.4.0+incompatible h1:I9z7sQ5qyzO0BfAb9IMOawRkAGxhYsidKiTMcm0DU+A=
github.com/docker/docker v27.4.0+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk=
github.com/docker/cli v27.4.1+incompatible h1:VzPiUlRJ/xh+otB75gva3r05isHMo5wXDfPRi5/b4hI=
github.com/docker/cli v27.4.1+incompatible/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8=
github.com/docker/docker v27.4.1+incompatible h1:ZJvcY7gfwHn1JF48PfbyXg7Jyt9ZCWDW+GGXOIxEwp4=
github.com/docker/docker v27.4.1+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk=
github.com/docker/go-connections v0.5.0 h1:USnMq7hx7gwdVZq1L49hLXaFtUdTADjXGp+uj1Br63c=
github.com/docker/go-connections v0.5.0/go.mod h1:ov60Kzw0kKElRwhNs9UlUHAE/F9Fe6GLaXnqyDdmEXc=
github.com/docker/go-units v0.5.0 h1:69rxXcBk27SvSaaxTtLh/8llcHD8vYHT7WSdRZ/jvr4=
Expand Down Expand Up @@ -340,6 +340,26 @@ github.com/tidwall/redcon v1.6.2 h1:5qfvrrybgtO85jnhSravmkZyC0D+7WstbfCs3MmPhow=
github.com/tidwall/redcon v1.6.2/go.mod h1:p5Wbsgeyi2VSTBWOcA5vRXrOb9arFTcU2+ZzFjqV75Y=
github.com/tinylib/msgp v1.1.5/go.mod h1:eQsjooMTnV42mHu917E26IogZ2930nFyBQdofk10Udg=
github.com/tinylib/msgp v1.1.8/go.mod h1:qkpG+2ldGg4xRFmx+jfTvZPxfGFhi64BcnL9vkCm/Tw=
github.com/tochemey/ego-contrib/durablestore/memory v0.0.0-20241226191059-fe9589656e1d h1:WWJeCPdN3fETVHfEIEbDhDBNbBweV3apUH/QOpRTdGg=
github.com/tochemey/ego-contrib/durablestore/memory v0.0.0-20241226191059-fe9589656e1d/go.mod h1:ZiiSRYjYP66Len2QZtQaq2suPCQAg9zLMymJl0zwPBo=
github.com/tochemey/ego-contrib/durablestore/memory v0.0.0-20241226194523-04ecdcbf3fb3 h1:mXAKyQ37qiQdqHyaID+rEvLNePHR9wNKOAqyhFRmzLM=
github.com/tochemey/ego-contrib/durablestore/memory v0.0.0-20241226194523-04ecdcbf3fb3/go.mod h1:ZiiSRYjYP66Len2QZtQaq2suPCQAg9zLMymJl0zwPBo=
github.com/tochemey/ego-contrib/durablestore/postgres v0.0.0-20241226191059-fe9589656e1d h1:5hN0j9oIi41CTZ7nqVOhcOgAp0AqZU9CJAnwxrHiYrY=
github.com/tochemey/ego-contrib/durablestore/postgres v0.0.0-20241226191059-fe9589656e1d/go.mod h1:jWcNje9EmFMgsgyxbue3FEQdCJFv/cdCHVUAoZUnyb8=
github.com/tochemey/ego-contrib/durablestore/postgres v0.0.0-20241226194523-04ecdcbf3fb3 h1:nbVlFznzFcyciZrIM1eThEHchBWe86DS18NafNkozq8=
github.com/tochemey/ego-contrib/durablestore/postgres v0.0.0-20241226194523-04ecdcbf3fb3/go.mod h1:jWcNje9EmFMgsgyxbue3FEQdCJFv/cdCHVUAoZUnyb8=
github.com/tochemey/ego-contrib/eventstore/memory v0.0.0-20241226191059-fe9589656e1d h1:YdOrvoAzsbUZVznJjqP3VDVwjEsYHlfcmXaxq9nFII0=
github.com/tochemey/ego-contrib/eventstore/memory v0.0.0-20241226191059-fe9589656e1d/go.mod h1:fIPRJ0Vh/hltHDOyqCZXqQBv+u1OAeTM3pDQn2Tg5cw=
github.com/tochemey/ego-contrib/eventstore/memory v0.0.0-20241226194523-04ecdcbf3fb3 h1:Zh5ndookRvlRFCS5pjEMw5sjcl2bboRlkQA1Wg+dW+k=
github.com/tochemey/ego-contrib/eventstore/memory v0.0.0-20241226194523-04ecdcbf3fb3/go.mod h1:fIPRJ0Vh/hltHDOyqCZXqQBv+u1OAeTM3pDQn2Tg5cw=
github.com/tochemey/ego-contrib/eventstore/postgres v0.0.0-20241226191059-fe9589656e1d h1:rCcusqecSQt2z8jaGcqu+WnTKL5JCZv8Ti7y/tUAIdc=
github.com/tochemey/ego-contrib/eventstore/postgres v0.0.0-20241226191059-fe9589656e1d/go.mod h1:amP9+eDvwyodN5ZAkeQnek+9PM28n4JxXiaxv2ghnZI=
github.com/tochemey/ego-contrib/eventstore/postgres v0.0.0-20241226194523-04ecdcbf3fb3 h1:blYCCLs8TH812sNyyaHEI1CQpSTk2ubPwOzLlZFzPqs=
github.com/tochemey/ego-contrib/eventstore/postgres v0.0.0-20241226194523-04ecdcbf3fb3/go.mod h1:amP9+eDvwyodN5ZAkeQnek+9PM28n4JxXiaxv2ghnZI=
github.com/tochemey/ego-contrib/offsetstore/memory v0.0.0-20241226191059-fe9589656e1d h1:hd3VCJstrA2N1Mp2j32oUrJhQVoZhjr8pgh7koqv+8U=
github.com/tochemey/ego-contrib/offsetstore/memory v0.0.0-20241226191059-fe9589656e1d/go.mod h1:POUIFQ21A1RJW8HKkntl1cnhPHwZIwRXZn+ArjZM/Kw=
github.com/tochemey/ego-contrib/offsetstore/memory v0.0.0-20241226194523-04ecdcbf3fb3 h1:oljKEGjJsqM1EPVpZ0jM0SajeItf3+J28YgVUXK22ks=
github.com/tochemey/ego-contrib/offsetstore/memory v0.0.0-20241226194523-04ecdcbf3fb3/go.mod h1:POUIFQ21A1RJW8HKkntl1cnhPHwZIwRXZn+ArjZM/Kw=
github.com/tochemey/goakt/v2 v2.11.0 h1:4reuqeN8mvsUWu9ecn3Vd+qtpTASj/kEI9W3FRYHofM=
github.com/tochemey/goakt/v2 v2.11.0/go.mod h1:gMba2xHDzLSDojw5m1SPHDzVFgNWn1I6G9zoagym5e0=
github.com/travisjeffery/go-dynaport v1.0.0 h1:m/qqf5AHgB96CMMSworIPyo1i7NZueRsnwdzdCJ8Ajw=
Expand Down
60 changes: 0 additions & 60 deletions internal/postgres/config.go

This file was deleted.

Loading

0 comments on commit 55ce85e

Please sign in to comment.