This commit is contained in:
parent
8a11a2f959
commit
9b60784dbb
6 changed files with 279 additions and 44 deletions
2
go.mod
2
go.mod
|
@ -3,7 +3,7 @@ module g.arns.lt/zordsdavini/arns-lt-tree-push-service
|
||||||
go 1.19
|
go 1.19
|
||||||
|
|
||||||
require (
|
require (
|
||||||
g.arns.lt/zordsdavini/zord-tree v0.2.6
|
g.arns.lt/zordsdavini/zord-tree v0.2.7
|
||||||
google.golang.org/grpc v1.48.0
|
google.golang.org/grpc v1.48.0
|
||||||
google.golang.org/protobuf v1.28.1
|
google.golang.org/protobuf v1.28.1
|
||||||
)
|
)
|
||||||
|
|
4
go.sum
4
go.sum
|
@ -2,8 +2,8 @@ cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMT
|
||||||
cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
|
cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
|
||||||
g.arns.lt/zordsdavini/abcex v1.0.0 h1:qQqlZ4DMfethCGK4I6yGaLqMrTzKNIshqpINd1l3t0E=
|
g.arns.lt/zordsdavini/abcex v1.0.0 h1:qQqlZ4DMfethCGK4I6yGaLqMrTzKNIshqpINd1l3t0E=
|
||||||
g.arns.lt/zordsdavini/abcex v1.0.0/go.mod h1:YRcJgts3XZwI+LEkngpfUab3DkUAW387Irpr43hIym8=
|
g.arns.lt/zordsdavini/abcex v1.0.0/go.mod h1:YRcJgts3XZwI+LEkngpfUab3DkUAW387Irpr43hIym8=
|
||||||
g.arns.lt/zordsdavini/zord-tree v0.2.6 h1:utUtk7OTjhWC4Fltnzcn/QB7Kpc0yW9IBuyaYRhi+as=
|
g.arns.lt/zordsdavini/zord-tree v0.2.7 h1:h19O+VmzaXA9E68XWIDTF4VIU4I1TnTd8TPigRCljLQ=
|
||||||
g.arns.lt/zordsdavini/zord-tree v0.2.6/go.mod h1:HG++MTNUD8oQHrkTdVnClm0q82lGumASn4GWJtWQApY=
|
g.arns.lt/zordsdavini/zord-tree v0.2.7/go.mod h1:HG++MTNUD8oQHrkTdVnClm0q82lGumASn4GWJtWQApY=
|
||||||
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
|
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
|
||||||
github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY=
|
github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY=
|
||||||
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
|
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
|
||||||
|
|
30
server.go
30
server.go
|
@ -2,10 +2,13 @@ package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"fmt"
|
||||||
"google.golang.org/grpc"
|
"google.golang.org/grpc"
|
||||||
|
"io"
|
||||||
"log"
|
"log"
|
||||||
"net"
|
"net"
|
||||||
"os"
|
"os"
|
||||||
|
"path"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
|
||||||
zordTree "g.arns.lt/zordsdavini/zord-tree"
|
zordTree "g.arns.lt/zordsdavini/zord-tree"
|
||||||
|
@ -79,6 +82,33 @@ func (TreeManagerServer *server) RebuildTree(ctx context.Context, in *TreeSecret
|
||||||
return &response, nil
|
return &response, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (TreeManagerServer *server) DownloadAttachment(in *AttachmentRequest, responseStream TreeManager_DownloadAttachmentServer) error {
|
||||||
|
file, err := os.Open(path.Clean(fmt.Sprintf("%s/%s/%s", dest, "__a", in.Path)))
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
defer file.Close()
|
||||||
|
|
||||||
|
bufferSize := 64 * 1024
|
||||||
|
buff := make([]byte, bufferSize)
|
||||||
|
for {
|
||||||
|
bytesRead, err := file.Read(buff)
|
||||||
|
if err != nil {
|
||||||
|
if err != io.EOF {
|
||||||
|
log.Println("Error during downloadingAttachment: ", err)
|
||||||
|
}
|
||||||
|
break
|
||||||
|
}
|
||||||
|
resp := &AttachmentResponse{Chunk: buff[:bytesRead]}
|
||||||
|
|
||||||
|
err = responseStream.Send(resp)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
func removeContents(dir string) error {
|
func removeContents(dir string) error {
|
||||||
d, err := os.Open(dir)
|
d, err := os.Open(dir)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
192
tree.pb.go
192
tree.pb.go
|
@ -1,7 +1,7 @@
|
||||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||||
// versions:
|
// versions:
|
||||||
// protoc-gen-go v1.28.0
|
// protoc-gen-go v1.30.0
|
||||||
// protoc v3.21.4
|
// protoc v3.21.12
|
||||||
// source: tree.proto
|
// source: tree.proto
|
||||||
|
|
||||||
package main
|
package main
|
||||||
|
@ -461,6 +461,100 @@ func (x *FileContent) GetContent() string {
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type AttachmentRequest struct {
|
||||||
|
state protoimpl.MessageState
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
|
Path string `protobuf:"bytes,1,opt,name=path,proto3" json:"path,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *AttachmentRequest) Reset() {
|
||||||
|
*x = AttachmentRequest{}
|
||||||
|
if protoimpl.UnsafeEnabled {
|
||||||
|
mi := &file_tree_proto_msgTypes[7]
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *AttachmentRequest) String() string {
|
||||||
|
return protoimpl.X.MessageStringOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*AttachmentRequest) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (x *AttachmentRequest) ProtoReflect() protoreflect.Message {
|
||||||
|
mi := &file_tree_proto_msgTypes[7]
|
||||||
|
if protoimpl.UnsafeEnabled && x != nil {
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
if ms.LoadMessageInfo() == nil {
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
return ms
|
||||||
|
}
|
||||||
|
return mi.MessageOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Deprecated: Use AttachmentRequest.ProtoReflect.Descriptor instead.
|
||||||
|
func (*AttachmentRequest) Descriptor() ([]byte, []int) {
|
||||||
|
return file_tree_proto_rawDescGZIP(), []int{7}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *AttachmentRequest) GetPath() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.Path
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
type AttachmentResponse struct {
|
||||||
|
state protoimpl.MessageState
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
|
Chunk []byte `protobuf:"bytes,1,opt,name=chunk,proto3" json:"chunk,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *AttachmentResponse) Reset() {
|
||||||
|
*x = AttachmentResponse{}
|
||||||
|
if protoimpl.UnsafeEnabled {
|
||||||
|
mi := &file_tree_proto_msgTypes[8]
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *AttachmentResponse) String() string {
|
||||||
|
return protoimpl.X.MessageStringOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*AttachmentResponse) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (x *AttachmentResponse) ProtoReflect() protoreflect.Message {
|
||||||
|
mi := &file_tree_proto_msgTypes[8]
|
||||||
|
if protoimpl.UnsafeEnabled && x != nil {
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
if ms.LoadMessageInfo() == nil {
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
return ms
|
||||||
|
}
|
||||||
|
return mi.MessageOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Deprecated: Use AttachmentResponse.ProtoReflect.Descriptor instead.
|
||||||
|
func (*AttachmentResponse) Descriptor() ([]byte, []int) {
|
||||||
|
return file_tree_proto_rawDescGZIP(), []int{8}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *AttachmentResponse) GetChunk() []byte {
|
||||||
|
if x != nil {
|
||||||
|
return x.Chunk
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
type TreeRequest_Filter struct {
|
type TreeRequest_Filter struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState
|
||||||
sizeCache protoimpl.SizeCache
|
sizeCache protoimpl.SizeCache
|
||||||
|
@ -473,7 +567,7 @@ type TreeRequest_Filter struct {
|
||||||
func (x *TreeRequest_Filter) Reset() {
|
func (x *TreeRequest_Filter) Reset() {
|
||||||
*x = TreeRequest_Filter{}
|
*x = TreeRequest_Filter{}
|
||||||
if protoimpl.UnsafeEnabled {
|
if protoimpl.UnsafeEnabled {
|
||||||
mi := &file_tree_proto_msgTypes[7]
|
mi := &file_tree_proto_msgTypes[9]
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
ms.StoreMessageInfo(mi)
|
ms.StoreMessageInfo(mi)
|
||||||
}
|
}
|
||||||
|
@ -486,7 +580,7 @@ func (x *TreeRequest_Filter) String() string {
|
||||||
func (*TreeRequest_Filter) ProtoMessage() {}
|
func (*TreeRequest_Filter) ProtoMessage() {}
|
||||||
|
|
||||||
func (x *TreeRequest_Filter) ProtoReflect() protoreflect.Message {
|
func (x *TreeRequest_Filter) ProtoReflect() protoreflect.Message {
|
||||||
mi := &file_tree_proto_msgTypes[7]
|
mi := &file_tree_proto_msgTypes[9]
|
||||||
if protoimpl.UnsafeEnabled && x != nil {
|
if protoimpl.UnsafeEnabled && x != nil {
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
if ms.LoadMessageInfo() == nil {
|
if ms.LoadMessageInfo() == nil {
|
||||||
|
@ -576,19 +670,29 @@ var file_tree_proto_rawDesc = []byte{
|
||||||
0x04, 0x66, 0x69, 0x6c, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x6d, 0x61,
|
0x04, 0x66, 0x69, 0x6c, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x6d, 0x61,
|
||||||
0x69, 0x6e, 0x2e, 0x54, 0x72, 0x65, 0x65, 0x46, 0x69, 0x6c, 0x65, 0x52, 0x04, 0x66, 0x69, 0x6c,
|
0x69, 0x6e, 0x2e, 0x54, 0x72, 0x65, 0x65, 0x46, 0x69, 0x6c, 0x65, 0x52, 0x04, 0x66, 0x69, 0x6c,
|
||||||
0x65, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01,
|
0x65, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01,
|
||||||
0x28, 0x09, 0x52, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x32, 0xa9, 0x01, 0x0a, 0x0b,
|
0x28, 0x09, 0x52, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x22, 0x27, 0x0a, 0x11, 0x41,
|
||||||
0x54, 0x72, 0x65, 0x65, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x12, 0x2d, 0x0a, 0x0a, 0x47,
|
0x74, 0x74, 0x61, 0x63, 0x68, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
|
||||||
0x65, 0x74, 0x53, 0x75, 0x6d, 0x6d, 0x65, 0x72, 0x79, 0x12, 0x11, 0x2e, 0x6d, 0x61, 0x69, 0x6e,
|
0x12, 0x12, 0x0a, 0x04, 0x70, 0x61, 0x74, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04,
|
||||||
0x2e, 0x54, 0x72, 0x65, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0a, 0x2e, 0x6d,
|
0x70, 0x61, 0x74, 0x68, 0x22, 0x2a, 0x0a, 0x12, 0x41, 0x74, 0x74, 0x61, 0x63, 0x68, 0x6d, 0x65,
|
||||||
0x61, 0x69, 0x6e, 0x2e, 0x54, 0x72, 0x65, 0x65, 0x22, 0x00, 0x12, 0x31, 0x0a, 0x07, 0x47, 0x65,
|
0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x68,
|
||||||
0x74, 0x46, 0x69, 0x6c, 0x65, 0x12, 0x11, 0x2e, 0x6d, 0x61, 0x69, 0x6e, 0x2e, 0x46, 0x69, 0x6c,
|
0x75, 0x6e, 0x6b, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x63, 0x68, 0x75, 0x6e, 0x6b,
|
||||||
0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x11, 0x2e, 0x6d, 0x61, 0x69, 0x6e, 0x2e,
|
0x32, 0xf6, 0x01, 0x0a, 0x0b, 0x54, 0x72, 0x65, 0x65, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72,
|
||||||
0x46, 0x69, 0x6c, 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x22, 0x00, 0x12, 0x38, 0x0a,
|
0x12, 0x2d, 0x0a, 0x0a, 0x47, 0x65, 0x74, 0x53, 0x75, 0x6d, 0x6d, 0x65, 0x72, 0x79, 0x12, 0x11,
|
||||||
0x0b, 0x52, 0x65, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x54, 0x72, 0x65, 0x65, 0x12, 0x10, 0x2e, 0x6d,
|
0x2e, 0x6d, 0x61, 0x69, 0x6e, 0x2e, 0x54, 0x72, 0x65, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
|
||||||
0x61, 0x69, 0x6e, 0x2e, 0x54, 0x72, 0x65, 0x65, 0x53, 0x65, 0x63, 0x72, 0x65, 0x74, 0x1a, 0x15,
|
0x74, 0x1a, 0x0a, 0x2e, 0x6d, 0x61, 0x69, 0x6e, 0x2e, 0x54, 0x72, 0x65, 0x65, 0x22, 0x00, 0x12,
|
||||||
0x2e, 0x6d, 0x61, 0x69, 0x6e, 0x2e, 0x52, 0x65, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x52, 0x65, 0x73,
|
0x31, 0x0a, 0x07, 0x47, 0x65, 0x74, 0x46, 0x69, 0x6c, 0x65, 0x12, 0x11, 0x2e, 0x6d, 0x61, 0x69,
|
||||||
0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0x03, 0x5a, 0x01, 0x2e, 0x62, 0x06, 0x70, 0x72,
|
0x6e, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x11, 0x2e,
|
||||||
0x6f, 0x74, 0x6f, 0x33,
|
0x6d, 0x61, 0x69, 0x6e, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74,
|
||||||
|
0x22, 0x00, 0x12, 0x38, 0x0a, 0x0b, 0x52, 0x65, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x54, 0x72, 0x65,
|
||||||
|
0x65, 0x12, 0x10, 0x2e, 0x6d, 0x61, 0x69, 0x6e, 0x2e, 0x54, 0x72, 0x65, 0x65, 0x53, 0x65, 0x63,
|
||||||
|
0x72, 0x65, 0x74, 0x1a, 0x15, 0x2e, 0x6d, 0x61, 0x69, 0x6e, 0x2e, 0x52, 0x65, 0x62, 0x75, 0x69,
|
||||||
|
0x6c, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x4b, 0x0a, 0x12,
|
||||||
|
0x44, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x41, 0x74, 0x74, 0x61, 0x63, 0x68, 0x6d, 0x65,
|
||||||
|
0x6e, 0x74, 0x12, 0x17, 0x2e, 0x6d, 0x61, 0x69, 0x6e, 0x2e, 0x41, 0x74, 0x74, 0x61, 0x63, 0x68,
|
||||||
|
0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e, 0x6d, 0x61,
|
||||||
|
0x69, 0x6e, 0x2e, 0x41, 0x74, 0x74, 0x61, 0x63, 0x68, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x73,
|
||||||
|
0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x30, 0x01, 0x42, 0x03, 0x5a, 0x01, 0x2e, 0x62, 0x06,
|
||||||
|
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
@ -603,7 +707,7 @@ func file_tree_proto_rawDescGZIP() []byte {
|
||||||
return file_tree_proto_rawDescData
|
return file_tree_proto_rawDescData
|
||||||
}
|
}
|
||||||
|
|
||||||
var file_tree_proto_msgTypes = make([]protoimpl.MessageInfo, 10)
|
var file_tree_proto_msgTypes = make([]protoimpl.MessageInfo, 12)
|
||||||
var file_tree_proto_goTypes = []interface{}{
|
var file_tree_proto_goTypes = []interface{}{
|
||||||
(*TreeSecret)(nil), // 0: main.TreeSecret
|
(*TreeSecret)(nil), // 0: main.TreeSecret
|
||||||
(*RebuildResponse)(nil), // 1: main.RebuildResponse
|
(*RebuildResponse)(nil), // 1: main.RebuildResponse
|
||||||
|
@ -612,25 +716,29 @@ var file_tree_proto_goTypes = []interface{}{
|
||||||
(*TreeFile)(nil), // 4: main.TreeFile
|
(*TreeFile)(nil), // 4: main.TreeFile
|
||||||
(*Tree)(nil), // 5: main.Tree
|
(*Tree)(nil), // 5: main.Tree
|
||||||
(*FileContent)(nil), // 6: main.FileContent
|
(*FileContent)(nil), // 6: main.FileContent
|
||||||
(*TreeRequest_Filter)(nil), // 7: main.TreeRequest.Filter
|
(*AttachmentRequest)(nil), // 7: main.AttachmentRequest
|
||||||
nil, // 8: main.Tree.TagsEntry
|
(*AttachmentResponse)(nil), // 8: main.AttachmentResponse
|
||||||
nil, // 9: main.Tree.CategoriesEntry
|
(*TreeRequest_Filter)(nil), // 9: main.TreeRequest.Filter
|
||||||
|
nil, // 10: main.Tree.TagsEntry
|
||||||
|
nil, // 11: main.Tree.CategoriesEntry
|
||||||
}
|
}
|
||||||
var file_tree_proto_depIdxs = []int32{
|
var file_tree_proto_depIdxs = []int32{
|
||||||
7, // 0: main.TreeRequest.filter:type_name -> main.TreeRequest.Filter
|
9, // 0: main.TreeRequest.filter:type_name -> main.TreeRequest.Filter
|
||||||
4, // 1: main.Tree.files:type_name -> main.TreeFile
|
4, // 1: main.Tree.files:type_name -> main.TreeFile
|
||||||
4, // 2: main.Tree.rootFiles:type_name -> main.TreeFile
|
4, // 2: main.Tree.rootFiles:type_name -> main.TreeFile
|
||||||
8, // 3: main.Tree.tags:type_name -> main.Tree.TagsEntry
|
10, // 3: main.Tree.tags:type_name -> main.Tree.TagsEntry
|
||||||
9, // 4: main.Tree.categories:type_name -> main.Tree.CategoriesEntry
|
11, // 4: main.Tree.categories:type_name -> main.Tree.CategoriesEntry
|
||||||
4, // 5: main.FileContent.file:type_name -> main.TreeFile
|
4, // 5: main.FileContent.file:type_name -> main.TreeFile
|
||||||
3, // 6: main.TreeManager.GetSummery:input_type -> main.TreeRequest
|
3, // 6: main.TreeManager.GetSummery:input_type -> main.TreeRequest
|
||||||
2, // 7: main.TreeManager.GetFile:input_type -> main.FileRequest
|
2, // 7: main.TreeManager.GetFile:input_type -> main.FileRequest
|
||||||
0, // 8: main.TreeManager.RebuildTree:input_type -> main.TreeSecret
|
0, // 8: main.TreeManager.RebuildTree:input_type -> main.TreeSecret
|
||||||
5, // 9: main.TreeManager.GetSummery:output_type -> main.Tree
|
7, // 9: main.TreeManager.DownloadAttachment:input_type -> main.AttachmentRequest
|
||||||
6, // 10: main.TreeManager.GetFile:output_type -> main.FileContent
|
5, // 10: main.TreeManager.GetSummery:output_type -> main.Tree
|
||||||
1, // 11: main.TreeManager.RebuildTree:output_type -> main.RebuildResponse
|
6, // 11: main.TreeManager.GetFile:output_type -> main.FileContent
|
||||||
9, // [9:12] is the sub-list for method output_type
|
1, // 12: main.TreeManager.RebuildTree:output_type -> main.RebuildResponse
|
||||||
6, // [6:9] is the sub-list for method input_type
|
8, // 13: main.TreeManager.DownloadAttachment:output_type -> main.AttachmentResponse
|
||||||
|
10, // [10:14] is the sub-list for method output_type
|
||||||
|
6, // [6:10] is the sub-list for method input_type
|
||||||
6, // [6:6] is the sub-list for extension type_name
|
6, // [6:6] is the sub-list for extension type_name
|
||||||
6, // [6:6] is the sub-list for extension extendee
|
6, // [6:6] is the sub-list for extension extendee
|
||||||
0, // [0:6] is the sub-list for field type_name
|
0, // [0:6] is the sub-list for field type_name
|
||||||
|
@ -727,6 +835,30 @@ func file_tree_proto_init() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
file_tree_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} {
|
file_tree_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} {
|
||||||
|
switch v := v.(*AttachmentRequest); i {
|
||||||
|
case 0:
|
||||||
|
return &v.state
|
||||||
|
case 1:
|
||||||
|
return &v.sizeCache
|
||||||
|
case 2:
|
||||||
|
return &v.unknownFields
|
||||||
|
default:
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
file_tree_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} {
|
||||||
|
switch v := v.(*AttachmentResponse); i {
|
||||||
|
case 0:
|
||||||
|
return &v.state
|
||||||
|
case 1:
|
||||||
|
return &v.sizeCache
|
||||||
|
case 2:
|
||||||
|
return &v.unknownFields
|
||||||
|
default:
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
file_tree_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} {
|
||||||
switch v := v.(*TreeRequest_Filter); i {
|
switch v := v.(*TreeRequest_Filter); i {
|
||||||
case 0:
|
case 0:
|
||||||
return &v.state
|
return &v.state
|
||||||
|
@ -746,7 +878,7 @@ func file_tree_proto_init() {
|
||||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||||
RawDescriptor: file_tree_proto_rawDesc,
|
RawDescriptor: file_tree_proto_rawDesc,
|
||||||
NumEnums: 0,
|
NumEnums: 0,
|
||||||
NumMessages: 10,
|
NumMessages: 12,
|
||||||
NumExtensions: 0,
|
NumExtensions: 0,
|
||||||
NumServices: 1,
|
NumServices: 1,
|
||||||
},
|
},
|
||||||
|
|
|
@ -11,6 +11,7 @@ service TreeManager {
|
||||||
rpc GetSummery(TreeRequest) returns (Tree) {}
|
rpc GetSummery(TreeRequest) returns (Tree) {}
|
||||||
rpc GetFile(FileRequest) returns (FileContent) {}
|
rpc GetFile(FileRequest) returns (FileContent) {}
|
||||||
rpc RebuildTree(TreeSecret) returns (RebuildResponse) {}
|
rpc RebuildTree(TreeSecret) returns (RebuildResponse) {}
|
||||||
|
rpc DownloadAttachment(AttachmentRequest) returns (stream AttachmentResponse) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
message TreeSecret {
|
message TreeSecret {
|
||||||
|
@ -59,3 +60,11 @@ message FileContent {
|
||||||
TreeFile file = 1;
|
TreeFile file = 1;
|
||||||
string content = 2;
|
string content = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
message AttachmentRequest {
|
||||||
|
string path = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message AttachmentResponse {
|
||||||
|
bytes chunk = 1;
|
||||||
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
|
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
|
||||||
// versions:
|
// versions:
|
||||||
// - protoc-gen-go-grpc v1.2.0
|
// - protoc-gen-go-grpc v1.2.0
|
||||||
// - protoc v3.21.4
|
// - protoc v3.21.12
|
||||||
// source: tree.proto
|
// source: tree.proto
|
||||||
|
|
||||||
package main
|
package main
|
||||||
|
@ -25,6 +25,7 @@ type TreeManagerClient interface {
|
||||||
GetSummery(ctx context.Context, in *TreeRequest, opts ...grpc.CallOption) (*Tree, error)
|
GetSummery(ctx context.Context, in *TreeRequest, opts ...grpc.CallOption) (*Tree, error)
|
||||||
GetFile(ctx context.Context, in *FileRequest, opts ...grpc.CallOption) (*FileContent, error)
|
GetFile(ctx context.Context, in *FileRequest, opts ...grpc.CallOption) (*FileContent, error)
|
||||||
RebuildTree(ctx context.Context, in *TreeSecret, opts ...grpc.CallOption) (*RebuildResponse, error)
|
RebuildTree(ctx context.Context, in *TreeSecret, opts ...grpc.CallOption) (*RebuildResponse, error)
|
||||||
|
DownloadAttachment(ctx context.Context, in *AttachmentRequest, opts ...grpc.CallOption) (TreeManager_DownloadAttachmentClient, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
type treeManagerClient struct {
|
type treeManagerClient struct {
|
||||||
|
@ -62,6 +63,38 @@ func (c *treeManagerClient) RebuildTree(ctx context.Context, in *TreeSecret, opt
|
||||||
return out, nil
|
return out, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *treeManagerClient) DownloadAttachment(ctx context.Context, in *AttachmentRequest, opts ...grpc.CallOption) (TreeManager_DownloadAttachmentClient, error) {
|
||||||
|
stream, err := c.cc.NewStream(ctx, &TreeManager_ServiceDesc.Streams[0], "/main.TreeManager/DownloadAttachment", opts...)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
x := &treeManagerDownloadAttachmentClient{stream}
|
||||||
|
if err := x.ClientStream.SendMsg(in); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if err := x.ClientStream.CloseSend(); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return x, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
type TreeManager_DownloadAttachmentClient interface {
|
||||||
|
Recv() (*AttachmentResponse, error)
|
||||||
|
grpc.ClientStream
|
||||||
|
}
|
||||||
|
|
||||||
|
type treeManagerDownloadAttachmentClient struct {
|
||||||
|
grpc.ClientStream
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *treeManagerDownloadAttachmentClient) Recv() (*AttachmentResponse, error) {
|
||||||
|
m := new(AttachmentResponse)
|
||||||
|
if err := x.ClientStream.RecvMsg(m); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return m, nil
|
||||||
|
}
|
||||||
|
|
||||||
// TreeManagerServer is the server API for TreeManager service.
|
// TreeManagerServer is the server API for TreeManager service.
|
||||||
// All implementations must embed UnimplementedTreeManagerServer
|
// All implementations must embed UnimplementedTreeManagerServer
|
||||||
// for forward compatibility
|
// for forward compatibility
|
||||||
|
@ -69,6 +102,7 @@ type TreeManagerServer interface {
|
||||||
GetSummery(context.Context, *TreeRequest) (*Tree, error)
|
GetSummery(context.Context, *TreeRequest) (*Tree, error)
|
||||||
GetFile(context.Context, *FileRequest) (*FileContent, error)
|
GetFile(context.Context, *FileRequest) (*FileContent, error)
|
||||||
RebuildTree(context.Context, *TreeSecret) (*RebuildResponse, error)
|
RebuildTree(context.Context, *TreeSecret) (*RebuildResponse, error)
|
||||||
|
DownloadAttachment(*AttachmentRequest, TreeManager_DownloadAttachmentServer) error
|
||||||
mustEmbedUnimplementedTreeManagerServer()
|
mustEmbedUnimplementedTreeManagerServer()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -85,6 +119,9 @@ func (UnimplementedTreeManagerServer) GetFile(context.Context, *FileRequest) (*F
|
||||||
func (UnimplementedTreeManagerServer) RebuildTree(context.Context, *TreeSecret) (*RebuildResponse, error) {
|
func (UnimplementedTreeManagerServer) RebuildTree(context.Context, *TreeSecret) (*RebuildResponse, error) {
|
||||||
return nil, status.Errorf(codes.Unimplemented, "method RebuildTree not implemented")
|
return nil, status.Errorf(codes.Unimplemented, "method RebuildTree not implemented")
|
||||||
}
|
}
|
||||||
|
func (UnimplementedTreeManagerServer) DownloadAttachment(*AttachmentRequest, TreeManager_DownloadAttachmentServer) error {
|
||||||
|
return status.Errorf(codes.Unimplemented, "method DownloadAttachment not implemented")
|
||||||
|
}
|
||||||
func (UnimplementedTreeManagerServer) mustEmbedUnimplementedTreeManagerServer() {}
|
func (UnimplementedTreeManagerServer) mustEmbedUnimplementedTreeManagerServer() {}
|
||||||
|
|
||||||
// UnsafeTreeManagerServer may be embedded to opt out of forward compatibility for this service.
|
// UnsafeTreeManagerServer may be embedded to opt out of forward compatibility for this service.
|
||||||
|
@ -152,6 +189,27 @@ func _TreeManager_RebuildTree_Handler(srv interface{}, ctx context.Context, dec
|
||||||
return interceptor(ctx, in, info, handler)
|
return interceptor(ctx, in, info, handler)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func _TreeManager_DownloadAttachment_Handler(srv interface{}, stream grpc.ServerStream) error {
|
||||||
|
m := new(AttachmentRequest)
|
||||||
|
if err := stream.RecvMsg(m); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return srv.(TreeManagerServer).DownloadAttachment(m, &treeManagerDownloadAttachmentServer{stream})
|
||||||
|
}
|
||||||
|
|
||||||
|
type TreeManager_DownloadAttachmentServer interface {
|
||||||
|
Send(*AttachmentResponse) error
|
||||||
|
grpc.ServerStream
|
||||||
|
}
|
||||||
|
|
||||||
|
type treeManagerDownloadAttachmentServer struct {
|
||||||
|
grpc.ServerStream
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *treeManagerDownloadAttachmentServer) Send(m *AttachmentResponse) error {
|
||||||
|
return x.ServerStream.SendMsg(m)
|
||||||
|
}
|
||||||
|
|
||||||
// TreeManager_ServiceDesc is the grpc.ServiceDesc for TreeManager service.
|
// TreeManager_ServiceDesc is the grpc.ServiceDesc for TreeManager service.
|
||||||
// It's only intended for direct use with grpc.RegisterService,
|
// It's only intended for direct use with grpc.RegisterService,
|
||||||
// and not to be introspected or modified (even as a copy)
|
// and not to be introspected or modified (even as a copy)
|
||||||
|
@ -172,6 +230,12 @@ var TreeManager_ServiceDesc = grpc.ServiceDesc{
|
||||||
Handler: _TreeManager_RebuildTree_Handler,
|
Handler: _TreeManager_RebuildTree_Handler,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Streams: []grpc.StreamDesc{},
|
Streams: []grpc.StreamDesc{
|
||||||
|
{
|
||||||
|
StreamName: "DownloadAttachment",
|
||||||
|
Handler: _TreeManager_DownloadAttachment_Handler,
|
||||||
|
ServerStreams: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
Metadata: "tree.proto",
|
Metadata: "tree.proto",
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue