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

coordinatorclient: AclEventLog method

This commit is contained in:
Anthony Akentiev 2024-08-13 13:35:31 +02:00
parent 48b0bd91b0
commit e2c893b549
No known key found for this signature in database
GPG key ID: 017A11DC01A79831
2 changed files with 22 additions and 0 deletions

View file

@ -424,6 +424,10 @@ func (m mockCoordinatorClient) AclGetRecords(ctx context.Context, spaceId, aclHe
return
}
func (m mockCoordinatorClient) AclEventLog(ctx context.Context, accountId, lastRecordId string, limit int) (records []*coordinatorproto.AclEventLogRecord, err error) {
return
}
func (m mockCoordinatorClient) Init(a *app.App) (err error) {
return
}

View file

@ -50,6 +50,8 @@ type CoordinatorClient interface {
AccountLimitsSet(ctx context.Context, req *coordinatorproto.AccountLimitsSetRequest) error
AclEventLog(ctx context.Context, accountId, lastRecordId string, limit int) (records []*coordinatorproto.AclEventLogRecord, err error)
app.Component
}
@ -332,6 +334,22 @@ func (c *coordinatorClient) SpaceMakeUnshareable(ctx context.Context, spaceId, a
})
}
func (c *coordinatorClient) AclEventLog(ctx context.Context, accountId, lastRecordId string, limit int) (records []*coordinatorproto.AclEventLogRecord, err error) {
err = c.doClient(ctx, func(cl coordinatorproto.DRPCCoordinatorClient) error {
resp, err := cl.AclEventLog(ctx, &coordinatorproto.AclEventLogRequest{
AccountIdentity: accountId,
AfterId: lastRecordId,
Limit: uint32(limit),
})
if err != nil {
return rpcerr.Unwrap(err)
}
records = resp.Records
return nil
})
return
}
func (c *coordinatorClient) doClient(ctx context.Context, f func(cl coordinatorproto.DRPCCoordinatorClient) error) error {
p, err := c.getPeer(ctx)
if err != nil {