feat: update client to new v0.1.1

This commit is contained in:
2026-08-06 19:47:26 +02:00
parent aa9d403d09
commit 103efa8b1c
4 changed files with 818 additions and 92 deletions

104
client.go
View File

@@ -154,6 +154,36 @@ func (c *Client) DeleteFile(ctx context.Context, logicalPath string) error {
return nil
}
func (c *Client) MoveFile(
ctx context.Context,
sourcePath string,
destinationPath string,
) error {
_, err := c.rpc.MoveFile(ctx, &zwdaemonv1.MoveFileRequest{
SourcePath: sourcePath,
DestinationPath: destinationPath,
})
if err != nil {
return convertRPCError(err)
}
return nil
}
func (c *Client) CopyFile(
ctx context.Context,
sourcePath string,
destinationPath string,
) error {
_, err := c.rpc.CopyFile(ctx, &zwdaemonv1.CopyFileRequest{
SourcePath: sourcePath,
DestinationPath: destinationPath,
})
if err != nil {
return convertRPCError(err)
}
return nil
}
func (c *Client) Compact(ctx context.Context) error {
_, err := c.rpc.Compact(ctx, &zwdaemonv1.CompactRequest{})
if err != nil {
@@ -291,3 +321,77 @@ func (c *Client) AddFile(
}
}
}
func (c *Client) ReplaceFile(
ctx context.Context,
logicalPath string,
source io.Reader,
sourceLen uint64,
) error {
uploadCtx, cancel := context.WithCancel(ctx)
defer cancel()
stream, err := c.rpc.ReplaceFile(uploadCtx)
if err != nil {
return convertRPCError(err)
}
send := func(request *zwdaemonv1.ReplaceFileRequest) error {
err := stream.Send(request)
if err == nil {
return nil
}
if errors.Is(err, io.EOF) {
_, receiveErr := stream.CloseAndRecv()
if receiveErr != nil {
return convertRPCError(receiveErr)
}
}
return convertRPCError(err)
}
err = send(&zwdaemonv1.ReplaceFileRequest{
Payload: &zwdaemonv1.ReplaceFileRequest_Header{
Header: &zwdaemonv1.ReplaceFileHeader{
LogicalPath: logicalPath,
SourceLen: sourceLen,
},
},
})
if err != nil {
return err
}
const chunkSize = 512 * 1024
buffer := make([]byte, chunkSize)
for {
n, readErr := source.Read(buffer)
if n > 0 {
err := send(&zwdaemonv1.ReplaceFileRequest{
Payload: &zwdaemonv1.ReplaceFileRequest_Chunk{
Chunk: buffer[:n],
},
})
if err != nil {
return err
}
}
switch {
case readErr == nil:
continue
case errors.Is(readErr, io.EOF):
_, err := stream.CloseAndRecv()
if err != nil {
return convertRPCError(err)
}
return nil
default:
return &UploadReadError{Err: readErr}
}
}
}

View File

@@ -42,12 +42,17 @@ type testService struct {
deleteFileRequests chan *zwdaemonv1.DeleteFileRequest
deleteFileErr error
moveFileRequests chan *zwdaemonv1.MoveFileRequest
moveFileErr error
copyFileRequests chan *zwdaemonv1.CopyFileRequest
copyFileErr error
compactCalls chan struct{}
compactErr error
getFile func(*zwdaemonv1.GetFileRequest, grpc.ServerStreamingServer[zwdaemonv1.GetFileResponse]) error
getFileRange func(*zwdaemonv1.GetFileRangeRequest, grpc.ServerStreamingServer[zwdaemonv1.GetFileRangeResponse]) error
addFile func(grpc.ClientStreamingServer[zwdaemonv1.AddFileRequest, zwdaemonv1.AddFileResponse]) error
replaceFile func(grpc.ClientStreamingServer[zwdaemonv1.ReplaceFileRequest, zwdaemonv1.ReplaceFileResponse]) error
}
func (s *testService) GetServerInfo(
@@ -120,6 +125,26 @@ func (s *testService) Compact(
return &zwdaemonv1.CompactResponse{}, s.compactErr
}
func (s *testService) MoveFile(
_ context.Context,
request *zwdaemonv1.MoveFileRequest,
) (*zwdaemonv1.MoveFileResponse, error) {
if s.moveFileRequests != nil {
s.moveFileRequests <- request
}
return &zwdaemonv1.MoveFileResponse{}, s.moveFileErr
}
func (s *testService) CopyFile(
_ context.Context,
request *zwdaemonv1.CopyFileRequest,
) (*zwdaemonv1.CopyFileResponse, error) {
if s.copyFileRequests != nil {
s.copyFileRequests <- request
}
return &zwdaemonv1.CopyFileResponse{}, s.copyFileErr
}
func (s *testService) GetFile(
request *zwdaemonv1.GetFileRequest,
stream grpc.ServerStreamingServer[zwdaemonv1.GetFileResponse],
@@ -149,6 +174,15 @@ func (s *testService) AddFile(
return s.addFile(stream)
}
func (s *testService) ReplaceFile(
stream grpc.ClientStreamingServer[zwdaemonv1.ReplaceFileRequest, zwdaemonv1.ReplaceFileResponse],
) error {
if s.replaceFile == nil {
return stream.SendAndClose(&zwdaemonv1.ReplaceFileResponse{})
}
return s.replaceFile(stream)
}
func startTestServer(t *testing.T, service *testService) string {
t.Helper()
@@ -536,6 +570,32 @@ func TestDeleteFileMapsRequestAndStructuredError(t *testing.T) {
}
}
func TestMoveAndCopyFileMapRequests(t *testing.T) {
service := &testService{
moveFileRequests: make(chan *zwdaemonv1.MoveFileRequest, 1),
copyFileRequests: make(chan *zwdaemonv1.CopyFileRequest, 1),
}
client := startConnectedTestClient(t, service)
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
defer cancel()
if err := client.MoveFile(ctx, "source.txt", "renamed.txt"); err != nil {
t.Fatalf("MoveFile() error = %v", err)
}
moveRequest := <-service.moveFileRequests
if moveRequest.GetSourcePath() != "source.txt" || moveRequest.GetDestinationPath() != "renamed.txt" {
t.Errorf("MoveFile request = %#v", moveRequest)
}
if err := client.CopyFile(ctx, "source.txt", "copy.txt"); err != nil {
t.Fatalf("CopyFile() error = %v", err)
}
copyRequest := <-service.copyFileRequests
if copyRequest.GetSourcePath() != "source.txt" || copyRequest.GetDestinationPath() != "copy.txt" {
t.Errorf("CopyFile request = %#v", copyRequest)
}
}
func TestConvertRPCErrorAcceptsNil(t *testing.T) {
if err := convertRPCError(nil); err != nil {
t.Fatalf("convertRPCError(nil) = %v", err)
@@ -827,6 +887,41 @@ func TestAddFileProcessesDataReturnedWithEOF(t *testing.T) {
}
}
func TestReplaceFileSendsHeaderAndChunks(t *testing.T) {
received := make(chan receivedReplaceUpload, 1)
service := &testService{
replaceFile: func(
stream grpc.ClientStreamingServer[zwdaemonv1.ReplaceFileRequest, zwdaemonv1.ReplaceFileResponse],
) error {
upload, err := receiveReplaceUpload(stream)
if err != nil {
return err
}
received <- upload
return stream.SendAndClose(&zwdaemonv1.ReplaceFileResponse{})
},
}
client := startConnectedTestClient(t, service)
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
defer cancel()
contents := []byte("replacement contents")
if err := client.ReplaceFile(ctx, "existing.bin", bytes.NewReader(contents), uint64(len(contents))); err != nil {
t.Fatalf("ReplaceFile() error = %v", err)
}
upload := <-received
if upload.header.GetLogicalPath() != "existing.bin" {
t.Errorf("logical path = %q", upload.header.GetLogicalPath())
}
if upload.header.GetSourceLen() != uint64(len(contents)) {
t.Errorf("source length = %d", upload.header.GetSourceLen())
}
if !bytes.Equal(upload.contents, contents) {
t.Errorf("replacement contents differ")
}
}
func TestAddFileReturnsLengthRejectionFromCloseAndRecv(t *testing.T) {
serverStatus, err := status.New(codes.InvalidArgument, "declared length does not match source").WithDetails(
&zwdaemonv1.ZwErrorDetail{
@@ -977,6 +1072,40 @@ func receiveUpload(
}
}
type receivedReplaceUpload struct {
header *zwdaemonv1.ReplaceFileHeader
contents []byte
}
func receiveReplaceUpload(
stream grpc.ClientStreamingServer[zwdaemonv1.ReplaceFileRequest, zwdaemonv1.ReplaceFileResponse],
) (receivedReplaceUpload, error) {
first, err := stream.Recv()
if err != nil {
return receivedReplaceUpload{}, err
}
header := first.GetHeader()
if header == nil {
return receivedReplaceUpload{}, status.Error(codes.InvalidArgument, "first replacement message is not a header")
}
upload := receivedReplaceUpload{header: header}
for {
request, err := stream.Recv()
if err == io.EOF {
return upload, nil
}
if err != nil {
return upload, err
}
payload, ok := request.GetPayload().(*zwdaemonv1.ReplaceFileRequest_Chunk)
if !ok {
return upload, status.Error(codes.InvalidArgument, "replacement message after header is not a chunk")
}
upload.contents = append(upload.contents, payload.Chunk...)
}
}
type dataAndEOFReader struct {
data []byte
done bool

View File

@@ -427,6 +427,114 @@ func (*DeleteFileResponse) Descriptor() ([]byte, []int) {
return file_zw_daemon_v1_daemon_proto_rawDescGZIP(), []int{8}
}
type MoveFileResponse struct {
state protoimpl.MessageState `protogen:"open.v1"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *MoveFileResponse) Reset() {
*x = MoveFileResponse{}
mi := &file_zw_daemon_v1_daemon_proto_msgTypes[9]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *MoveFileResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*MoveFileResponse) ProtoMessage() {}
func (x *MoveFileResponse) ProtoReflect() protoreflect.Message {
mi := &file_zw_daemon_v1_daemon_proto_msgTypes[9]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use MoveFileResponse.ProtoReflect.Descriptor instead.
func (*MoveFileResponse) Descriptor() ([]byte, []int) {
return file_zw_daemon_v1_daemon_proto_rawDescGZIP(), []int{9}
}
type CopyFileResponse struct {
state protoimpl.MessageState `protogen:"open.v1"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *CopyFileResponse) Reset() {
*x = CopyFileResponse{}
mi := &file_zw_daemon_v1_daemon_proto_msgTypes[10]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *CopyFileResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*CopyFileResponse) ProtoMessage() {}
func (x *CopyFileResponse) ProtoReflect() protoreflect.Message {
mi := &file_zw_daemon_v1_daemon_proto_msgTypes[10]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use CopyFileResponse.ProtoReflect.Descriptor instead.
func (*CopyFileResponse) Descriptor() ([]byte, []int) {
return file_zw_daemon_v1_daemon_proto_rawDescGZIP(), []int{10}
}
type ReplaceFileResponse struct {
state protoimpl.MessageState `protogen:"open.v1"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *ReplaceFileResponse) Reset() {
*x = ReplaceFileResponse{}
mi := &file_zw_daemon_v1_daemon_proto_msgTypes[11]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *ReplaceFileResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ReplaceFileResponse) ProtoMessage() {}
func (x *ReplaceFileResponse) ProtoReflect() protoreflect.Message {
mi := &file_zw_daemon_v1_daemon_proto_msgTypes[11]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use ReplaceFileResponse.ProtoReflect.Descriptor instead.
func (*ReplaceFileResponse) Descriptor() ([]byte, []int) {
return file_zw_daemon_v1_daemon_proto_rawDescGZIP(), []int{11}
}
type GetServerInfoResponse struct {
state protoimpl.MessageState `protogen:"open.v1"`
ApiMajor uint32 `protobuf:"varint,1,opt,name=api_major,json=apiMajor,proto3" json:"api_major,omitempty"`
@@ -438,7 +546,7 @@ type GetServerInfoResponse struct {
func (x *GetServerInfoResponse) Reset() {
*x = GetServerInfoResponse{}
mi := &file_zw_daemon_v1_daemon_proto_msgTypes[9]
mi := &file_zw_daemon_v1_daemon_proto_msgTypes[12]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -450,7 +558,7 @@ func (x *GetServerInfoResponse) String() string {
func (*GetServerInfoResponse) ProtoMessage() {}
func (x *GetServerInfoResponse) ProtoReflect() protoreflect.Message {
mi := &file_zw_daemon_v1_daemon_proto_msgTypes[9]
mi := &file_zw_daemon_v1_daemon_proto_msgTypes[12]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -463,7 +571,7 @@ func (x *GetServerInfoResponse) ProtoReflect() protoreflect.Message {
// Deprecated: Use GetServerInfoResponse.ProtoReflect.Descriptor instead.
func (*GetServerInfoResponse) Descriptor() ([]byte, []int) {
return file_zw_daemon_v1_daemon_proto_rawDescGZIP(), []int{9}
return file_zw_daemon_v1_daemon_proto_rawDescGZIP(), []int{12}
}
func (x *GetServerInfoResponse) GetApiMajor() uint32 {
@@ -497,7 +605,7 @@ type CreateRequest struct {
func (x *CreateRequest) Reset() {
*x = CreateRequest{}
mi := &file_zw_daemon_v1_daemon_proto_msgTypes[10]
mi := &file_zw_daemon_v1_daemon_proto_msgTypes[13]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -509,7 +617,7 @@ func (x *CreateRequest) String() string {
func (*CreateRequest) ProtoMessage() {}
func (x *CreateRequest) ProtoReflect() protoreflect.Message {
mi := &file_zw_daemon_v1_daemon_proto_msgTypes[10]
mi := &file_zw_daemon_v1_daemon_proto_msgTypes[13]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -522,7 +630,7 @@ func (x *CreateRequest) ProtoReflect() protoreflect.Message {
// Deprecated: Use CreateRequest.ProtoReflect.Descriptor instead.
func (*CreateRequest) Descriptor() ([]byte, []int) {
return file_zw_daemon_v1_daemon_proto_rawDescGZIP(), []int{10}
return file_zw_daemon_v1_daemon_proto_rawDescGZIP(), []int{13}
}
func (x *CreateRequest) GetVaultPath() string {
@@ -549,7 +657,7 @@ type UnsealRequest struct {
func (x *UnsealRequest) Reset() {
*x = UnsealRequest{}
mi := &file_zw_daemon_v1_daemon_proto_msgTypes[11]
mi := &file_zw_daemon_v1_daemon_proto_msgTypes[14]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -561,7 +669,7 @@ func (x *UnsealRequest) String() string {
func (*UnsealRequest) ProtoMessage() {}
func (x *UnsealRequest) ProtoReflect() protoreflect.Message {
mi := &file_zw_daemon_v1_daemon_proto_msgTypes[11]
mi := &file_zw_daemon_v1_daemon_proto_msgTypes[14]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -574,7 +682,7 @@ func (x *UnsealRequest) ProtoReflect() protoreflect.Message {
// Deprecated: Use UnsealRequest.ProtoReflect.Descriptor instead.
func (*UnsealRequest) Descriptor() ([]byte, []int) {
return file_zw_daemon_v1_daemon_proto_rawDescGZIP(), []int{11}
return file_zw_daemon_v1_daemon_proto_rawDescGZIP(), []int{14}
}
func (x *UnsealRequest) GetVaultPath() string {
@@ -601,7 +709,7 @@ type ListFilesRequest struct {
func (x *ListFilesRequest) Reset() {
*x = ListFilesRequest{}
mi := &file_zw_daemon_v1_daemon_proto_msgTypes[12]
mi := &file_zw_daemon_v1_daemon_proto_msgTypes[15]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -613,7 +721,7 @@ func (x *ListFilesRequest) String() string {
func (*ListFilesRequest) ProtoMessage() {}
func (x *ListFilesRequest) ProtoReflect() protoreflect.Message {
mi := &file_zw_daemon_v1_daemon_proto_msgTypes[12]
mi := &file_zw_daemon_v1_daemon_proto_msgTypes[15]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -626,7 +734,7 @@ func (x *ListFilesRequest) ProtoReflect() protoreflect.Message {
// Deprecated: Use ListFilesRequest.ProtoReflect.Descriptor instead.
func (*ListFilesRequest) Descriptor() ([]byte, []int) {
return file_zw_daemon_v1_daemon_proto_rawDescGZIP(), []int{12}
return file_zw_daemon_v1_daemon_proto_rawDescGZIP(), []int{15}
}
func (x *ListFilesRequest) GetPrefix() string {
@@ -652,7 +760,7 @@ type ListFilesResponse struct {
func (x *ListFilesResponse) Reset() {
*x = ListFilesResponse{}
mi := &file_zw_daemon_v1_daemon_proto_msgTypes[13]
mi := &file_zw_daemon_v1_daemon_proto_msgTypes[16]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -664,7 +772,7 @@ func (x *ListFilesResponse) String() string {
func (*ListFilesResponse) ProtoMessage() {}
func (x *ListFilesResponse) ProtoReflect() protoreflect.Message {
mi := &file_zw_daemon_v1_daemon_proto_msgTypes[13]
mi := &file_zw_daemon_v1_daemon_proto_msgTypes[16]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -677,7 +785,7 @@ func (x *ListFilesResponse) ProtoReflect() protoreflect.Message {
// Deprecated: Use ListFilesResponse.ProtoReflect.Descriptor instead.
func (*ListFilesResponse) Descriptor() ([]byte, []int) {
return file_zw_daemon_v1_daemon_proto_rawDescGZIP(), []int{13}
return file_zw_daemon_v1_daemon_proto_rawDescGZIP(), []int{16}
}
func (x *ListFilesResponse) GetFiles() []*ListedFile {
@@ -697,7 +805,7 @@ type ListedFile struct {
func (x *ListedFile) Reset() {
*x = ListedFile{}
mi := &file_zw_daemon_v1_daemon_proto_msgTypes[14]
mi := &file_zw_daemon_v1_daemon_proto_msgTypes[17]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -709,7 +817,7 @@ func (x *ListedFile) String() string {
func (*ListedFile) ProtoMessage() {}
func (x *ListedFile) ProtoReflect() protoreflect.Message {
mi := &file_zw_daemon_v1_daemon_proto_msgTypes[14]
mi := &file_zw_daemon_v1_daemon_proto_msgTypes[17]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -722,7 +830,7 @@ func (x *ListedFile) ProtoReflect() protoreflect.Message {
// Deprecated: Use ListedFile.ProtoReflect.Descriptor instead.
func (*ListedFile) Descriptor() ([]byte, []int) {
return file_zw_daemon_v1_daemon_proto_rawDescGZIP(), []int{14}
return file_zw_daemon_v1_daemon_proto_rawDescGZIP(), []int{17}
}
func (x *ListedFile) GetLogicalPath() string {
@@ -748,7 +856,7 @@ type GetFileRequest struct {
func (x *GetFileRequest) Reset() {
*x = GetFileRequest{}
mi := &file_zw_daemon_v1_daemon_proto_msgTypes[15]
mi := &file_zw_daemon_v1_daemon_proto_msgTypes[18]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -760,7 +868,7 @@ func (x *GetFileRequest) String() string {
func (*GetFileRequest) ProtoMessage() {}
func (x *GetFileRequest) ProtoReflect() protoreflect.Message {
mi := &file_zw_daemon_v1_daemon_proto_msgTypes[15]
mi := &file_zw_daemon_v1_daemon_proto_msgTypes[18]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -773,7 +881,7 @@ func (x *GetFileRequest) ProtoReflect() protoreflect.Message {
// Deprecated: Use GetFileRequest.ProtoReflect.Descriptor instead.
func (*GetFileRequest) Descriptor() ([]byte, []int) {
return file_zw_daemon_v1_daemon_proto_rawDescGZIP(), []int{15}
return file_zw_daemon_v1_daemon_proto_rawDescGZIP(), []int{18}
}
func (x *GetFileRequest) GetLogicalPath() string {
@@ -783,6 +891,110 @@ func (x *GetFileRequest) GetLogicalPath() string {
return ""
}
type MoveFileRequest struct {
state protoimpl.MessageState `protogen:"open.v1"`
SourcePath string `protobuf:"bytes,1,opt,name=source_path,json=sourcePath,proto3" json:"source_path,omitempty"`
DestinationPath string `protobuf:"bytes,2,opt,name=destination_path,json=destinationPath,proto3" json:"destination_path,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *MoveFileRequest) Reset() {
*x = MoveFileRequest{}
mi := &file_zw_daemon_v1_daemon_proto_msgTypes[19]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *MoveFileRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*MoveFileRequest) ProtoMessage() {}
func (x *MoveFileRequest) ProtoReflect() protoreflect.Message {
mi := &file_zw_daemon_v1_daemon_proto_msgTypes[19]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use MoveFileRequest.ProtoReflect.Descriptor instead.
func (*MoveFileRequest) Descriptor() ([]byte, []int) {
return file_zw_daemon_v1_daemon_proto_rawDescGZIP(), []int{19}
}
func (x *MoveFileRequest) GetSourcePath() string {
if x != nil {
return x.SourcePath
}
return ""
}
func (x *MoveFileRequest) GetDestinationPath() string {
if x != nil {
return x.DestinationPath
}
return ""
}
type CopyFileRequest struct {
state protoimpl.MessageState `protogen:"open.v1"`
SourcePath string `protobuf:"bytes,1,opt,name=source_path,json=sourcePath,proto3" json:"source_path,omitempty"`
DestinationPath string `protobuf:"bytes,2,opt,name=destination_path,json=destinationPath,proto3" json:"destination_path,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *CopyFileRequest) Reset() {
*x = CopyFileRequest{}
mi := &file_zw_daemon_v1_daemon_proto_msgTypes[20]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *CopyFileRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*CopyFileRequest) ProtoMessage() {}
func (x *CopyFileRequest) ProtoReflect() protoreflect.Message {
mi := &file_zw_daemon_v1_daemon_proto_msgTypes[20]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use CopyFileRequest.ProtoReflect.Descriptor instead.
func (*CopyFileRequest) Descriptor() ([]byte, []int) {
return file_zw_daemon_v1_daemon_proto_rawDescGZIP(), []int{20}
}
func (x *CopyFileRequest) GetSourcePath() string {
if x != nil {
return x.SourcePath
}
return ""
}
func (x *CopyFileRequest) GetDestinationPath() string {
if x != nil {
return x.DestinationPath
}
return ""
}
type GetFileRangeRequest struct {
state protoimpl.MessageState `protogen:"open.v1"`
LogicalPath string `protobuf:"bytes,1,opt,name=logical_path,json=logicalPath,proto3" json:"logical_path,omitempty"`
@@ -794,7 +1006,7 @@ type GetFileRangeRequest struct {
func (x *GetFileRangeRequest) Reset() {
*x = GetFileRangeRequest{}
mi := &file_zw_daemon_v1_daemon_proto_msgTypes[16]
mi := &file_zw_daemon_v1_daemon_proto_msgTypes[21]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -806,7 +1018,7 @@ func (x *GetFileRangeRequest) String() string {
func (*GetFileRangeRequest) ProtoMessage() {}
func (x *GetFileRangeRequest) ProtoReflect() protoreflect.Message {
mi := &file_zw_daemon_v1_daemon_proto_msgTypes[16]
mi := &file_zw_daemon_v1_daemon_proto_msgTypes[21]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -819,7 +1031,7 @@ func (x *GetFileRangeRequest) ProtoReflect() protoreflect.Message {
// Deprecated: Use GetFileRangeRequest.ProtoReflect.Descriptor instead.
func (*GetFileRangeRequest) Descriptor() ([]byte, []int) {
return file_zw_daemon_v1_daemon_proto_rawDescGZIP(), []int{16}
return file_zw_daemon_v1_daemon_proto_rawDescGZIP(), []int{21}
}
func (x *GetFileRangeRequest) GetLogicalPath() string {
@@ -852,7 +1064,7 @@ type GetFileResponse struct {
func (x *GetFileResponse) Reset() {
*x = GetFileResponse{}
mi := &file_zw_daemon_v1_daemon_proto_msgTypes[17]
mi := &file_zw_daemon_v1_daemon_proto_msgTypes[22]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -864,7 +1076,7 @@ func (x *GetFileResponse) String() string {
func (*GetFileResponse) ProtoMessage() {}
func (x *GetFileResponse) ProtoReflect() protoreflect.Message {
mi := &file_zw_daemon_v1_daemon_proto_msgTypes[17]
mi := &file_zw_daemon_v1_daemon_proto_msgTypes[22]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -877,7 +1089,7 @@ func (x *GetFileResponse) ProtoReflect() protoreflect.Message {
// Deprecated: Use GetFileResponse.ProtoReflect.Descriptor instead.
func (*GetFileResponse) Descriptor() ([]byte, []int) {
return file_zw_daemon_v1_daemon_proto_rawDescGZIP(), []int{17}
return file_zw_daemon_v1_daemon_proto_rawDescGZIP(), []int{22}
}
func (x *GetFileResponse) GetData() []byte {
@@ -896,7 +1108,7 @@ type GetFileRangeResponse struct {
func (x *GetFileRangeResponse) Reset() {
*x = GetFileRangeResponse{}
mi := &file_zw_daemon_v1_daemon_proto_msgTypes[18]
mi := &file_zw_daemon_v1_daemon_proto_msgTypes[23]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -908,7 +1120,7 @@ func (x *GetFileRangeResponse) String() string {
func (*GetFileRangeResponse) ProtoMessage() {}
func (x *GetFileRangeResponse) ProtoReflect() protoreflect.Message {
mi := &file_zw_daemon_v1_daemon_proto_msgTypes[18]
mi := &file_zw_daemon_v1_daemon_proto_msgTypes[23]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -921,7 +1133,7 @@ func (x *GetFileRangeResponse) ProtoReflect() protoreflect.Message {
// Deprecated: Use GetFileRangeResponse.ProtoReflect.Descriptor instead.
func (*GetFileRangeResponse) Descriptor() ([]byte, []int) {
return file_zw_daemon_v1_daemon_proto_rawDescGZIP(), []int{18}
return file_zw_daemon_v1_daemon_proto_rawDescGZIP(), []int{23}
}
func (x *GetFileRangeResponse) GetData() []byte {
@@ -944,7 +1156,7 @@ type AddFileRequest struct {
func (x *AddFileRequest) Reset() {
*x = AddFileRequest{}
mi := &file_zw_daemon_v1_daemon_proto_msgTypes[19]
mi := &file_zw_daemon_v1_daemon_proto_msgTypes[24]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -956,7 +1168,7 @@ func (x *AddFileRequest) String() string {
func (*AddFileRequest) ProtoMessage() {}
func (x *AddFileRequest) ProtoReflect() protoreflect.Message {
mi := &file_zw_daemon_v1_daemon_proto_msgTypes[19]
mi := &file_zw_daemon_v1_daemon_proto_msgTypes[24]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -969,7 +1181,7 @@ func (x *AddFileRequest) ProtoReflect() protoreflect.Message {
// Deprecated: Use AddFileRequest.ProtoReflect.Descriptor instead.
func (*AddFileRequest) Descriptor() ([]byte, []int) {
return file_zw_daemon_v1_daemon_proto_rawDescGZIP(), []int{19}
return file_zw_daemon_v1_daemon_proto_rawDescGZIP(), []int{24}
}
func (x *AddFileRequest) GetPayload() isAddFileRequest_Payload {
@@ -1023,7 +1235,7 @@ type AddFileHeader struct {
func (x *AddFileHeader) Reset() {
*x = AddFileHeader{}
mi := &file_zw_daemon_v1_daemon_proto_msgTypes[20]
mi := &file_zw_daemon_v1_daemon_proto_msgTypes[25]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -1035,7 +1247,7 @@ func (x *AddFileHeader) String() string {
func (*AddFileHeader) ProtoMessage() {}
func (x *AddFileHeader) ProtoReflect() protoreflect.Message {
mi := &file_zw_daemon_v1_daemon_proto_msgTypes[20]
mi := &file_zw_daemon_v1_daemon_proto_msgTypes[25]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -1048,7 +1260,7 @@ func (x *AddFileHeader) ProtoReflect() protoreflect.Message {
// Deprecated: Use AddFileHeader.ProtoReflect.Descriptor instead.
func (*AddFileHeader) Descriptor() ([]byte, []int) {
return file_zw_daemon_v1_daemon_proto_rawDescGZIP(), []int{20}
return file_zw_daemon_v1_daemon_proto_rawDescGZIP(), []int{25}
}
func (x *AddFileHeader) GetLogicalPath() string {
@@ -1065,6 +1277,140 @@ func (x *AddFileHeader) GetSourceLen() uint64 {
return 0
}
type ReplaceFileRequest struct {
state protoimpl.MessageState `protogen:"open.v1"`
// Types that are valid to be assigned to Payload:
//
// *ReplaceFileRequest_Header
// *ReplaceFileRequest_Chunk
Payload isReplaceFileRequest_Payload `protobuf_oneof:"payload"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *ReplaceFileRequest) Reset() {
*x = ReplaceFileRequest{}
mi := &file_zw_daemon_v1_daemon_proto_msgTypes[26]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *ReplaceFileRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ReplaceFileRequest) ProtoMessage() {}
func (x *ReplaceFileRequest) ProtoReflect() protoreflect.Message {
mi := &file_zw_daemon_v1_daemon_proto_msgTypes[26]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use ReplaceFileRequest.ProtoReflect.Descriptor instead.
func (*ReplaceFileRequest) Descriptor() ([]byte, []int) {
return file_zw_daemon_v1_daemon_proto_rawDescGZIP(), []int{26}
}
func (x *ReplaceFileRequest) GetPayload() isReplaceFileRequest_Payload {
if x != nil {
return x.Payload
}
return nil
}
func (x *ReplaceFileRequest) GetHeader() *ReplaceFileHeader {
if x != nil {
if x, ok := x.Payload.(*ReplaceFileRequest_Header); ok {
return x.Header
}
}
return nil
}
func (x *ReplaceFileRequest) GetChunk() []byte {
if x != nil {
if x, ok := x.Payload.(*ReplaceFileRequest_Chunk); ok {
return x.Chunk
}
}
return nil
}
type isReplaceFileRequest_Payload interface {
isReplaceFileRequest_Payload()
}
type ReplaceFileRequest_Header struct {
Header *ReplaceFileHeader `protobuf:"bytes,1,opt,name=header,proto3,oneof"`
}
type ReplaceFileRequest_Chunk struct {
Chunk []byte `protobuf:"bytes,2,opt,name=chunk,proto3,oneof"`
}
func (*ReplaceFileRequest_Header) isReplaceFileRequest_Payload() {}
func (*ReplaceFileRequest_Chunk) isReplaceFileRequest_Payload() {}
type ReplaceFileHeader struct {
state protoimpl.MessageState `protogen:"open.v1"`
LogicalPath string `protobuf:"bytes,1,opt,name=logical_path,json=logicalPath,proto3" json:"logical_path,omitempty"`
SourceLen uint64 `protobuf:"varint,2,opt,name=source_len,json=sourceLen,proto3" json:"source_len,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *ReplaceFileHeader) Reset() {
*x = ReplaceFileHeader{}
mi := &file_zw_daemon_v1_daemon_proto_msgTypes[27]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *ReplaceFileHeader) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ReplaceFileHeader) ProtoMessage() {}
func (x *ReplaceFileHeader) ProtoReflect() protoreflect.Message {
mi := &file_zw_daemon_v1_daemon_proto_msgTypes[27]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use ReplaceFileHeader.ProtoReflect.Descriptor instead.
func (*ReplaceFileHeader) Descriptor() ([]byte, []int) {
return file_zw_daemon_v1_daemon_proto_rawDescGZIP(), []int{27}
}
func (x *ReplaceFileHeader) GetLogicalPath() string {
if x != nil {
return x.LogicalPath
}
return ""
}
func (x *ReplaceFileHeader) GetSourceLen() uint64 {
if x != nil {
return x.SourceLen
}
return 0
}
type DeleteFileRequest struct {
state protoimpl.MessageState `protogen:"open.v1"`
LogicalPath string `protobuf:"bytes,1,opt,name=logical_path,json=logicalPath,proto3" json:"logical_path,omitempty"`
@@ -1074,7 +1420,7 @@ type DeleteFileRequest struct {
func (x *DeleteFileRequest) Reset() {
*x = DeleteFileRequest{}
mi := &file_zw_daemon_v1_daemon_proto_msgTypes[21]
mi := &file_zw_daemon_v1_daemon_proto_msgTypes[28]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -1086,7 +1432,7 @@ func (x *DeleteFileRequest) String() string {
func (*DeleteFileRequest) ProtoMessage() {}
func (x *DeleteFileRequest) ProtoReflect() protoreflect.Message {
mi := &file_zw_daemon_v1_daemon_proto_msgTypes[21]
mi := &file_zw_daemon_v1_daemon_proto_msgTypes[28]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -1099,7 +1445,7 @@ func (x *DeleteFileRequest) ProtoReflect() protoreflect.Message {
// Deprecated: Use DeleteFileRequest.ProtoReflect.Descriptor instead.
func (*DeleteFileRequest) Descriptor() ([]byte, []int) {
return file_zw_daemon_v1_daemon_proto_rawDescGZIP(), []int{21}
return file_zw_daemon_v1_daemon_proto_rawDescGZIP(), []int{28}
}
func (x *DeleteFileRequest) GetLogicalPath() string {
@@ -1119,7 +1465,7 @@ type ZwErrorDetail struct {
func (x *ZwErrorDetail) Reset() {
*x = ZwErrorDetail{}
mi := &file_zw_daemon_v1_daemon_proto_msgTypes[22]
mi := &file_zw_daemon_v1_daemon_proto_msgTypes[29]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -1131,7 +1477,7 @@ func (x *ZwErrorDetail) String() string {
func (*ZwErrorDetail) ProtoMessage() {}
func (x *ZwErrorDetail) ProtoReflect() protoreflect.Message {
mi := &file_zw_daemon_v1_daemon_proto_msgTypes[22]
mi := &file_zw_daemon_v1_daemon_proto_msgTypes[29]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -1144,7 +1490,7 @@ func (x *ZwErrorDetail) ProtoReflect() protoreflect.Message {
// Deprecated: Use ZwErrorDetail.ProtoReflect.Descriptor instead.
func (*ZwErrorDetail) Descriptor() ([]byte, []int) {
return file_zw_daemon_v1_daemon_proto_rawDescGZIP(), []int{22}
return file_zw_daemon_v1_daemon_proto_rawDescGZIP(), []int{29}
}
func (x *ZwErrorDetail) GetCode() ZwErrorCode {
@@ -1174,7 +1520,10 @@ const file_zw_daemon_v1_daemon_proto_rawDesc = "" +
"\x0fCompactResponse\"\x10\n" +
"\x0eCompactRequest\"\x11\n" +
"\x0fAddFileResponse\"\x14\n" +
"\x12DeleteFileResponse\"x\n" +
"\x12DeleteFileResponse\"\x12\n" +
"\x10MoveFileResponse\"\x12\n" +
"\x10CopyFileResponse\"\x15\n" +
"\x13ReplaceFileResponse\"x\n" +
"\x15GetServerInfoResponse\x12\x1b\n" +
"\tapi_major\x18\x01 \x01(\rR\bapiMajor\x12\x1b\n" +
"\tapi_minor\x18\x02 \x01(\rR\bapiMinor\x12%\n" +
@@ -1199,7 +1548,15 @@ const file_zw_daemon_v1_daemon_proto_rawDesc = "" +
"\flogical_path\x18\x01 \x01(\tR\vlogicalPath\x12\x12\n" +
"\x04size\x18\x02 \x01(\x04R\x04size\"3\n" +
"\x0eGetFileRequest\x12!\n" +
"\flogical_path\x18\x01 \x01(\tR\vlogicalPath\"s\n" +
"\flogical_path\x18\x01 \x01(\tR\vlogicalPath\"]\n" +
"\x0fMoveFileRequest\x12\x1f\n" +
"\vsource_path\x18\x01 \x01(\tR\n" +
"sourcePath\x12)\n" +
"\x10destination_path\x18\x02 \x01(\tR\x0fdestinationPath\"]\n" +
"\x0fCopyFileRequest\x12\x1f\n" +
"\vsource_path\x18\x01 \x01(\tR\n" +
"sourcePath\x12)\n" +
"\x10destination_path\x18\x02 \x01(\tR\x0fdestinationPath\"s\n" +
"\x13GetFileRangeRequest\x12!\n" +
"\flogical_path\x18\x01 \x01(\tR\vlogicalPath\x12\x14\n" +
"\x05start\x18\x02 \x01(\x04R\x05start\x12#\n" +
@@ -1215,6 +1572,14 @@ const file_zw_daemon_v1_daemon_proto_rawDesc = "" +
"\rAddFileHeader\x12!\n" +
"\flogical_path\x18\x01 \x01(\tR\vlogicalPath\x12\x1d\n" +
"\n" +
"source_len\x18\x02 \x01(\x04R\tsourceLen\"r\n" +
"\x12ReplaceFileRequest\x129\n" +
"\x06header\x18\x01 \x01(\v2\x1f.zw.daemon.v1.ReplaceFileHeaderH\x00R\x06header\x12\x16\n" +
"\x05chunk\x18\x02 \x01(\fH\x00R\x05chunkB\t\n" +
"\apayload\"U\n" +
"\x11ReplaceFileHeader\x12!\n" +
"\flogical_path\x18\x01 \x01(\tR\vlogicalPath\x12\x1d\n" +
"\n" +
"source_len\x18\x02 \x01(\x04R\tsourceLen\"6\n" +
"\x11DeleteFileRequest\x12!\n" +
"\flogical_path\x18\x01 \x01(\tR\vlogicalPath\"\\\n" +
@@ -1236,7 +1601,7 @@ const file_zw_daemon_v1_daemon_proto_rawDesc = "" +
"\x12\x1f\n" +
"\x1bZW_ERROR_CODE_COMMIT_FAILED\x10\v\x12!\n" +
"\x1dZW_ERROR_CODE_INVALID_REQUEST\x10\f\x12\x1a\n" +
"\x16ZW_ERROR_CODE_INTERNAL\x10\r2\x88\x06\n" +
"\x16ZW_ERROR_CODE_INTERNAL\x10\r2\xf4\a\n" +
"\x0fZwDaemonService\x12X\n" +
"\rGetServerInfo\x12\".zw.daemon.v1.GetServerInfoRequest\x1a#.zw.daemon.v1.GetServerInfoResponse\x12C\n" +
"\x06Create\x12\x1b.zw.daemon.v1.CreateRequest\x1a\x1c.zw.daemon.v1.CreateResponse\x12C\n" +
@@ -1248,7 +1613,10 @@ const file_zw_daemon_v1_daemon_proto_rawDesc = "" +
"\aAddFile\x12\x1c.zw.daemon.v1.AddFileRequest\x1a\x1d.zw.daemon.v1.AddFileResponse(\x01\x12O\n" +
"\n" +
"DeleteFile\x12\x1f.zw.daemon.v1.DeleteFileRequest\x1a .zw.daemon.v1.DeleteFileResponse\x12F\n" +
"\aCompact\x12\x1c.zw.daemon.v1.CompactRequest\x1a\x1d.zw.daemon.v1.CompactResponseB5Z3git.pablu.de/pablu/zw-go/gen/zwdaemon/v1;zwdaemonv1b\x06proto3"
"\aCompact\x12\x1c.zw.daemon.v1.CompactRequest\x1a\x1d.zw.daemon.v1.CompactResponse\x12I\n" +
"\bMoveFile\x12\x1d.zw.daemon.v1.MoveFileRequest\x1a\x1e.zw.daemon.v1.MoveFileResponse\x12I\n" +
"\bCopyFile\x12\x1d.zw.daemon.v1.CopyFileRequest\x1a\x1e.zw.daemon.v1.CopyFileResponse\x12T\n" +
"\vReplaceFile\x12 .zw.daemon.v1.ReplaceFileRequest\x1a!.zw.daemon.v1.ReplaceFileResponse(\x01B5Z3git.pablu.de/pablu/zw-go/gen/zwdaemon/v1;zwdaemonv1b\x06proto3"
var (
file_zw_daemon_v1_daemon_proto_rawDescOnce sync.Once
@@ -1263,7 +1631,7 @@ func file_zw_daemon_v1_daemon_proto_rawDescGZIP() []byte {
}
var file_zw_daemon_v1_daemon_proto_enumTypes = make([]protoimpl.EnumInfo, 1)
var file_zw_daemon_v1_daemon_proto_msgTypes = make([]protoimpl.MessageInfo, 23)
var file_zw_daemon_v1_daemon_proto_msgTypes = make([]protoimpl.MessageInfo, 30)
var file_zw_daemon_v1_daemon_proto_goTypes = []any{
(ZwErrorCode)(0), // 0: zw.daemon.v1.ZwErrorCode
(*GetServerInfoRequest)(nil), // 1: zw.daemon.v1.GetServerInfoRequest
@@ -1275,50 +1643,64 @@ var file_zw_daemon_v1_daemon_proto_goTypes = []any{
(*CompactRequest)(nil), // 7: zw.daemon.v1.CompactRequest
(*AddFileResponse)(nil), // 8: zw.daemon.v1.AddFileResponse
(*DeleteFileResponse)(nil), // 9: zw.daemon.v1.DeleteFileResponse
(*GetServerInfoResponse)(nil), // 10: zw.daemon.v1.GetServerInfoResponse
(*CreateRequest)(nil), // 11: zw.daemon.v1.CreateRequest
(*UnsealRequest)(nil), // 12: zw.daemon.v1.UnsealRequest
(*ListFilesRequest)(nil), // 13: zw.daemon.v1.ListFilesRequest
(*ListFilesResponse)(nil), // 14: zw.daemon.v1.ListFilesResponse
(*ListedFile)(nil), // 15: zw.daemon.v1.ListedFile
(*GetFileRequest)(nil), // 16: zw.daemon.v1.GetFileRequest
(*GetFileRangeRequest)(nil), // 17: zw.daemon.v1.GetFileRangeRequest
(*GetFileResponse)(nil), // 18: zw.daemon.v1.GetFileResponse
(*GetFileRangeResponse)(nil), // 19: zw.daemon.v1.GetFileRangeResponse
(*AddFileRequest)(nil), // 20: zw.daemon.v1.AddFileRequest
(*AddFileHeader)(nil), // 21: zw.daemon.v1.AddFileHeader
(*DeleteFileRequest)(nil), // 22: zw.daemon.v1.DeleteFileRequest
(*ZwErrorDetail)(nil), // 23: zw.daemon.v1.ZwErrorDetail
(*MoveFileResponse)(nil), // 10: zw.daemon.v1.MoveFileResponse
(*CopyFileResponse)(nil), // 11: zw.daemon.v1.CopyFileResponse
(*ReplaceFileResponse)(nil), // 12: zw.daemon.v1.ReplaceFileResponse
(*GetServerInfoResponse)(nil), // 13: zw.daemon.v1.GetServerInfoResponse
(*CreateRequest)(nil), // 14: zw.daemon.v1.CreateRequest
(*UnsealRequest)(nil), // 15: zw.daemon.v1.UnsealRequest
(*ListFilesRequest)(nil), // 16: zw.daemon.v1.ListFilesRequest
(*ListFilesResponse)(nil), // 17: zw.daemon.v1.ListFilesResponse
(*ListedFile)(nil), // 18: zw.daemon.v1.ListedFile
(*GetFileRequest)(nil), // 19: zw.daemon.v1.GetFileRequest
(*MoveFileRequest)(nil), // 20: zw.daemon.v1.MoveFileRequest
(*CopyFileRequest)(nil), // 21: zw.daemon.v1.CopyFileRequest
(*GetFileRangeRequest)(nil), // 22: zw.daemon.v1.GetFileRangeRequest
(*GetFileResponse)(nil), // 23: zw.daemon.v1.GetFileResponse
(*GetFileRangeResponse)(nil), // 24: zw.daemon.v1.GetFileRangeResponse
(*AddFileRequest)(nil), // 25: zw.daemon.v1.AddFileRequest
(*AddFileHeader)(nil), // 26: zw.daemon.v1.AddFileHeader
(*ReplaceFileRequest)(nil), // 27: zw.daemon.v1.ReplaceFileRequest
(*ReplaceFileHeader)(nil), // 28: zw.daemon.v1.ReplaceFileHeader
(*DeleteFileRequest)(nil), // 29: zw.daemon.v1.DeleteFileRequest
(*ZwErrorDetail)(nil), // 30: zw.daemon.v1.ZwErrorDetail
}
var file_zw_daemon_v1_daemon_proto_depIdxs = []int32{
15, // 0: zw.daemon.v1.ListFilesResponse.files:type_name -> zw.daemon.v1.ListedFile
21, // 1: zw.daemon.v1.AddFileRequest.header:type_name -> zw.daemon.v1.AddFileHeader
0, // 2: zw.daemon.v1.ZwErrorDetail.code:type_name -> zw.daemon.v1.ZwErrorCode
1, // 3: zw.daemon.v1.ZwDaemonService.GetServerInfo:input_type -> zw.daemon.v1.GetServerInfoRequest
11, // 4: zw.daemon.v1.ZwDaemonService.Create:input_type -> zw.daemon.v1.CreateRequest
12, // 5: zw.daemon.v1.ZwDaemonService.Unseal:input_type -> zw.daemon.v1.UnsealRequest
2, // 6: zw.daemon.v1.ZwDaemonService.Seal:input_type -> zw.daemon.v1.SealRequest
13, // 7: zw.daemon.v1.ZwDaemonService.ListFiles:input_type -> zw.daemon.v1.ListFilesRequest
16, // 8: zw.daemon.v1.ZwDaemonService.GetFile:input_type -> zw.daemon.v1.GetFileRequest
17, // 9: zw.daemon.v1.ZwDaemonService.GetFileRange:input_type -> zw.daemon.v1.GetFileRangeRequest
20, // 10: zw.daemon.v1.ZwDaemonService.AddFile:input_type -> zw.daemon.v1.AddFileRequest
22, // 11: zw.daemon.v1.ZwDaemonService.DeleteFile:input_type -> zw.daemon.v1.DeleteFileRequest
7, // 12: zw.daemon.v1.ZwDaemonService.Compact:input_type -> zw.daemon.v1.CompactRequest
10, // 13: zw.daemon.v1.ZwDaemonService.GetServerInfo:output_type -> zw.daemon.v1.GetServerInfoResponse
4, // 14: zw.daemon.v1.ZwDaemonService.Create:output_type -> zw.daemon.v1.CreateResponse
5, // 15: zw.daemon.v1.ZwDaemonService.Unseal:output_type -> zw.daemon.v1.UnsealResponse
3, // 16: zw.daemon.v1.ZwDaemonService.Seal:output_type -> zw.daemon.v1.SealResponse
14, // 17: zw.daemon.v1.ZwDaemonService.ListFiles:output_type -> zw.daemon.v1.ListFilesResponse
18, // 18: zw.daemon.v1.ZwDaemonService.GetFile:output_type -> zw.daemon.v1.GetFileResponse
19, // 19: zw.daemon.v1.ZwDaemonService.GetFileRange:output_type -> zw.daemon.v1.GetFileRangeResponse
8, // 20: zw.daemon.v1.ZwDaemonService.AddFile:output_type -> zw.daemon.v1.AddFileResponse
9, // 21: zw.daemon.v1.ZwDaemonService.DeleteFile:output_type -> zw.daemon.v1.DeleteFileResponse
6, // 22: zw.daemon.v1.ZwDaemonService.Compact:output_type -> zw.daemon.v1.CompactResponse
13, // [13:23] is the sub-list for method output_type
3, // [3:13] is the sub-list for method input_type
3, // [3:3] is the sub-list for extension type_name
3, // [3:3] is the sub-list for extension extendee
0, // [0:3] is the sub-list for field type_name
18, // 0: zw.daemon.v1.ListFilesResponse.files:type_name -> zw.daemon.v1.ListedFile
26, // 1: zw.daemon.v1.AddFileRequest.header:type_name -> zw.daemon.v1.AddFileHeader
28, // 2: zw.daemon.v1.ReplaceFileRequest.header:type_name -> zw.daemon.v1.ReplaceFileHeader
0, // 3: zw.daemon.v1.ZwErrorDetail.code:type_name -> zw.daemon.v1.ZwErrorCode
1, // 4: zw.daemon.v1.ZwDaemonService.GetServerInfo:input_type -> zw.daemon.v1.GetServerInfoRequest
14, // 5: zw.daemon.v1.ZwDaemonService.Create:input_type -> zw.daemon.v1.CreateRequest
15, // 6: zw.daemon.v1.ZwDaemonService.Unseal:input_type -> zw.daemon.v1.UnsealRequest
2, // 7: zw.daemon.v1.ZwDaemonService.Seal:input_type -> zw.daemon.v1.SealRequest
16, // 8: zw.daemon.v1.ZwDaemonService.ListFiles:input_type -> zw.daemon.v1.ListFilesRequest
19, // 9: zw.daemon.v1.ZwDaemonService.GetFile:input_type -> zw.daemon.v1.GetFileRequest
22, // 10: zw.daemon.v1.ZwDaemonService.GetFileRange:input_type -> zw.daemon.v1.GetFileRangeRequest
25, // 11: zw.daemon.v1.ZwDaemonService.AddFile:input_type -> zw.daemon.v1.AddFileRequest
29, // 12: zw.daemon.v1.ZwDaemonService.DeleteFile:input_type -> zw.daemon.v1.DeleteFileRequest
7, // 13: zw.daemon.v1.ZwDaemonService.Compact:input_type -> zw.daemon.v1.CompactRequest
20, // 14: zw.daemon.v1.ZwDaemonService.MoveFile:input_type -> zw.daemon.v1.MoveFileRequest
21, // 15: zw.daemon.v1.ZwDaemonService.CopyFile:input_type -> zw.daemon.v1.CopyFileRequest
27, // 16: zw.daemon.v1.ZwDaemonService.ReplaceFile:input_type -> zw.daemon.v1.ReplaceFileRequest
13, // 17: zw.daemon.v1.ZwDaemonService.GetServerInfo:output_type -> zw.daemon.v1.GetServerInfoResponse
4, // 18: zw.daemon.v1.ZwDaemonService.Create:output_type -> zw.daemon.v1.CreateResponse
5, // 19: zw.daemon.v1.ZwDaemonService.Unseal:output_type -> zw.daemon.v1.UnsealResponse
3, // 20: zw.daemon.v1.ZwDaemonService.Seal:output_type -> zw.daemon.v1.SealResponse
17, // 21: zw.daemon.v1.ZwDaemonService.ListFiles:output_type -> zw.daemon.v1.ListFilesResponse
23, // 22: zw.daemon.v1.ZwDaemonService.GetFile:output_type -> zw.daemon.v1.GetFileResponse
24, // 23: zw.daemon.v1.ZwDaemonService.GetFileRange:output_type -> zw.daemon.v1.GetFileRangeResponse
8, // 24: zw.daemon.v1.ZwDaemonService.AddFile:output_type -> zw.daemon.v1.AddFileResponse
9, // 25: zw.daemon.v1.ZwDaemonService.DeleteFile:output_type -> zw.daemon.v1.DeleteFileResponse
6, // 26: zw.daemon.v1.ZwDaemonService.Compact:output_type -> zw.daemon.v1.CompactResponse
10, // 27: zw.daemon.v1.ZwDaemonService.MoveFile:output_type -> zw.daemon.v1.MoveFileResponse
11, // 28: zw.daemon.v1.ZwDaemonService.CopyFile:output_type -> zw.daemon.v1.CopyFileResponse
12, // 29: zw.daemon.v1.ZwDaemonService.ReplaceFile:output_type -> zw.daemon.v1.ReplaceFileResponse
17, // [17:30] is the sub-list for method output_type
4, // [4:17] is the sub-list for method input_type
4, // [4:4] is the sub-list for extension type_name
4, // [4:4] is the sub-list for extension extendee
0, // [0:4] is the sub-list for field type_name
}
func init() { file_zw_daemon_v1_daemon_proto_init() }
@@ -1326,18 +1708,22 @@ func file_zw_daemon_v1_daemon_proto_init() {
if File_zw_daemon_v1_daemon_proto != nil {
return
}
file_zw_daemon_v1_daemon_proto_msgTypes[12].OneofWrappers = []any{}
file_zw_daemon_v1_daemon_proto_msgTypes[19].OneofWrappers = []any{
file_zw_daemon_v1_daemon_proto_msgTypes[15].OneofWrappers = []any{}
file_zw_daemon_v1_daemon_proto_msgTypes[24].OneofWrappers = []any{
(*AddFileRequest_Header)(nil),
(*AddFileRequest_Chunk)(nil),
}
file_zw_daemon_v1_daemon_proto_msgTypes[26].OneofWrappers = []any{
(*ReplaceFileRequest_Header)(nil),
(*ReplaceFileRequest_Chunk)(nil),
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: unsafe.Slice(unsafe.StringData(file_zw_daemon_v1_daemon_proto_rawDesc), len(file_zw_daemon_v1_daemon_proto_rawDesc)),
NumEnums: 1,
NumMessages: 23,
NumMessages: 30,
NumExtensions: 0,
NumServices: 1,
},

View File

@@ -29,6 +29,9 @@ const (
ZwDaemonService_AddFile_FullMethodName = "/zw.daemon.v1.ZwDaemonService/AddFile"
ZwDaemonService_DeleteFile_FullMethodName = "/zw.daemon.v1.ZwDaemonService/DeleteFile"
ZwDaemonService_Compact_FullMethodName = "/zw.daemon.v1.ZwDaemonService/Compact"
ZwDaemonService_MoveFile_FullMethodName = "/zw.daemon.v1.ZwDaemonService/MoveFile"
ZwDaemonService_CopyFile_FullMethodName = "/zw.daemon.v1.ZwDaemonService/CopyFile"
ZwDaemonService_ReplaceFile_FullMethodName = "/zw.daemon.v1.ZwDaemonService/ReplaceFile"
)
// ZwDaemonServiceClient is the client API for ZwDaemonService service.
@@ -45,6 +48,9 @@ type ZwDaemonServiceClient interface {
AddFile(ctx context.Context, opts ...grpc.CallOption) (grpc.ClientStreamingClient[AddFileRequest, AddFileResponse], error)
DeleteFile(ctx context.Context, in *DeleteFileRequest, opts ...grpc.CallOption) (*DeleteFileResponse, error)
Compact(ctx context.Context, in *CompactRequest, opts ...grpc.CallOption) (*CompactResponse, error)
MoveFile(ctx context.Context, in *MoveFileRequest, opts ...grpc.CallOption) (*MoveFileResponse, error)
CopyFile(ctx context.Context, in *CopyFileRequest, opts ...grpc.CallOption) (*CopyFileResponse, error)
ReplaceFile(ctx context.Context, opts ...grpc.CallOption) (grpc.ClientStreamingClient[ReplaceFileRequest, ReplaceFileResponse], error)
}
type zwDaemonServiceClient struct {
@@ -176,6 +182,39 @@ func (c *zwDaemonServiceClient) Compact(ctx context.Context, in *CompactRequest,
return out, nil
}
func (c *zwDaemonServiceClient) MoveFile(ctx context.Context, in *MoveFileRequest, opts ...grpc.CallOption) (*MoveFileResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(MoveFileResponse)
err := c.cc.Invoke(ctx, ZwDaemonService_MoveFile_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *zwDaemonServiceClient) CopyFile(ctx context.Context, in *CopyFileRequest, opts ...grpc.CallOption) (*CopyFileResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(CopyFileResponse)
err := c.cc.Invoke(ctx, ZwDaemonService_CopyFile_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *zwDaemonServiceClient) ReplaceFile(ctx context.Context, opts ...grpc.CallOption) (grpc.ClientStreamingClient[ReplaceFileRequest, ReplaceFileResponse], error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
stream, err := c.cc.NewStream(ctx, &ZwDaemonService_ServiceDesc.Streams[3], ZwDaemonService_ReplaceFile_FullMethodName, cOpts...)
if err != nil {
return nil, err
}
x := &grpc.GenericClientStream[ReplaceFileRequest, ReplaceFileResponse]{ClientStream: stream}
return x, nil
}
// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
type ZwDaemonService_ReplaceFileClient = grpc.ClientStreamingClient[ReplaceFileRequest, ReplaceFileResponse]
// ZwDaemonServiceServer is the server API for ZwDaemonService service.
// All implementations must embed UnimplementedZwDaemonServiceServer
// for forward compatibility.
@@ -190,6 +229,9 @@ type ZwDaemonServiceServer interface {
AddFile(grpc.ClientStreamingServer[AddFileRequest, AddFileResponse]) error
DeleteFile(context.Context, *DeleteFileRequest) (*DeleteFileResponse, error)
Compact(context.Context, *CompactRequest) (*CompactResponse, error)
MoveFile(context.Context, *MoveFileRequest) (*MoveFileResponse, error)
CopyFile(context.Context, *CopyFileRequest) (*CopyFileResponse, error)
ReplaceFile(grpc.ClientStreamingServer[ReplaceFileRequest, ReplaceFileResponse]) error
mustEmbedUnimplementedZwDaemonServiceServer()
}
@@ -230,6 +272,15 @@ func (UnimplementedZwDaemonServiceServer) DeleteFile(context.Context, *DeleteFil
func (UnimplementedZwDaemonServiceServer) Compact(context.Context, *CompactRequest) (*CompactResponse, error) {
return nil, status.Error(codes.Unimplemented, "method Compact not implemented")
}
func (UnimplementedZwDaemonServiceServer) MoveFile(context.Context, *MoveFileRequest) (*MoveFileResponse, error) {
return nil, status.Error(codes.Unimplemented, "method MoveFile not implemented")
}
func (UnimplementedZwDaemonServiceServer) CopyFile(context.Context, *CopyFileRequest) (*CopyFileResponse, error) {
return nil, status.Error(codes.Unimplemented, "method CopyFile not implemented")
}
func (UnimplementedZwDaemonServiceServer) ReplaceFile(grpc.ClientStreamingServer[ReplaceFileRequest, ReplaceFileResponse]) error {
return status.Error(codes.Unimplemented, "method ReplaceFile not implemented")
}
func (UnimplementedZwDaemonServiceServer) mustEmbedUnimplementedZwDaemonServiceServer() {}
func (UnimplementedZwDaemonServiceServer) testEmbeddedByValue() {}
@@ -406,6 +457,49 @@ func _ZwDaemonService_Compact_Handler(srv interface{}, ctx context.Context, dec
return interceptor(ctx, in, info, handler)
}
func _ZwDaemonService_MoveFile_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(MoveFileRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(ZwDaemonServiceServer).MoveFile(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: ZwDaemonService_MoveFile_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(ZwDaemonServiceServer).MoveFile(ctx, req.(*MoveFileRequest))
}
return interceptor(ctx, in, info, handler)
}
func _ZwDaemonService_CopyFile_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(CopyFileRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(ZwDaemonServiceServer).CopyFile(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: ZwDaemonService_CopyFile_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(ZwDaemonServiceServer).CopyFile(ctx, req.(*CopyFileRequest))
}
return interceptor(ctx, in, info, handler)
}
func _ZwDaemonService_ReplaceFile_Handler(srv interface{}, stream grpc.ServerStream) error {
return srv.(ZwDaemonServiceServer).ReplaceFile(&grpc.GenericServerStream[ReplaceFileRequest, ReplaceFileResponse]{ServerStream: stream})
}
// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
type ZwDaemonService_ReplaceFileServer = grpc.ClientStreamingServer[ReplaceFileRequest, ReplaceFileResponse]
// ZwDaemonService_ServiceDesc is the grpc.ServiceDesc for ZwDaemonService service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
@@ -441,6 +535,14 @@ var ZwDaemonService_ServiceDesc = grpc.ServiceDesc{
MethodName: "Compact",
Handler: _ZwDaemonService_Compact_Handler,
},
{
MethodName: "MoveFile",
Handler: _ZwDaemonService_MoveFile_Handler,
},
{
MethodName: "CopyFile",
Handler: _ZwDaemonService_CopyFile_Handler,
},
},
Streams: []grpc.StreamDesc{
{
@@ -458,6 +560,11 @@ var ZwDaemonService_ServiceDesc = grpc.ServiceDesc{
Handler: _ZwDaemonService_AddFile_Handler,
ClientStreams: true,
},
{
StreamName: "ReplaceFile",
Handler: _ZwDaemonService_ReplaceFile_Handler,
ClientStreams: true,
},
},
Metadata: "zw/daemon/v1/daemon.proto",
}