Skip to content

Commit 342b9b3

Browse files
Updated transprocessor for using shared types
1 parent f0ee415 commit 342b9b3

File tree

1 file changed

+23
-21
lines changed

1 file changed

+23
-21
lines changed

internal/transprocessor/perm-processor.go

Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,20 @@ import (
44
"context"
55
"fmt"
66

7-
"github.com/PythonHacker24/linux-acl-management-backend/internal/session"
87
"go.uber.org/zap"
8+
9+
"github.com/PythonHacker24/linux-acl-management-backend/internal/session"
10+
"github.com/PythonHacker24/linux-acl-management-backend/internal/types"
911
)
1012

1113
/* instanciate new permission processor */
1214
func NewPermProcessor() *PermProcessor {
13-
return &PermProcessor{}
15+
return &PermProcessor{}
1416
}
1517

1618
/* processor for permissions manager */
1719
func (p *PermProcessor) Process(ctx context.Context, curSession *session.Session, tx interface{}) error {
18-
transaction, ok := tx.(*Transaction)
20+
transaction, ok := tx.(*types.Transaction)
1921
if !ok {
2022
return fmt.Errorf("invalid transaction type")
2123
}
@@ -24,25 +26,25 @@ func (p *PermProcessor) Process(ctx context.Context, curSession *session.Session
2426
zap.L().Info("Processing Transaction",
2527
zap.String("user", curSession.Username),
2628
)
27-
29+
2830
select {
29-
case <-ctx.Done():
30-
/*
31-
store this into persistent storage too!
32-
make sure database connections are closed after scheduler shutsdown
33-
*/
34-
zap.L().Warn("Transaction process stopped due to shutdown",
35-
zap.String("user", curSession.Username),
36-
)
37-
return ctx.Err()
38-
default:
39-
/*
40-
permprocessor hands over transactions to remoteprocessor/localprocessor depending upon request
41-
remoteprocessor -> handles permissions on remote servers
42-
localprocessor -> handles permissions on local system (where this backend is deployed)
43-
*/
44-
_ = transaction
31+
case <-ctx.Done():
32+
/*
33+
store this into persistent storage too!
34+
make sure database connections are closed after scheduler shutsdown
35+
*/
36+
zap.L().Warn("Transaction process stopped due to shutdown",
37+
zap.String("user", curSession.Username),
38+
)
39+
return ctx.Err()
40+
default:
41+
/*
42+
permprocessor hands over transactions to remoteprocessor/localprocessor depending upon request
43+
remoteprocessor -> handles permissions on remote servers
44+
localprocessor -> handles permissions on local system (where this backend is deployed)
45+
*/
46+
_ = transaction
4547
}
4648

47-
return nil
49+
return nil
4850
}

0 commit comments

Comments
 (0)