mirror of
https://github.com/anyproto/any-sync.git
synced 2025-06-08 05:57:03 +09:00
New coordinator API - AclEventLog
This commit is contained in:
parent
ed1bcb0027
commit
af0f2836f7
3 changed files with 1067 additions and 122 deletions
File diff suppressed because it is too large
Load diff
|
@ -54,6 +54,7 @@ type DRPCCoordinatorClient interface {
|
||||||
AclAddRecord(ctx context.Context, in *AclAddRecordRequest) (*AclAddRecordResponse, error)
|
AclAddRecord(ctx context.Context, in *AclAddRecordRequest) (*AclAddRecordResponse, error)
|
||||||
AclGetRecords(ctx context.Context, in *AclGetRecordsRequest) (*AclGetRecordsResponse, error)
|
AclGetRecords(ctx context.Context, in *AclGetRecordsRequest) (*AclGetRecordsResponse, error)
|
||||||
AccountLimitsSet(ctx context.Context, in *AccountLimitsSetRequest) (*AccountLimitsSetResponse, error)
|
AccountLimitsSet(ctx context.Context, in *AccountLimitsSetRequest) (*AccountLimitsSetResponse, error)
|
||||||
|
AclEventLog(ctx context.Context, in *AclEventLogRequest) (*AclEventLogResponse, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
type drpcCoordinatorClient struct {
|
type drpcCoordinatorClient struct {
|
||||||
|
@ -192,6 +193,15 @@ func (c *drpcCoordinatorClient) AccountLimitsSet(ctx context.Context, in *Accoun
|
||||||
return out, nil
|
return out, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *drpcCoordinatorClient) AclEventLog(ctx context.Context, in *AclEventLogRequest) (*AclEventLogResponse, error) {
|
||||||
|
out := new(AclEventLogResponse)
|
||||||
|
err := c.cc.Invoke(ctx, "/coordinator.Coordinator/AclEventLog", drpcEncoding_File_coordinator_coordinatorproto_protos_coordinator_proto{}, in, out)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return out, nil
|
||||||
|
}
|
||||||
|
|
||||||
type DRPCCoordinatorServer interface {
|
type DRPCCoordinatorServer interface {
|
||||||
SpaceSign(context.Context, *SpaceSignRequest) (*SpaceSignResponse, error)
|
SpaceSign(context.Context, *SpaceSignRequest) (*SpaceSignResponse, error)
|
||||||
SpaceStatusCheck(context.Context, *SpaceStatusCheckRequest) (*SpaceStatusCheckResponse, error)
|
SpaceStatusCheck(context.Context, *SpaceStatusCheckRequest) (*SpaceStatusCheckResponse, error)
|
||||||
|
@ -207,6 +217,7 @@ type DRPCCoordinatorServer interface {
|
||||||
AclAddRecord(context.Context, *AclAddRecordRequest) (*AclAddRecordResponse, error)
|
AclAddRecord(context.Context, *AclAddRecordRequest) (*AclAddRecordResponse, error)
|
||||||
AclGetRecords(context.Context, *AclGetRecordsRequest) (*AclGetRecordsResponse, error)
|
AclGetRecords(context.Context, *AclGetRecordsRequest) (*AclGetRecordsResponse, error)
|
||||||
AccountLimitsSet(context.Context, *AccountLimitsSetRequest) (*AccountLimitsSetResponse, error)
|
AccountLimitsSet(context.Context, *AccountLimitsSetRequest) (*AccountLimitsSetResponse, error)
|
||||||
|
AclEventLog(context.Context, *AclEventLogRequest) (*AclEventLogResponse, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
type DRPCCoordinatorUnimplementedServer struct{}
|
type DRPCCoordinatorUnimplementedServer struct{}
|
||||||
|
@ -267,9 +278,13 @@ func (s *DRPCCoordinatorUnimplementedServer) AccountLimitsSet(context.Context, *
|
||||||
return nil, drpcerr.WithCode(errors.New("Unimplemented"), drpcerr.Unimplemented)
|
return nil, drpcerr.WithCode(errors.New("Unimplemented"), drpcerr.Unimplemented)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (s *DRPCCoordinatorUnimplementedServer) AclEventLog(context.Context, *AclEventLogRequest) (*AclEventLogResponse, error) {
|
||||||
|
return nil, drpcerr.WithCode(errors.New("Unimplemented"), drpcerr.Unimplemented)
|
||||||
|
}
|
||||||
|
|
||||||
type DRPCCoordinatorDescription struct{}
|
type DRPCCoordinatorDescription struct{}
|
||||||
|
|
||||||
func (DRPCCoordinatorDescription) NumMethods() int { return 14 }
|
func (DRPCCoordinatorDescription) NumMethods() int { return 15 }
|
||||||
|
|
||||||
func (DRPCCoordinatorDescription) Method(n int) (string, drpc.Encoding, drpc.Receiver, interface{}, bool) {
|
func (DRPCCoordinatorDescription) Method(n int) (string, drpc.Encoding, drpc.Receiver, interface{}, bool) {
|
||||||
switch n {
|
switch n {
|
||||||
|
@ -399,6 +414,15 @@ func (DRPCCoordinatorDescription) Method(n int) (string, drpc.Encoding, drpc.Rec
|
||||||
in1.(*AccountLimitsSetRequest),
|
in1.(*AccountLimitsSetRequest),
|
||||||
)
|
)
|
||||||
}, DRPCCoordinatorServer.AccountLimitsSet, true
|
}, DRPCCoordinatorServer.AccountLimitsSet, true
|
||||||
|
case 14:
|
||||||
|
return "/coordinator.Coordinator/AclEventLog", drpcEncoding_File_coordinator_coordinatorproto_protos_coordinator_proto{},
|
||||||
|
func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) {
|
||||||
|
return srv.(DRPCCoordinatorServer).
|
||||||
|
AclEventLog(
|
||||||
|
ctx,
|
||||||
|
in1.(*AclEventLogRequest),
|
||||||
|
)
|
||||||
|
}, DRPCCoordinatorServer.AclEventLog, true
|
||||||
default:
|
default:
|
||||||
return "", nil, nil, nil, false
|
return "", nil, nil, nil, false
|
||||||
}
|
}
|
||||||
|
@ -631,3 +655,19 @@ func (x *drpcCoordinator_AccountLimitsSetStream) SendAndClose(m *AccountLimitsSe
|
||||||
}
|
}
|
||||||
return x.CloseSend()
|
return x.CloseSend()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type DRPCCoordinator_AclEventLogStream interface {
|
||||||
|
drpc.Stream
|
||||||
|
SendAndClose(*AclEventLogResponse) error
|
||||||
|
}
|
||||||
|
|
||||||
|
type drpcCoordinator_AclEventLogStream struct {
|
||||||
|
drpc.Stream
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *drpcCoordinator_AclEventLogStream) SendAndClose(m *AclEventLogResponse) error {
|
||||||
|
if err := x.MsgSend(m, drpcEncoding_File_coordinator_coordinatorproto_protos_coordinator_proto{}); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return x.CloseSend()
|
||||||
|
}
|
||||||
|
|
|
@ -43,6 +43,8 @@ service Coordinator {
|
||||||
rpc AclGetRecords(AclGetRecordsRequest) returns (AclGetRecordsResponse);
|
rpc AclGetRecords(AclGetRecordsRequest) returns (AclGetRecordsResponse);
|
||||||
// AccountLimitsSet sets limits to the account. Can be used only by a network config member
|
// AccountLimitsSet sets limits to the account. Can be used only by a network config member
|
||||||
rpc AccountLimitsSet(AccountLimitsSetRequest) returns (AccountLimitsSetResponse);
|
rpc AccountLimitsSet(AccountLimitsSetRequest) returns (AccountLimitsSetResponse);
|
||||||
|
// EventLog gets the latest event log records
|
||||||
|
rpc AclEventLog(AclEventLogRequest) returns (AclEventLogResponse);
|
||||||
}
|
}
|
||||||
|
|
||||||
message SpaceSignRequest {
|
message SpaceSignRequest {
|
||||||
|
@ -364,5 +366,39 @@ message AccountLimitsSetRequest {
|
||||||
uint32 sharedSpacesLimit = 6;
|
uint32 sharedSpacesLimit = 6;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
message AccountLimitsSetResponse {}
|
message AccountLimitsSetResponse {}
|
||||||
|
|
||||||
|
message AclEventLogRequest {
|
||||||
|
string accountIdentity = 1;
|
||||||
|
// AfterId is the last known logId to request records after this id. If it is empty will be returned a list from the beginning.
|
||||||
|
string afterId = 2;
|
||||||
|
// Limit is a desired record count in response
|
||||||
|
uint32 limit = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
message AclEventLogResponse {
|
||||||
|
// AclEventLogRecord list of records, if there are no new records will be empty
|
||||||
|
repeated AclEventLogRecord records = 1;
|
||||||
|
// HasMore indicates if there are records left
|
||||||
|
bool hasMore = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
enum AclEventLogRecordType {
|
||||||
|
RecordTypeSpaceReceipt = 0;
|
||||||
|
RecordTypeSpaceShared = 1;
|
||||||
|
RecordTypeSpaceUnshared = 2;
|
||||||
|
RecordTypeSpaceAclAddRecord = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
message AclEventLogRecord {
|
||||||
|
// Id is a record id
|
||||||
|
string id = 1;
|
||||||
|
// SpaceId is a space identifier
|
||||||
|
string spaceId = 2;
|
||||||
|
// Timestamp is a unixtimestamp of record creation
|
||||||
|
int64 timestamp = 3;
|
||||||
|
// Type of current event
|
||||||
|
AclEventLogRecordType type = 4;
|
||||||
|
// only for "RecordTypeSpaceAclAddRecord" type of records
|
||||||
|
string aclChangeId = 5;
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue