You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@seata.apache.org by "ptyin (via GitHub)" <gi...@apache.org> on 2024/01/19 04:26:20 UTC

[PR] feature: add saga persistence layer [incubator-seata-go]

ptyin opened a new pull request, #649:
URL: https://github.com/apache/incubator-seata-go/pull/649

   <!--  Thanks for sending a pull request! 
   -->
   
   **What this PR does**:
   This PR involves the storage aspect of the state machine. The primary focus will be on creating SQL templates, with reference to the seata-engine-store module.
   
   **Which issue(s) this PR fixes**:
   <!--
   *Automatically closes linked issue when PR is merged.
   Usage: `Fixes #<issue number>`, or `Fixes (paste link of issue)`.
   _If PR is about `failing-tests or flakes`, please post the related issues/tests in a comment and do not use `Fixes`_*
   -->
   Fixes #638
   
   **Special notes for your reviewer**:
   UTs are under the same directory as sources


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@seata.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@seata.apache.org
For additional commands, e-mail: dev-help@seata.apache.org


Re: [PR] feature: add saga persistence layer [incubator-seata-go]

Posted by "ptyin (via GitHub)" <gi...@apache.org>.
ptyin commented on code in PR #649:
URL: https://github.com/apache/incubator-seata-go/pull/649#discussion_r1470650922


##########
pkg/saga/statemachine/engine/serializer/serializer.go:
##########
@@ -0,0 +1,47 @@
+package serializer
+
+import (
+	"bytes"
+	"encoding/gob"
+	"encoding/json"
+	"github.com/pkg/errors"
+)
+
+type Serializer[S any, T any] interface {

Review Comment:
   I got it. There is no need to use generics. Fix it later.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@seata.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@seata.apache.org
For additional commands, e-mail: dev-help@seata.apache.org


Re: [PR] feature: add saga persistence layer [incubator-seata-go]

Posted by "xjlgod (via GitHub)" <gi...@apache.org>.
xjlgod commented on code in PR #649:
URL: https://github.com/apache/incubator-seata-go/pull/649#discussion_r1469767529


##########
pkg/saga/statemachine/engine/serializer/serializer.go:
##########
@@ -0,0 +1,47 @@
+package serializer
+
+import (
+	"bytes"
+	"encoding/gob"
+	"encoding/json"
+	"github.com/pkg/errors"
+)
+
+type Serializer[S any, T any] interface {

Review Comment:
   Is this using generics? It's generally better not to use generics for now? @wt-better 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@seata.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@seata.apache.org
For additional commands, e-mail: dev-help@seata.apache.org


Re: [PR] feature: add saga persistence layer [incubator-seata-go]

Posted by "xjlgod (via GitHub)" <gi...@apache.org>.
xjlgod commented on code in PR #649:
URL: https://github.com/apache/incubator-seata-go/pull/649#discussion_r1471412246


##########
pkg/saga/statemachine/engine/store/db/db.go:
##########
@@ -0,0 +1,102 @@
+package db
+
+import (
+	"database/sql"
+	"github.com/pkg/errors"
+	"github.com/seata/seata-go/pkg/util/log"
+)
+
+const TimeLayout = "2006-01-02 15:04:05.999999999-07:00"
+
+type ExecStatement[T any] func(obj T, stmt *sql.Stmt) (int64, error)
+
+type ScanRows[T any] func(rows *sql.Rows) (T, error)
+
+type Store struct {
+	db *sql.DB
+}
+
+func SelectOne[T any](db *sql.DB, sql string, fn ScanRows[T], args ...any) (T, error) {

Review Comment:
   Generics are also used here, need to remove them?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@seata.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@seata.apache.org
For additional commands, e-mail: dev-help@seata.apache.org


Re: [PR] feature: add saga persistence layer [incubator-seata-go]

Posted by "wt-better (via GitHub)" <gi...@apache.org>.
wt-better merged PR #649:
URL: https://github.com/apache/incubator-seata-go/pull/649


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@seata.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@seata.apache.org
For additional commands, e-mail: dev-help@seata.apache.org


Re: [PR] feature: add saga persistence layer [incubator-seata-go]

Posted by "ptyin (via GitHub)" <gi...@apache.org>.
ptyin commented on code in PR #649:
URL: https://github.com/apache/incubator-seata-go/pull/649#discussion_r1470646111


##########
pkg/saga/statemachine/engine/serializer/serializer.go:
##########
@@ -0,0 +1,47 @@
+package serializer
+
+import (
+	"bytes"
+	"encoding/gob"
+	"encoding/json"
+	"github.com/pkg/errors"
+)
+
+type Serializer[S any, T any] interface {

Review Comment:
   Yes, `Serializer` is a generic interface. This interface refers to the Java implementation (using generics as well). Is any specific reason that we should not use generics?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@seata.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@seata.apache.org
For additional commands, e-mail: dev-help@seata.apache.org