1
0
Fork 0
mirror of https://github.com/anyproto/any-sync.git synced 2025-06-08 05:57:03 +09:00

WIP: acl service

This commit is contained in:
Sergey Cherepanov 2022-10-20 14:04:26 +03:00 committed by Mikhail Iudin
parent 921e4410b8
commit add04d3e88
No known key found for this signature in database
GPG key ID: FAAAA8BAABDFF1C0
2 changed files with 39 additions and 0 deletions

1
node/acl/acl.go Normal file
View file

@ -0,0 +1 @@
package acl

38
node/acl/service.go Normal file
View 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()
}