mirror of
https://github.com/anyproto/any-sync.git
synced 2025-06-09 17:45:03 +09:00
coordinator api: acl proto
This commit is contained in:
parent
c5fa209c1d
commit
83961acdcf
4 changed files with 1057 additions and 93 deletions
|
@ -27,8 +27,10 @@ service SpaceSync {
|
|||
// ObjectSync sends object sync message and synchronously gets response message
|
||||
rpc ObjectSync(ObjectSyncMessage) returns (ObjectSyncMessage);
|
||||
// AclAddRecord adds a new record to acl log. Works only with any-sync-node
|
||||
// deprecated: use coordinator api
|
||||
rpc AclAddRecord(AclAddRecordRequest) returns (AclAddRecordResponse);
|
||||
// AclGetRecords gets acl records
|
||||
// deprecated: use coordinator api
|
||||
rpc AclGetRecords(AclGetRecordsRequest) returns (AclGetRecordsResponse);
|
||||
}
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -50,6 +50,8 @@ type DRPCCoordinatorClient interface {
|
|||
SpaceDelete(ctx context.Context, in *SpaceDeleteRequest) (*SpaceDeleteResponse, error)
|
||||
AccountDelete(ctx context.Context, in *AccountDeleteRequest) (*AccountDeleteResponse, error)
|
||||
AccountRevertDeletion(ctx context.Context, in *AccountRevertDeletionRequest) (*AccountRevertDeletionResponse, error)
|
||||
AclAddRecord(ctx context.Context, in *AclAddRecordRequest) (*AclAddRecordResponse, error)
|
||||
AclGetRecords(ctx context.Context, in *AclGetRecordsRequest) (*AclGetRecordsResponse, error)
|
||||
}
|
||||
|
||||
type drpcCoordinatorClient struct {
|
||||
|
@ -152,6 +154,24 @@ func (c *drpcCoordinatorClient) AccountRevertDeletion(ctx context.Context, in *A
|
|||
return out, nil
|
||||
}
|
||||
|
||||
func (c *drpcCoordinatorClient) AclAddRecord(ctx context.Context, in *AclAddRecordRequest) (*AclAddRecordResponse, error) {
|
||||
out := new(AclAddRecordResponse)
|
||||
err := c.cc.Invoke(ctx, "/coordinator.Coordinator/AclAddRecord", drpcEncoding_File_coordinator_coordinatorproto_protos_coordinator_proto{}, in, out)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *drpcCoordinatorClient) AclGetRecords(ctx context.Context, in *AclGetRecordsRequest) (*AclGetRecordsResponse, error) {
|
||||
out := new(AclGetRecordsResponse)
|
||||
err := c.cc.Invoke(ctx, "/coordinator.Coordinator/AclGetRecords", drpcEncoding_File_coordinator_coordinatorproto_protos_coordinator_proto{}, in, out)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
type DRPCCoordinatorServer interface {
|
||||
SpaceSign(context.Context, *SpaceSignRequest) (*SpaceSignResponse, error)
|
||||
FileLimitCheck(context.Context, *FileLimitCheckRequest) (*FileLimitCheckResponse, error)
|
||||
|
@ -163,6 +183,8 @@ type DRPCCoordinatorServer interface {
|
|||
SpaceDelete(context.Context, *SpaceDeleteRequest) (*SpaceDeleteResponse, error)
|
||||
AccountDelete(context.Context, *AccountDeleteRequest) (*AccountDeleteResponse, error)
|
||||
AccountRevertDeletion(context.Context, *AccountRevertDeletionRequest) (*AccountRevertDeletionResponse, error)
|
||||
AclAddRecord(context.Context, *AclAddRecordRequest) (*AclAddRecordResponse, error)
|
||||
AclGetRecords(context.Context, *AclGetRecordsRequest) (*AclGetRecordsResponse, error)
|
||||
}
|
||||
|
||||
type DRPCCoordinatorUnimplementedServer struct{}
|
||||
|
@ -207,9 +229,17 @@ func (s *DRPCCoordinatorUnimplementedServer) AccountRevertDeletion(context.Conte
|
|||
return nil, drpcerr.WithCode(errors.New("Unimplemented"), drpcerr.Unimplemented)
|
||||
}
|
||||
|
||||
func (s *DRPCCoordinatorUnimplementedServer) AclAddRecord(context.Context, *AclAddRecordRequest) (*AclAddRecordResponse, error) {
|
||||
return nil, drpcerr.WithCode(errors.New("Unimplemented"), drpcerr.Unimplemented)
|
||||
}
|
||||
|
||||
func (s *DRPCCoordinatorUnimplementedServer) AclGetRecords(context.Context, *AclGetRecordsRequest) (*AclGetRecordsResponse, error) {
|
||||
return nil, drpcerr.WithCode(errors.New("Unimplemented"), drpcerr.Unimplemented)
|
||||
}
|
||||
|
||||
type DRPCCoordinatorDescription struct{}
|
||||
|
||||
func (DRPCCoordinatorDescription) NumMethods() int { return 10 }
|
||||
func (DRPCCoordinatorDescription) NumMethods() int { return 12 }
|
||||
|
||||
func (DRPCCoordinatorDescription) Method(n int) (string, drpc.Encoding, drpc.Receiver, interface{}, bool) {
|
||||
switch n {
|
||||
|
@ -303,6 +333,24 @@ func (DRPCCoordinatorDescription) Method(n int) (string, drpc.Encoding, drpc.Rec
|
|||
in1.(*AccountRevertDeletionRequest),
|
||||
)
|
||||
}, DRPCCoordinatorServer.AccountRevertDeletion, true
|
||||
case 10:
|
||||
return "/coordinator.Coordinator/AclAddRecord", drpcEncoding_File_coordinator_coordinatorproto_protos_coordinator_proto{},
|
||||
func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) {
|
||||
return srv.(DRPCCoordinatorServer).
|
||||
AclAddRecord(
|
||||
ctx,
|
||||
in1.(*AclAddRecordRequest),
|
||||
)
|
||||
}, DRPCCoordinatorServer.AclAddRecord, true
|
||||
case 11:
|
||||
return "/coordinator.Coordinator/AclGetRecords", drpcEncoding_File_coordinator_coordinatorproto_protos_coordinator_proto{},
|
||||
func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) {
|
||||
return srv.(DRPCCoordinatorServer).
|
||||
AclGetRecords(
|
||||
ctx,
|
||||
in1.(*AclGetRecordsRequest),
|
||||
)
|
||||
}, DRPCCoordinatorServer.AclGetRecords, true
|
||||
default:
|
||||
return "", nil, nil, nil, false
|
||||
}
|
||||
|
@ -471,3 +519,35 @@ func (x *drpcCoordinator_AccountRevertDeletionStream) SendAndClose(m *AccountRev
|
|||
}
|
||||
return x.CloseSend()
|
||||
}
|
||||
|
||||
type DRPCCoordinator_AclAddRecordStream interface {
|
||||
drpc.Stream
|
||||
SendAndClose(*AclAddRecordResponse) error
|
||||
}
|
||||
|
||||
type drpcCoordinator_AclAddRecordStream struct {
|
||||
drpc.Stream
|
||||
}
|
||||
|
||||
func (x *drpcCoordinator_AclAddRecordStream) SendAndClose(m *AclAddRecordResponse) error {
|
||||
if err := x.MsgSend(m, drpcEncoding_File_coordinator_coordinatorproto_protos_coordinator_proto{}); err != nil {
|
||||
return err
|
||||
}
|
||||
return x.CloseSend()
|
||||
}
|
||||
|
||||
type DRPCCoordinator_AclGetRecordsStream interface {
|
||||
drpc.Stream
|
||||
SendAndClose(*AclGetRecordsResponse) error
|
||||
}
|
||||
|
||||
type drpcCoordinator_AclGetRecordsStream struct {
|
||||
drpc.Stream
|
||||
}
|
||||
|
||||
func (x *drpcCoordinator_AclGetRecordsStream) SendAndClose(m *AclGetRecordsResponse) error {
|
||||
if err := x.MsgSend(m, drpcEncoding_File_coordinator_coordinatorproto_protos_coordinator_proto{}); err != nil {
|
||||
return err
|
||||
}
|
||||
return x.CloseSend()
|
||||
}
|
||||
|
|
|
@ -36,6 +36,11 @@ service Coordinator {
|
|||
|
||||
// AccountRevertDeletion reverts an account deletion
|
||||
rpc AccountRevertDeletion(AccountRevertDeletionRequest) returns (AccountRevertDeletionResponse);
|
||||
|
||||
// AclAddRecord adds a new record to acl log. Works only with any-sync-node
|
||||
rpc AclAddRecord(AclAddRecordRequest) returns (AclAddRecordResponse);
|
||||
// AclGetRecords gets acl records
|
||||
rpc AclGetRecords(AclGetRecordsRequest) returns (AclGetRecordsResponse);
|
||||
}
|
||||
|
||||
message SpaceSignRequest {
|
||||
|
@ -300,3 +305,27 @@ message AccountRevertDeletionRequest {
|
|||
// AccountRevertDeletionResponse is an empty response confirming that the deletion is reverted
|
||||
message AccountRevertDeletionResponse {
|
||||
}
|
||||
|
||||
// AclAddRecordRequest contains marshaled consensusproto.RawRecord
|
||||
message AclAddRecordRequest {
|
||||
string spaceId = 1;
|
||||
bytes payload = 2;
|
||||
}
|
||||
|
||||
// AclAddRecordResponse contains created record id and marshaled consensusproto.RawRecord
|
||||
message AclAddRecordResponse {
|
||||
string recordId = 1;
|
||||
bytes payload = 2;
|
||||
}
|
||||
|
||||
// AclGetRecordsRequest can optionally contain the last known aclHead, the server will return only new records or an empty list if there are no new records.
|
||||
// If aclHead is not provided the whole list will be returned.
|
||||
message AclGetRecordsRequest {
|
||||
string spaceId = 1;
|
||||
string aclHead = 2;
|
||||
}
|
||||
|
||||
// AclGetRecordsResponse contains list of marshaled consensusproto.RawRecordWithId
|
||||
message AclGetRecordsResponse {
|
||||
repeated bytes records = 1;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue