Add master_pb.ActivateEcGenerationRequest/Response RPC definition

This commit is contained in:
chrislu
2025-08-10 12:53:10 -07:00
parent 09d740db47
commit 5650b6f505
3 changed files with 355 additions and 177 deletions

View File

@@ -27,6 +27,8 @@ service Seaweed {
}
rpc LookupEcVolume (LookupEcVolumeRequest) returns (LookupEcVolumeResponse) {
}
rpc ActivateEcGeneration (ActivateEcGenerationRequest) returns (ActivateEcGenerationResponse) {
}
rpc VacuumVolume (VacuumVolumeRequest) returns (VacuumVolumeResponse) {
}
rpc DisableVacuum (DisableVacuumRequest) returns (DisableVacuumResponse) {
@@ -328,6 +330,16 @@ message LookupEcVolumeResponse {
uint32 active_generation = 3; // current active generation for this volume
}
message ActivateEcGenerationRequest {
uint32 volume_id = 1;
string collection = 2;
uint32 generation = 3; // generation to activate
}
message ActivateEcGenerationResponse {
bool success = 1;
string error = 2; // error message if activation failed
}
message VacuumVolumeRequest {
float garbage_threshold = 1;
uint32 volume_id = 2;

File diff suppressed because it is too large Load Diff

View File

@@ -29,6 +29,7 @@ const (
Seaweed_CollectionDelete_FullMethodName = "/master_pb.Seaweed/CollectionDelete"
Seaweed_VolumeList_FullMethodName = "/master_pb.Seaweed/VolumeList"
Seaweed_LookupEcVolume_FullMethodName = "/master_pb.Seaweed/LookupEcVolume"
Seaweed_ActivateEcGeneration_FullMethodName = "/master_pb.Seaweed/ActivateEcGeneration"
Seaweed_VacuumVolume_FullMethodName = "/master_pb.Seaweed/VacuumVolume"
Seaweed_DisableVacuum_FullMethodName = "/master_pb.Seaweed/DisableVacuum"
Seaweed_EnableVacuum_FullMethodName = "/master_pb.Seaweed/EnableVacuum"
@@ -58,6 +59,7 @@ type SeaweedClient interface {
CollectionDelete(ctx context.Context, in *CollectionDeleteRequest, opts ...grpc.CallOption) (*CollectionDeleteResponse, error)
VolumeList(ctx context.Context, in *VolumeListRequest, opts ...grpc.CallOption) (*VolumeListResponse, error)
LookupEcVolume(ctx context.Context, in *LookupEcVolumeRequest, opts ...grpc.CallOption) (*LookupEcVolumeResponse, error)
ActivateEcGeneration(ctx context.Context, in *ActivateEcGenerationRequest, opts ...grpc.CallOption) (*ActivateEcGenerationResponse, error)
VacuumVolume(ctx context.Context, in *VacuumVolumeRequest, opts ...grpc.CallOption) (*VacuumVolumeResponse, error)
DisableVacuum(ctx context.Context, in *DisableVacuumRequest, opts ...grpc.CallOption) (*DisableVacuumResponse, error)
EnableVacuum(ctx context.Context, in *EnableVacuumRequest, opts ...grpc.CallOption) (*EnableVacuumResponse, error)
@@ -190,6 +192,16 @@ func (c *seaweedClient) LookupEcVolume(ctx context.Context, in *LookupEcVolumeRe
return out, nil
}
func (c *seaweedClient) ActivateEcGeneration(ctx context.Context, in *ActivateEcGenerationRequest, opts ...grpc.CallOption) (*ActivateEcGenerationResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(ActivateEcGenerationResponse)
err := c.cc.Invoke(ctx, Seaweed_ActivateEcGeneration_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *seaweedClient) VacuumVolume(ctx context.Context, in *VacuumVolumeRequest, opts ...grpc.CallOption) (*VacuumVolumeResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(VacuumVolumeResponse)
@@ -334,6 +346,7 @@ type SeaweedServer interface {
CollectionDelete(context.Context, *CollectionDeleteRequest) (*CollectionDeleteResponse, error)
VolumeList(context.Context, *VolumeListRequest) (*VolumeListResponse, error)
LookupEcVolume(context.Context, *LookupEcVolumeRequest) (*LookupEcVolumeResponse, error)
ActivateEcGeneration(context.Context, *ActivateEcGenerationRequest) (*ActivateEcGenerationResponse, error)
VacuumVolume(context.Context, *VacuumVolumeRequest) (*VacuumVolumeResponse, error)
DisableVacuum(context.Context, *DisableVacuumRequest) (*DisableVacuumResponse, error)
EnableVacuum(context.Context, *EnableVacuumRequest) (*EnableVacuumResponse, error)
@@ -387,6 +400,9 @@ func (UnimplementedSeaweedServer) VolumeList(context.Context, *VolumeListRequest
func (UnimplementedSeaweedServer) LookupEcVolume(context.Context, *LookupEcVolumeRequest) (*LookupEcVolumeResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method LookupEcVolume not implemented")
}
func (UnimplementedSeaweedServer) ActivateEcGeneration(context.Context, *ActivateEcGenerationRequest) (*ActivateEcGenerationResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method ActivateEcGeneration not implemented")
}
func (UnimplementedSeaweedServer) VacuumVolume(context.Context, *VacuumVolumeRequest) (*VacuumVolumeResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method VacuumVolume not implemented")
}
@@ -594,6 +610,24 @@ func _Seaweed_LookupEcVolume_Handler(srv interface{}, ctx context.Context, dec f
return interceptor(ctx, in, info, handler)
}
func _Seaweed_ActivateEcGeneration_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(ActivateEcGenerationRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(SeaweedServer).ActivateEcGeneration(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Seaweed_ActivateEcGeneration_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(SeaweedServer).ActivateEcGeneration(ctx, req.(*ActivateEcGenerationRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Seaweed_VacuumVolume_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(VacuumVolumeRequest)
if err := dec(in); err != nil {
@@ -863,6 +897,10 @@ var Seaweed_ServiceDesc = grpc.ServiceDesc{
MethodName: "LookupEcVolume",
Handler: _Seaweed_LookupEcVolume_Handler,
},
{
MethodName: "ActivateEcGeneration",
Handler: _Seaweed_ActivateEcGeneration_Handler,
},
{
MethodName: "VacuumVolume",
Handler: _Seaweed_VacuumVolume_Handler,