Skip to content

Commit

Permalink
feat: add durable state actor
Browse files Browse the repository at this point in the history
  • Loading branch information
Tochemey committed Dec 16, 2024
1 parent 64ca993 commit ed4da0f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions plugins/statestore/memory/memory.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ func NewStateStore() *StateStore {
}

// Connect connects the durable store
// nolint
func (d *StateStore) Connect(ctx context.Context) error {
if d.connected.Load() {
return nil
Expand All @@ -64,6 +65,7 @@ func (d *StateStore) Connect(ctx context.Context) error {
}

// Disconnect disconnect the durable store
// nolint
func (d *StateStore) Disconnect(ctx context.Context) error {
if !d.connected.Load() {
return nil
Expand All @@ -85,6 +87,7 @@ func (d *StateStore) Ping(ctx context.Context) error {
}

// WriteState persist durable state for a given persistenceID.
// nolint
func (d *StateStore) WriteState(ctx context.Context, state *egopb.DurableState) error {
if !d.connected.Load() {
return errors.New("durable store is not connected")
Expand All @@ -94,6 +97,7 @@ func (d *StateStore) WriteState(ctx context.Context, state *egopb.DurableState)
}

// GetLatestState fetches the latest durable state
// nolint
func (d *StateStore) GetLatestState(ctx context.Context, persistenceID string) (*egopb.DurableState, error) {
if !d.connected.Load() {
return nil, errors.New("durable store is not connected")
Expand Down
2 changes: 1 addition & 1 deletion projection/runner_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ import (

"github.com/tochemey/ego/v3/egopb"
"github.com/tochemey/ego/v3/internal/lib"
mockseventstore "github.com/tochemey/ego/v3/mocks/eventstore"
mocksoffsetstore "github.com/tochemey/ego/v3/mocks/offsetstore"
mockseventstore "github.com/tochemey/ego/v3/mocks/persistence"
memoffsetstore "github.com/tochemey/ego/v3/offsetstore/memory"
"github.com/tochemey/ego/v3/plugins/eventstore/memory"
testpb "github.com/tochemey/ego/v3/test/data/pb/v3"
Expand Down

0 comments on commit ed4da0f

Please sign in to comment.