From 15bf4c7018b1162b9dcbc48a73d4881e7eed5fe3 Mon Sep 17 00:00:00 2001 From: Sergey Cherepanov Date: Thu, 20 Oct 2022 14:04:26 +0300 Subject: [PATCH] WIP: acl service --- node/acl/acl.go | 1 + node/acl/service.go | 38 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 node/acl/acl.go create mode 100644 node/acl/service.go diff --git a/node/acl/acl.go b/node/acl/acl.go new file mode 100644 index 00000000..e564307a --- /dev/null +++ b/node/acl/acl.go @@ -0,0 +1 @@ +package acl diff --git a/node/acl/service.go b/node/acl/service.go new file mode 100644 index 00000000..9c080c48 --- /dev/null +++ b/node/acl/service.go @@ -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() +}