mirror of
https://github.com/anyproto/any-sync.git
synced 2025-06-08 14:07:02 +09:00
WIP: acl service
This commit is contained in:
parent
921e4410b8
commit
add04d3e88
2 changed files with 39 additions and 0 deletions
1
node/acl/acl.go
Normal file
1
node/acl/acl.go
Normal file
|
@ -0,0 +1 @@
|
|||
package acl
|
38
node/acl/service.go
Normal file
38
node/acl/service.go
Normal file
|
@ -0,0 +1,38 @@
|
|||
package acl
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/app"
|
||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/consensus/consensusclient"
|
||||
)
|
||||
|
||||
const CName = "node.acl"
|
||||
|
||||
type Service interface {
|
||||
app.ComponentRunnable
|
||||
}
|
||||
|
||||
type aclService struct {
|
||||
cons consensusclient.Service
|
||||
stream consensusclient.Stream
|
||||
}
|
||||
|
||||
func (as *aclService) Init(a *app.App) (err error) {
|
||||
as.cons = a.MustComponent(consensusclient.CName).(consensusclient.Service)
|
||||
return nil
|
||||
}
|
||||
|
||||
func (as *aclService) Name() (name string) {
|
||||
return CName
|
||||
}
|
||||
|
||||
func (as *aclService) Run(ctx context.Context) (err error) {
|
||||
if as.stream, err = as.cons.WatchLog(ctx); err != nil {
|
||||
return
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (as *aclService) Close(ctx context.Context) (err error) {
|
||||
return as.stream.Close()
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue