mirror of
https://github.com/anyproto/any-sync.git
synced 2025-06-09 17:45:03 +09:00
Change proto methods to enable account deletion and duration for space changes
This commit is contained in:
parent
1922278165
commit
14f5ab90a0
3 changed files with 1173 additions and 82 deletions
File diff suppressed because it is too large
Load diff
|
@ -47,6 +47,8 @@ type DRPCCoordinatorClient interface {
|
|||
SpaceStatusChange(ctx context.Context, in *SpaceStatusChangeRequest) (*SpaceStatusChangeResponse, error)
|
||||
NetworkConfiguration(ctx context.Context, in *NetworkConfigurationRequest) (*NetworkConfigurationResponse, error)
|
||||
DeletionLog(ctx context.Context, in *DeletionLogRequest) (*DeletionLogResponse, error)
|
||||
AccountDelete(ctx context.Context, in *AccountDeleteRequest) (*AccountDeleteResponse, error)
|
||||
AccountRevertDeletion(ctx context.Context, in *AccountRevertDeletionRequest) (*AccountRevertDeletionResponse, error)
|
||||
}
|
||||
|
||||
type drpcCoordinatorClient struct {
|
||||
|
@ -122,6 +124,24 @@ func (c *drpcCoordinatorClient) DeletionLog(ctx context.Context, in *DeletionLog
|
|||
return out, nil
|
||||
}
|
||||
|
||||
func (c *drpcCoordinatorClient) AccountDelete(ctx context.Context, in *AccountDeleteRequest) (*AccountDeleteResponse, error) {
|
||||
out := new(AccountDeleteResponse)
|
||||
err := c.cc.Invoke(ctx, "/coordinator.Coordinator/AccountDelete", drpcEncoding_File_coordinator_coordinatorproto_protos_coordinator_proto{}, in, out)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *drpcCoordinatorClient) AccountRevertDeletion(ctx context.Context, in *AccountRevertDeletionRequest) (*AccountRevertDeletionResponse, error) {
|
||||
out := new(AccountRevertDeletionResponse)
|
||||
err := c.cc.Invoke(ctx, "/coordinator.Coordinator/AccountRevertDeletion", 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)
|
||||
|
@ -130,6 +150,8 @@ type DRPCCoordinatorServer interface {
|
|||
SpaceStatusChange(context.Context, *SpaceStatusChangeRequest) (*SpaceStatusChangeResponse, error)
|
||||
NetworkConfiguration(context.Context, *NetworkConfigurationRequest) (*NetworkConfigurationResponse, error)
|
||||
DeletionLog(context.Context, *DeletionLogRequest) (*DeletionLogResponse, error)
|
||||
AccountDelete(context.Context, *AccountDeleteRequest) (*AccountDeleteResponse, error)
|
||||
AccountRevertDeletion(context.Context, *AccountRevertDeletionRequest) (*AccountRevertDeletionResponse, error)
|
||||
}
|
||||
|
||||
type DRPCCoordinatorUnimplementedServer struct{}
|
||||
|
@ -162,9 +184,17 @@ func (s *DRPCCoordinatorUnimplementedServer) DeletionLog(context.Context, *Delet
|
|||
return nil, drpcerr.WithCode(errors.New("Unimplemented"), drpcerr.Unimplemented)
|
||||
}
|
||||
|
||||
func (s *DRPCCoordinatorUnimplementedServer) AccountDelete(context.Context, *AccountDeleteRequest) (*AccountDeleteResponse, error) {
|
||||
return nil, drpcerr.WithCode(errors.New("Unimplemented"), drpcerr.Unimplemented)
|
||||
}
|
||||
|
||||
func (s *DRPCCoordinatorUnimplementedServer) AccountRevertDeletion(context.Context, *AccountRevertDeletionRequest) (*AccountRevertDeletionResponse, error) {
|
||||
return nil, drpcerr.WithCode(errors.New("Unimplemented"), drpcerr.Unimplemented)
|
||||
}
|
||||
|
||||
type DRPCCoordinatorDescription struct{}
|
||||
|
||||
func (DRPCCoordinatorDescription) NumMethods() int { return 7 }
|
||||
func (DRPCCoordinatorDescription) NumMethods() int { return 9 }
|
||||
|
||||
func (DRPCCoordinatorDescription) Method(n int) (string, drpc.Encoding, drpc.Receiver, interface{}, bool) {
|
||||
switch n {
|
||||
|
@ -231,6 +261,24 @@ func (DRPCCoordinatorDescription) Method(n int) (string, drpc.Encoding, drpc.Rec
|
|||
in1.(*DeletionLogRequest),
|
||||
)
|
||||
}, DRPCCoordinatorServer.DeletionLog, true
|
||||
case 7:
|
||||
return "/coordinator.Coordinator/AccountDelete", drpcEncoding_File_coordinator_coordinatorproto_protos_coordinator_proto{},
|
||||
func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) {
|
||||
return srv.(DRPCCoordinatorServer).
|
||||
AccountDelete(
|
||||
ctx,
|
||||
in1.(*AccountDeleteRequest),
|
||||
)
|
||||
}, DRPCCoordinatorServer.AccountDelete, true
|
||||
case 8:
|
||||
return "/coordinator.Coordinator/AccountRevertDeletion", drpcEncoding_File_coordinator_coordinatorproto_protos_coordinator_proto{},
|
||||
func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) {
|
||||
return srv.(DRPCCoordinatorServer).
|
||||
AccountRevertDeletion(
|
||||
ctx,
|
||||
in1.(*AccountRevertDeletionRequest),
|
||||
)
|
||||
}, DRPCCoordinatorServer.AccountRevertDeletion, true
|
||||
default:
|
||||
return "", nil, nil, nil, false
|
||||
}
|
||||
|
@ -351,3 +399,35 @@ func (x *drpcCoordinator_DeletionLogStream) SendAndClose(m *DeletionLogResponse)
|
|||
}
|
||||
return x.CloseSend()
|
||||
}
|
||||
|
||||
type DRPCCoordinator_AccountDeleteStream interface {
|
||||
drpc.Stream
|
||||
SendAndClose(*AccountDeleteResponse) error
|
||||
}
|
||||
|
||||
type drpcCoordinator_AccountDeleteStream struct {
|
||||
drpc.Stream
|
||||
}
|
||||
|
||||
func (x *drpcCoordinator_AccountDeleteStream) SendAndClose(m *AccountDeleteResponse) error {
|
||||
if err := x.MsgSend(m, drpcEncoding_File_coordinator_coordinatorproto_protos_coordinator_proto{}); err != nil {
|
||||
return err
|
||||
}
|
||||
return x.CloseSend()
|
||||
}
|
||||
|
||||
type DRPCCoordinator_AccountRevertDeletionStream interface {
|
||||
drpc.Stream
|
||||
SendAndClose(*AccountRevertDeletionResponse) error
|
||||
}
|
||||
|
||||
type drpcCoordinator_AccountRevertDeletionStream struct {
|
||||
drpc.Stream
|
||||
}
|
||||
|
||||
func (x *drpcCoordinator_AccountRevertDeletionStream) SendAndClose(m *AccountRevertDeletionResponse) error {
|
||||
if err := x.MsgSend(m, drpcEncoding_File_coordinator_coordinatorproto_protos_coordinator_proto{}); err != nil {
|
||||
return err
|
||||
}
|
||||
return x.CloseSend()
|
||||
}
|
||||
|
|
|
@ -27,6 +27,12 @@ service Coordinator {
|
|||
|
||||
// DeletionLog gets the latest deletion log records
|
||||
rpc DeletionLog(DeletionLogRequest) returns (DeletionLogResponse);
|
||||
|
||||
// AccountDelete deletes an account
|
||||
rpc AccountDelete(AccountDeleteRequest) returns (AccountDeleteResponse);
|
||||
|
||||
// AccountRevertDeletion reverts an account deletion
|
||||
rpc AccountRevertDeletion(AccountRevertDeletionRequest) returns (AccountRevertDeletionResponse);
|
||||
}
|
||||
|
||||
message SpaceSignRequest {
|
||||
|
@ -95,7 +101,6 @@ message FileLimitCheckRequest {
|
|||
string spaceId = 2;
|
||||
}
|
||||
|
||||
|
||||
// FileLimitCheckResponse returns a current space limit in bytes
|
||||
message FileLimitCheckResponse {
|
||||
// Limit in bytes
|
||||
|
@ -130,6 +135,7 @@ message SpaceStatusChangeRequest {
|
|||
string deletionPayloadId = 2;
|
||||
bytes deletionPayload = 3;
|
||||
DeletionPayloadType deletionPayloadType = 4;
|
||||
int64 deletionDuration = 5;
|
||||
}
|
||||
|
||||
// SpaceStatusChangeResponse contains changed status of space
|
||||
|
@ -204,7 +210,6 @@ message DeletionConfirmPayload {
|
|||
int64 timestamp = 5;
|
||||
}
|
||||
|
||||
|
||||
message DeletionLogRequest {
|
||||
// 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 = 1;
|
||||
|
@ -240,3 +245,33 @@ enum DeletionLogRecordStatus {
|
|||
Remove = 2;
|
||||
}
|
||||
|
||||
// AccountDeleteRequest contains payload for account deletion
|
||||
message AccountDeleteRequest {
|
||||
string deletionPayloadId = 1;
|
||||
bytes deletionPayload = 2;
|
||||
}
|
||||
|
||||
// AccountDeletionConfirmPayload contains payload for deletion confirmation
|
||||
message AccountDeletionConfirmPayload {
|
||||
// PeerId of receipt requester
|
||||
string peerId = 1;
|
||||
// AccountIdentity is an identity of a space owner
|
||||
bytes accountIdentity = 2;
|
||||
// NetworkId is the id of a network where the deletion was requested
|
||||
string networkId = 3;
|
||||
// Timestamp is a timestamp when the deletion was requested
|
||||
int64 timestamp = 4;
|
||||
}
|
||||
|
||||
// AccountDeleteResponse contains timestamp when the account is finally deleted
|
||||
message AccountDeleteResponse {
|
||||
int64 deletionTimestamp = 1;
|
||||
}
|
||||
|
||||
// AccountRevertDeletionRequest is a request to revert an account deletion
|
||||
message AccountRevertDeletionRequest {
|
||||
}
|
||||
|
||||
// AccountRevertDeletionResponse is an empty response confirming that the deletion is reverted
|
||||
message AccountRevertDeletionResponse {
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue