mirror of
https://github.com/kevin-DL/services.git
synced 2026-01-11 19:04:35 +00:00
add save batch endpoint to file service
This commit is contained in:
@@ -75,6 +75,27 @@ func (e *File) Save(ctx context.Context, req *file.SaveRequest, rsp *file.SaveRe
|
|||||||
|
|
||||||
log.Info("Received File.Save request")
|
log.Info("Received File.Save request")
|
||||||
|
|
||||||
|
// prefix the tenant
|
||||||
|
req.File.Id = tenantId + "/" + req.File.Id
|
||||||
|
req.File.Project = tenantId + "/" + req.File.Project
|
||||||
|
|
||||||
|
// create the file
|
||||||
|
err := e.db.Create(req.File)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (e *File) BatchSave(ctx context.Context, req *file.BatchSaveRequest, rsp *file.BatchSaveResponse) error {
|
||||||
|
tenantId, ok := tenant.FromContext(ctx)
|
||||||
|
if !ok {
|
||||||
|
tenantId = "micro"
|
||||||
|
}
|
||||||
|
|
||||||
|
log.Info("Received File.BatchSave request")
|
||||||
|
|
||||||
for _, reqFile := range req.Files {
|
for _, reqFile := range req.Files {
|
||||||
// prefix the tenant
|
// prefix the tenant
|
||||||
reqFile.Id = tenantId + "/" + reqFile.Id
|
reqFile.Id = tenantId + "/" + reqFile.Id
|
||||||
@@ -90,6 +111,7 @@ func (e *File) Save(ctx context.Context, req *file.SaveRequest, rsp *file.SaveRe
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
func (e *File) List(ctx context.Context, req *file.ListRequest, rsp *file.ListResponse) error {
|
func (e *File) List(ctx context.Context, req *file.ListRequest, rsp *file.ListResponse) error {
|
||||||
log.Info("Received File.List request")
|
log.Info("Received File.List request")
|
||||||
|
|
||||||
@@ -116,6 +138,10 @@ func (e *File) List(ctx context.Context, req *file.ListRequest, rsp *file.ListRe
|
|||||||
file.Id = strings.TrimPrefix(file.Id, tenantId+"/")
|
file.Id = strings.TrimPrefix(file.Id, tenantId+"/")
|
||||||
file.Project = strings.TrimPrefix(file.Project, tenantId+"/")
|
file.Project = strings.TrimPrefix(file.Project, tenantId+"/")
|
||||||
|
|
||||||
|
// strip the file contents
|
||||||
|
// no file listing ever contains it
|
||||||
|
file.Data = ""
|
||||||
|
|
||||||
// if requesting all files or path matches
|
// if requesting all files or path matches
|
||||||
if req.Path == "" || strings.HasPrefix(file.Path, req.Path) {
|
if req.Path == "" || strings.HasPrefix(file.Path, req.Path) {
|
||||||
rsp.Files = append(rsp.Files, file)
|
rsp.Files = append(rsp.Files, file)
|
||||||
|
|||||||
@@ -150,6 +150,92 @@ func (x *Record) GetMetadata() map[string]string {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Batch save multiple files in one call
|
||||||
|
type BatchSaveRequest struct {
|
||||||
|
state protoimpl.MessageState
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
|
Files []*Record `protobuf:"bytes,1,rep,name=files,proto3" json:"files,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *BatchSaveRequest) Reset() {
|
||||||
|
*x = BatchSaveRequest{}
|
||||||
|
if protoimpl.UnsafeEnabled {
|
||||||
|
mi := &file_proto_file_proto_msgTypes[1]
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *BatchSaveRequest) String() string {
|
||||||
|
return protoimpl.X.MessageStringOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*BatchSaveRequest) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (x *BatchSaveRequest) ProtoReflect() protoreflect.Message {
|
||||||
|
mi := &file_proto_file_proto_msgTypes[1]
|
||||||
|
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 BatchSaveRequest.ProtoReflect.Descriptor instead.
|
||||||
|
func (*BatchSaveRequest) Descriptor() ([]byte, []int) {
|
||||||
|
return file_proto_file_proto_rawDescGZIP(), []int{1}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *BatchSaveRequest) GetFiles() []*Record {
|
||||||
|
if x != nil {
|
||||||
|
return x.Files
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
type BatchSaveResponse struct {
|
||||||
|
state protoimpl.MessageState
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *BatchSaveResponse) Reset() {
|
||||||
|
*x = BatchSaveResponse{}
|
||||||
|
if protoimpl.UnsafeEnabled {
|
||||||
|
mi := &file_proto_file_proto_msgTypes[2]
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *BatchSaveResponse) String() string {
|
||||||
|
return protoimpl.X.MessageStringOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*BatchSaveResponse) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (x *BatchSaveResponse) ProtoReflect() protoreflect.Message {
|
||||||
|
mi := &file_proto_file_proto_msgTypes[2]
|
||||||
|
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 BatchSaveResponse.ProtoReflect.Descriptor instead.
|
||||||
|
func (*BatchSaveResponse) Descriptor() ([]byte, []int) {
|
||||||
|
return file_proto_file_proto_rawDescGZIP(), []int{2}
|
||||||
|
}
|
||||||
|
|
||||||
// Read a file by path
|
// Read a file by path
|
||||||
type ReadRequest struct {
|
type ReadRequest struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState
|
||||||
@@ -165,7 +251,7 @@ type ReadRequest struct {
|
|||||||
func (x *ReadRequest) Reset() {
|
func (x *ReadRequest) Reset() {
|
||||||
*x = ReadRequest{}
|
*x = ReadRequest{}
|
||||||
if protoimpl.UnsafeEnabled {
|
if protoimpl.UnsafeEnabled {
|
||||||
mi := &file_proto_file_proto_msgTypes[1]
|
mi := &file_proto_file_proto_msgTypes[3]
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
ms.StoreMessageInfo(mi)
|
ms.StoreMessageInfo(mi)
|
||||||
}
|
}
|
||||||
@@ -178,7 +264,7 @@ func (x *ReadRequest) String() string {
|
|||||||
func (*ReadRequest) ProtoMessage() {}
|
func (*ReadRequest) ProtoMessage() {}
|
||||||
|
|
||||||
func (x *ReadRequest) ProtoReflect() protoreflect.Message {
|
func (x *ReadRequest) ProtoReflect() protoreflect.Message {
|
||||||
mi := &file_proto_file_proto_msgTypes[1]
|
mi := &file_proto_file_proto_msgTypes[3]
|
||||||
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 {
|
||||||
@@ -191,7 +277,7 @@ func (x *ReadRequest) ProtoReflect() protoreflect.Message {
|
|||||||
|
|
||||||
// Deprecated: Use ReadRequest.ProtoReflect.Descriptor instead.
|
// Deprecated: Use ReadRequest.ProtoReflect.Descriptor instead.
|
||||||
func (*ReadRequest) Descriptor() ([]byte, []int) {
|
func (*ReadRequest) Descriptor() ([]byte, []int) {
|
||||||
return file_proto_file_proto_rawDescGZIP(), []int{1}
|
return file_proto_file_proto_rawDescGZIP(), []int{3}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *ReadRequest) GetProject() string {
|
func (x *ReadRequest) GetProject() string {
|
||||||
@@ -220,7 +306,7 @@ type ReadResponse struct {
|
|||||||
func (x *ReadResponse) Reset() {
|
func (x *ReadResponse) Reset() {
|
||||||
*x = ReadResponse{}
|
*x = ReadResponse{}
|
||||||
if protoimpl.UnsafeEnabled {
|
if protoimpl.UnsafeEnabled {
|
||||||
mi := &file_proto_file_proto_msgTypes[2]
|
mi := &file_proto_file_proto_msgTypes[4]
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
ms.StoreMessageInfo(mi)
|
ms.StoreMessageInfo(mi)
|
||||||
}
|
}
|
||||||
@@ -233,7 +319,7 @@ func (x *ReadResponse) String() string {
|
|||||||
func (*ReadResponse) ProtoMessage() {}
|
func (*ReadResponse) ProtoMessage() {}
|
||||||
|
|
||||||
func (x *ReadResponse) ProtoReflect() protoreflect.Message {
|
func (x *ReadResponse) ProtoReflect() protoreflect.Message {
|
||||||
mi := &file_proto_file_proto_msgTypes[2]
|
mi := &file_proto_file_proto_msgTypes[4]
|
||||||
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 {
|
||||||
@@ -246,7 +332,7 @@ func (x *ReadResponse) ProtoReflect() protoreflect.Message {
|
|||||||
|
|
||||||
// Deprecated: Use ReadResponse.ProtoReflect.Descriptor instead.
|
// Deprecated: Use ReadResponse.ProtoReflect.Descriptor instead.
|
||||||
func (*ReadResponse) Descriptor() ([]byte, []int) {
|
func (*ReadResponse) Descriptor() ([]byte, []int) {
|
||||||
return file_proto_file_proto_rawDescGZIP(), []int{2}
|
return file_proto_file_proto_rawDescGZIP(), []int{4}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *ReadResponse) GetFile() *Record {
|
func (x *ReadResponse) GetFile() *Record {
|
||||||
@@ -256,19 +342,19 @@ func (x *ReadResponse) GetFile() *Record {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// The save endpoint lets you batch save text file.
|
// Save a file
|
||||||
type SaveRequest struct {
|
type SaveRequest struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState
|
||||||
sizeCache protoimpl.SizeCache
|
sizeCache protoimpl.SizeCache
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
Files []*Record `protobuf:"bytes,1,rep,name=files,proto3" json:"files,omitempty"`
|
File *Record `protobuf:"bytes,1,opt,name=file,proto3" json:"file,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *SaveRequest) Reset() {
|
func (x *SaveRequest) Reset() {
|
||||||
*x = SaveRequest{}
|
*x = SaveRequest{}
|
||||||
if protoimpl.UnsafeEnabled {
|
if protoimpl.UnsafeEnabled {
|
||||||
mi := &file_proto_file_proto_msgTypes[3]
|
mi := &file_proto_file_proto_msgTypes[5]
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
ms.StoreMessageInfo(mi)
|
ms.StoreMessageInfo(mi)
|
||||||
}
|
}
|
||||||
@@ -281,7 +367,7 @@ func (x *SaveRequest) String() string {
|
|||||||
func (*SaveRequest) ProtoMessage() {}
|
func (*SaveRequest) ProtoMessage() {}
|
||||||
|
|
||||||
func (x *SaveRequest) ProtoReflect() protoreflect.Message {
|
func (x *SaveRequest) ProtoReflect() protoreflect.Message {
|
||||||
mi := &file_proto_file_proto_msgTypes[3]
|
mi := &file_proto_file_proto_msgTypes[5]
|
||||||
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 {
|
||||||
@@ -294,12 +380,12 @@ func (x *SaveRequest) ProtoReflect() protoreflect.Message {
|
|||||||
|
|
||||||
// Deprecated: Use SaveRequest.ProtoReflect.Descriptor instead.
|
// Deprecated: Use SaveRequest.ProtoReflect.Descriptor instead.
|
||||||
func (*SaveRequest) Descriptor() ([]byte, []int) {
|
func (*SaveRequest) Descriptor() ([]byte, []int) {
|
||||||
return file_proto_file_proto_rawDescGZIP(), []int{3}
|
return file_proto_file_proto_rawDescGZIP(), []int{5}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *SaveRequest) GetFiles() []*Record {
|
func (x *SaveRequest) GetFile() *Record {
|
||||||
if x != nil {
|
if x != nil {
|
||||||
return x.Files
|
return x.File
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@@ -313,7 +399,7 @@ type SaveResponse struct {
|
|||||||
func (x *SaveResponse) Reset() {
|
func (x *SaveResponse) Reset() {
|
||||||
*x = SaveResponse{}
|
*x = SaveResponse{}
|
||||||
if protoimpl.UnsafeEnabled {
|
if protoimpl.UnsafeEnabled {
|
||||||
mi := &file_proto_file_proto_msgTypes[4]
|
mi := &file_proto_file_proto_msgTypes[6]
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
ms.StoreMessageInfo(mi)
|
ms.StoreMessageInfo(mi)
|
||||||
}
|
}
|
||||||
@@ -326,7 +412,7 @@ func (x *SaveResponse) String() string {
|
|||||||
func (*SaveResponse) ProtoMessage() {}
|
func (*SaveResponse) ProtoMessage() {}
|
||||||
|
|
||||||
func (x *SaveResponse) ProtoReflect() protoreflect.Message {
|
func (x *SaveResponse) ProtoReflect() protoreflect.Message {
|
||||||
mi := &file_proto_file_proto_msgTypes[4]
|
mi := &file_proto_file_proto_msgTypes[6]
|
||||||
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 {
|
||||||
@@ -339,7 +425,7 @@ func (x *SaveResponse) ProtoReflect() protoreflect.Message {
|
|||||||
|
|
||||||
// Deprecated: Use SaveResponse.ProtoReflect.Descriptor instead.
|
// Deprecated: Use SaveResponse.ProtoReflect.Descriptor instead.
|
||||||
func (*SaveResponse) Descriptor() ([]byte, []int) {
|
func (*SaveResponse) Descriptor() ([]byte, []int) {
|
||||||
return file_proto_file_proto_rawDescGZIP(), []int{4}
|
return file_proto_file_proto_rawDescGZIP(), []int{6}
|
||||||
}
|
}
|
||||||
|
|
||||||
// List file by their project and optionally a path.
|
// List file by their project and optionally a path.
|
||||||
@@ -360,7 +446,7 @@ type ListRequest struct {
|
|||||||
func (x *ListRequest) Reset() {
|
func (x *ListRequest) Reset() {
|
||||||
*x = ListRequest{}
|
*x = ListRequest{}
|
||||||
if protoimpl.UnsafeEnabled {
|
if protoimpl.UnsafeEnabled {
|
||||||
mi := &file_proto_file_proto_msgTypes[5]
|
mi := &file_proto_file_proto_msgTypes[7]
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
ms.StoreMessageInfo(mi)
|
ms.StoreMessageInfo(mi)
|
||||||
}
|
}
|
||||||
@@ -373,7 +459,7 @@ func (x *ListRequest) String() string {
|
|||||||
func (*ListRequest) ProtoMessage() {}
|
func (*ListRequest) ProtoMessage() {}
|
||||||
|
|
||||||
func (x *ListRequest) ProtoReflect() protoreflect.Message {
|
func (x *ListRequest) ProtoReflect() protoreflect.Message {
|
||||||
mi := &file_proto_file_proto_msgTypes[5]
|
mi := &file_proto_file_proto_msgTypes[7]
|
||||||
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 {
|
||||||
@@ -386,7 +472,7 @@ func (x *ListRequest) ProtoReflect() protoreflect.Message {
|
|||||||
|
|
||||||
// Deprecated: Use ListRequest.ProtoReflect.Descriptor instead.
|
// Deprecated: Use ListRequest.ProtoReflect.Descriptor instead.
|
||||||
func (*ListRequest) Descriptor() ([]byte, []int) {
|
func (*ListRequest) Descriptor() ([]byte, []int) {
|
||||||
return file_proto_file_proto_rawDescGZIP(), []int{5}
|
return file_proto_file_proto_rawDescGZIP(), []int{7}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *ListRequest) GetProject() string {
|
func (x *ListRequest) GetProject() string {
|
||||||
@@ -414,7 +500,7 @@ type ListResponse struct {
|
|||||||
func (x *ListResponse) Reset() {
|
func (x *ListResponse) Reset() {
|
||||||
*x = ListResponse{}
|
*x = ListResponse{}
|
||||||
if protoimpl.UnsafeEnabled {
|
if protoimpl.UnsafeEnabled {
|
||||||
mi := &file_proto_file_proto_msgTypes[6]
|
mi := &file_proto_file_proto_msgTypes[8]
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
ms.StoreMessageInfo(mi)
|
ms.StoreMessageInfo(mi)
|
||||||
}
|
}
|
||||||
@@ -427,7 +513,7 @@ func (x *ListResponse) String() string {
|
|||||||
func (*ListResponse) ProtoMessage() {}
|
func (*ListResponse) ProtoMessage() {}
|
||||||
|
|
||||||
func (x *ListResponse) ProtoReflect() protoreflect.Message {
|
func (x *ListResponse) ProtoReflect() protoreflect.Message {
|
||||||
mi := &file_proto_file_proto_msgTypes[6]
|
mi := &file_proto_file_proto_msgTypes[8]
|
||||||
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 {
|
||||||
@@ -440,7 +526,7 @@ func (x *ListResponse) ProtoReflect() protoreflect.Message {
|
|||||||
|
|
||||||
// Deprecated: Use ListResponse.ProtoReflect.Descriptor instead.
|
// Deprecated: Use ListResponse.ProtoReflect.Descriptor instead.
|
||||||
func (*ListResponse) Descriptor() ([]byte, []int) {
|
func (*ListResponse) Descriptor() ([]byte, []int) {
|
||||||
return file_proto_file_proto_rawDescGZIP(), []int{6}
|
return file_proto_file_proto_rawDescGZIP(), []int{8}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *ListResponse) GetFiles() []*Record {
|
func (x *ListResponse) GetFiles() []*Record {
|
||||||
@@ -475,37 +561,45 @@ var file_proto_file_proto_rawDesc = []byte{
|
|||||||
0x0a, 0x0d, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12,
|
0x0a, 0x0d, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12,
|
||||||
0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65,
|
0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65,
|
||||||
0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09,
|
0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09,
|
||||||
0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0x3b, 0x0a, 0x0b, 0x52,
|
0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0x36, 0x0a, 0x10, 0x42,
|
||||||
0x65, 0x61, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x70, 0x72,
|
0x61, 0x74, 0x63, 0x68, 0x53, 0x61, 0x76, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12,
|
||||||
0x6f, 0x6a, 0x65, 0x63, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x70, 0x72, 0x6f,
|
0x22, 0x0a, 0x05, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0c,
|
||||||
0x6a, 0x65, 0x63, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x61, 0x74, 0x68, 0x18, 0x02, 0x20, 0x01,
|
0x2e, 0x66, 0x69, 0x6c, 0x65, 0x2e, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x52, 0x05, 0x66, 0x69,
|
||||||
0x28, 0x09, 0x52, 0x04, 0x70, 0x61, 0x74, 0x68, 0x22, 0x30, 0x0a, 0x0c, 0x52, 0x65, 0x61, 0x64,
|
0x6c, 0x65, 0x73, 0x22, 0x13, 0x0a, 0x11, 0x42, 0x61, 0x74, 0x63, 0x68, 0x53, 0x61, 0x76, 0x65,
|
||||||
0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x20, 0x0a, 0x04, 0x66, 0x69, 0x6c, 0x65,
|
0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x3b, 0x0a, 0x0b, 0x52, 0x65, 0x61, 0x64,
|
||||||
0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x66, 0x69, 0x6c, 0x65, 0x2e, 0x52, 0x65,
|
0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x70, 0x72, 0x6f, 0x6a, 0x65,
|
||||||
0x63, 0x6f, 0x72, 0x64, 0x52, 0x04, 0x66, 0x69, 0x6c, 0x65, 0x22, 0x31, 0x0a, 0x0b, 0x53, 0x61,
|
0x63, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63,
|
||||||
0x76, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x22, 0x0a, 0x05, 0x66, 0x69, 0x6c,
|
0x74, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x61, 0x74, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52,
|
||||||
0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x66, 0x69, 0x6c, 0x65, 0x2e,
|
0x04, 0x70, 0x61, 0x74, 0x68, 0x22, 0x30, 0x0a, 0x0c, 0x52, 0x65, 0x61, 0x64, 0x52, 0x65, 0x73,
|
||||||
0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x52, 0x05, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x22, 0x0e, 0x0a,
|
0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x20, 0x0a, 0x04, 0x66, 0x69, 0x6c, 0x65, 0x18, 0x01, 0x20,
|
||||||
0x0c, 0x53, 0x61, 0x76, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x3b, 0x0a,
|
0x01, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x66, 0x69, 0x6c, 0x65, 0x2e, 0x52, 0x65, 0x63, 0x6f, 0x72,
|
||||||
0x0b, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x18, 0x0a, 0x07,
|
0x64, 0x52, 0x04, 0x66, 0x69, 0x6c, 0x65, 0x22, 0x2f, 0x0a, 0x0b, 0x53, 0x61, 0x76, 0x65, 0x52,
|
||||||
0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x70,
|
0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x20, 0x0a, 0x04, 0x66, 0x69, 0x6c, 0x65, 0x18, 0x01,
|
||||||
0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x61, 0x74, 0x68, 0x18, 0x02,
|
0x20, 0x01, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x66, 0x69, 0x6c, 0x65, 0x2e, 0x52, 0x65, 0x63, 0x6f,
|
||||||
0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x70, 0x61, 0x74, 0x68, 0x22, 0x32, 0x0a, 0x0c, 0x4c, 0x69,
|
0x72, 0x64, 0x52, 0x04, 0x66, 0x69, 0x6c, 0x65, 0x22, 0x0e, 0x0a, 0x0c, 0x53, 0x61, 0x76, 0x65,
|
||||||
0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x22, 0x0a, 0x05, 0x66, 0x69,
|
0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x3b, 0x0a, 0x0b, 0x4c, 0x69, 0x73, 0x74,
|
||||||
0x6c, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x66, 0x69, 0x6c, 0x65,
|
0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x70, 0x72, 0x6f, 0x6a, 0x65,
|
||||||
0x2e, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x52, 0x05, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x32, 0x99,
|
0x63, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63,
|
||||||
0x01, 0x0a, 0x04, 0x46, 0x69, 0x6c, 0x65, 0x12, 0x2f, 0x0a, 0x04, 0x52, 0x65, 0x61, 0x64, 0x12,
|
0x74, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x61, 0x74, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52,
|
||||||
0x11, 0x2e, 0x66, 0x69, 0x6c, 0x65, 0x2e, 0x52, 0x65, 0x61, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65,
|
0x04, 0x70, 0x61, 0x74, 0x68, 0x22, 0x32, 0x0a, 0x0c, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73,
|
||||||
0x73, 0x74, 0x1a, 0x12, 0x2e, 0x66, 0x69, 0x6c, 0x65, 0x2e, 0x52, 0x65, 0x61, 0x64, 0x52, 0x65,
|
0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x22, 0x0a, 0x05, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x18, 0x01,
|
||||||
0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x2f, 0x0a, 0x04, 0x53, 0x61, 0x76, 0x65,
|
0x20, 0x03, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x66, 0x69, 0x6c, 0x65, 0x2e, 0x52, 0x65, 0x63, 0x6f,
|
||||||
0x12, 0x11, 0x2e, 0x66, 0x69, 0x6c, 0x65, 0x2e, 0x53, 0x61, 0x76, 0x65, 0x52, 0x65, 0x71, 0x75,
|
0x72, 0x64, 0x52, 0x05, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x32, 0xd9, 0x01, 0x0a, 0x04, 0x46, 0x69,
|
||||||
0x65, 0x73, 0x74, 0x1a, 0x12, 0x2e, 0x66, 0x69, 0x6c, 0x65, 0x2e, 0x53, 0x61, 0x76, 0x65, 0x52,
|
0x6c, 0x65, 0x12, 0x2f, 0x0a, 0x04, 0x52, 0x65, 0x61, 0x64, 0x12, 0x11, 0x2e, 0x66, 0x69, 0x6c,
|
||||||
0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x2f, 0x0a, 0x04, 0x4c, 0x69, 0x73,
|
0x65, 0x2e, 0x52, 0x65, 0x61, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x12, 0x2e,
|
||||||
0x74, 0x12, 0x11, 0x2e, 0x66, 0x69, 0x6c, 0x65, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71,
|
0x66, 0x69, 0x6c, 0x65, 0x2e, 0x52, 0x65, 0x61, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,
|
||||||
0x75, 0x65, 0x73, 0x74, 0x1a, 0x12, 0x2e, 0x66, 0x69, 0x6c, 0x65, 0x2e, 0x4c, 0x69, 0x73, 0x74,
|
0x65, 0x22, 0x00, 0x12, 0x2f, 0x0a, 0x04, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x11, 0x2e, 0x66, 0x69,
|
||||||
0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0x0e, 0x5a, 0x0c, 0x2e, 0x2f,
|
0x6c, 0x65, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x12,
|
||||||
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x3b, 0x66, 0x69, 0x6c, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74,
|
0x2e, 0x66, 0x69, 0x6c, 0x65, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e,
|
||||||
0x6f, 0x33,
|
0x73, 0x65, 0x22, 0x00, 0x12, 0x2f, 0x0a, 0x04, 0x53, 0x61, 0x76, 0x65, 0x12, 0x11, 0x2e, 0x66,
|
||||||
|
0x69, 0x6c, 0x65, 0x2e, 0x53, 0x61, 0x76, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a,
|
||||||
|
0x12, 0x2e, 0x66, 0x69, 0x6c, 0x65, 0x2e, 0x53, 0x61, 0x76, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f,
|
||||||
|
0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x3e, 0x0a, 0x09, 0x42, 0x61, 0x74, 0x63, 0x68, 0x53, 0x61,
|
||||||
|
0x76, 0x65, 0x12, 0x16, 0x2e, 0x66, 0x69, 0x6c, 0x65, 0x2e, 0x42, 0x61, 0x74, 0x63, 0x68, 0x53,
|
||||||
|
0x61, 0x76, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x17, 0x2e, 0x66, 0x69, 0x6c,
|
||||||
|
0x65, 0x2e, 0x42, 0x61, 0x74, 0x63, 0x68, 0x53, 0x61, 0x76, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f,
|
||||||
|
0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0x0e, 0x5a, 0x0c, 0x2e, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f,
|
||||||
|
0x3b, 0x66, 0x69, 0x6c, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@@ -520,33 +614,38 @@ func file_proto_file_proto_rawDescGZIP() []byte {
|
|||||||
return file_proto_file_proto_rawDescData
|
return file_proto_file_proto_rawDescData
|
||||||
}
|
}
|
||||||
|
|
||||||
var file_proto_file_proto_msgTypes = make([]protoimpl.MessageInfo, 8)
|
var file_proto_file_proto_msgTypes = make([]protoimpl.MessageInfo, 10)
|
||||||
var file_proto_file_proto_goTypes = []interface{}{
|
var file_proto_file_proto_goTypes = []interface{}{
|
||||||
(*Record)(nil), // 0: file.Record
|
(*Record)(nil), // 0: file.Record
|
||||||
(*ReadRequest)(nil), // 1: file.ReadRequest
|
(*BatchSaveRequest)(nil), // 1: file.BatchSaveRequest
|
||||||
(*ReadResponse)(nil), // 2: file.ReadResponse
|
(*BatchSaveResponse)(nil), // 2: file.BatchSaveResponse
|
||||||
(*SaveRequest)(nil), // 3: file.SaveRequest
|
(*ReadRequest)(nil), // 3: file.ReadRequest
|
||||||
(*SaveResponse)(nil), // 4: file.SaveResponse
|
(*ReadResponse)(nil), // 4: file.ReadResponse
|
||||||
(*ListRequest)(nil), // 5: file.ListRequest
|
(*SaveRequest)(nil), // 5: file.SaveRequest
|
||||||
(*ListResponse)(nil), // 6: file.ListResponse
|
(*SaveResponse)(nil), // 6: file.SaveResponse
|
||||||
nil, // 7: file.Record.MetadataEntry
|
(*ListRequest)(nil), // 7: file.ListRequest
|
||||||
|
(*ListResponse)(nil), // 8: file.ListResponse
|
||||||
|
nil, // 9: file.Record.MetadataEntry
|
||||||
}
|
}
|
||||||
var file_proto_file_proto_depIdxs = []int32{
|
var file_proto_file_proto_depIdxs = []int32{
|
||||||
7, // 0: file.Record.metadata:type_name -> file.Record.MetadataEntry
|
9, // 0: file.Record.metadata:type_name -> file.Record.MetadataEntry
|
||||||
0, // 1: file.ReadResponse.file:type_name -> file.Record
|
0, // 1: file.BatchSaveRequest.files:type_name -> file.Record
|
||||||
0, // 2: file.SaveRequest.files:type_name -> file.Record
|
0, // 2: file.ReadResponse.file:type_name -> file.Record
|
||||||
0, // 3: file.ListResponse.files:type_name -> file.Record
|
0, // 3: file.SaveRequest.file:type_name -> file.Record
|
||||||
1, // 4: file.File.Read:input_type -> file.ReadRequest
|
0, // 4: file.ListResponse.files:type_name -> file.Record
|
||||||
3, // 5: file.File.Save:input_type -> file.SaveRequest
|
3, // 5: file.File.Read:input_type -> file.ReadRequest
|
||||||
5, // 6: file.File.List:input_type -> file.ListRequest
|
7, // 6: file.File.List:input_type -> file.ListRequest
|
||||||
2, // 7: file.File.Read:output_type -> file.ReadResponse
|
5, // 7: file.File.Save:input_type -> file.SaveRequest
|
||||||
4, // 8: file.File.Save:output_type -> file.SaveResponse
|
1, // 8: file.File.BatchSave:input_type -> file.BatchSaveRequest
|
||||||
6, // 9: file.File.List:output_type -> file.ListResponse
|
4, // 9: file.File.Read:output_type -> file.ReadResponse
|
||||||
7, // [7:10] is the sub-list for method output_type
|
8, // 10: file.File.List:output_type -> file.ListResponse
|
||||||
4, // [4:7] is the sub-list for method input_type
|
6, // 11: file.File.Save:output_type -> file.SaveResponse
|
||||||
4, // [4:4] is the sub-list for extension type_name
|
2, // 12: file.File.BatchSave:output_type -> file.BatchSaveResponse
|
||||||
4, // [4:4] is the sub-list for extension extendee
|
9, // [9:13] is the sub-list for method output_type
|
||||||
0, // [0:4] is the sub-list for field type_name
|
5, // [5:9] is the sub-list for method input_type
|
||||||
|
5, // [5:5] is the sub-list for extension type_name
|
||||||
|
5, // [5:5] is the sub-list for extension extendee
|
||||||
|
0, // [0:5] is the sub-list for field type_name
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() { file_proto_file_proto_init() }
|
func init() { file_proto_file_proto_init() }
|
||||||
@@ -568,7 +667,7 @@ func file_proto_file_proto_init() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
file_proto_file_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
|
file_proto_file_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
|
||||||
switch v := v.(*ReadRequest); i {
|
switch v := v.(*BatchSaveRequest); i {
|
||||||
case 0:
|
case 0:
|
||||||
return &v.state
|
return &v.state
|
||||||
case 1:
|
case 1:
|
||||||
@@ -580,7 +679,7 @@ func file_proto_file_proto_init() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
file_proto_file_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
|
file_proto_file_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
|
||||||
switch v := v.(*ReadResponse); i {
|
switch v := v.(*BatchSaveResponse); i {
|
||||||
case 0:
|
case 0:
|
||||||
return &v.state
|
return &v.state
|
||||||
case 1:
|
case 1:
|
||||||
@@ -592,7 +691,7 @@ func file_proto_file_proto_init() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
file_proto_file_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
|
file_proto_file_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
|
||||||
switch v := v.(*SaveRequest); i {
|
switch v := v.(*ReadRequest); i {
|
||||||
case 0:
|
case 0:
|
||||||
return &v.state
|
return &v.state
|
||||||
case 1:
|
case 1:
|
||||||
@@ -604,7 +703,7 @@ func file_proto_file_proto_init() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
file_proto_file_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
|
file_proto_file_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
|
||||||
switch v := v.(*SaveResponse); i {
|
switch v := v.(*ReadResponse); i {
|
||||||
case 0:
|
case 0:
|
||||||
return &v.state
|
return &v.state
|
||||||
case 1:
|
case 1:
|
||||||
@@ -616,7 +715,7 @@ func file_proto_file_proto_init() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
file_proto_file_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
|
file_proto_file_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
|
||||||
switch v := v.(*ListRequest); i {
|
switch v := v.(*SaveRequest); i {
|
||||||
case 0:
|
case 0:
|
||||||
return &v.state
|
return &v.state
|
||||||
case 1:
|
case 1:
|
||||||
@@ -628,6 +727,30 @@ func file_proto_file_proto_init() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
file_proto_file_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} {
|
file_proto_file_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} {
|
||||||
|
switch v := v.(*SaveResponse); i {
|
||||||
|
case 0:
|
||||||
|
return &v.state
|
||||||
|
case 1:
|
||||||
|
return &v.sizeCache
|
||||||
|
case 2:
|
||||||
|
return &v.unknownFields
|
||||||
|
default:
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
file_proto_file_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} {
|
||||||
|
switch v := v.(*ListRequest); i {
|
||||||
|
case 0:
|
||||||
|
return &v.state
|
||||||
|
case 1:
|
||||||
|
return &v.sizeCache
|
||||||
|
case 2:
|
||||||
|
return &v.unknownFields
|
||||||
|
default:
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
file_proto_file_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} {
|
||||||
switch v := v.(*ListResponse); i {
|
switch v := v.(*ListResponse); i {
|
||||||
case 0:
|
case 0:
|
||||||
return &v.state
|
return &v.state
|
||||||
@@ -646,7 +769,7 @@ func file_proto_file_proto_init() {
|
|||||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||||
RawDescriptor: file_proto_file_proto_rawDesc,
|
RawDescriptor: file_proto_file_proto_rawDesc,
|
||||||
NumEnums: 0,
|
NumEnums: 0,
|
||||||
NumMessages: 8,
|
NumMessages: 10,
|
||||||
NumExtensions: 0,
|
NumExtensions: 0,
|
||||||
NumServices: 1,
|
NumServices: 1,
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -43,8 +43,9 @@ func NewFileEndpoints() []*api.Endpoint {
|
|||||||
|
|
||||||
type FileService interface {
|
type FileService interface {
|
||||||
Read(ctx context.Context, in *ReadRequest, opts ...client.CallOption) (*ReadResponse, error)
|
Read(ctx context.Context, in *ReadRequest, opts ...client.CallOption) (*ReadResponse, error)
|
||||||
Save(ctx context.Context, in *SaveRequest, opts ...client.CallOption) (*SaveResponse, error)
|
|
||||||
List(ctx context.Context, in *ListRequest, opts ...client.CallOption) (*ListResponse, error)
|
List(ctx context.Context, in *ListRequest, opts ...client.CallOption) (*ListResponse, error)
|
||||||
|
Save(ctx context.Context, in *SaveRequest, opts ...client.CallOption) (*SaveResponse, error)
|
||||||
|
BatchSave(ctx context.Context, in *BatchSaveRequest, opts ...client.CallOption) (*BatchSaveResponse, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
type fileService struct {
|
type fileService struct {
|
||||||
@@ -69,6 +70,16 @@ func (c *fileService) Read(ctx context.Context, in *ReadRequest, opts ...client.
|
|||||||
return out, nil
|
return out, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *fileService) List(ctx context.Context, in *ListRequest, opts ...client.CallOption) (*ListResponse, error) {
|
||||||
|
req := c.c.NewRequest(c.name, "File.List", in)
|
||||||
|
out := new(ListResponse)
|
||||||
|
err := c.c.Call(ctx, req, out, opts...)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return out, nil
|
||||||
|
}
|
||||||
|
|
||||||
func (c *fileService) Save(ctx context.Context, in *SaveRequest, opts ...client.CallOption) (*SaveResponse, error) {
|
func (c *fileService) Save(ctx context.Context, in *SaveRequest, opts ...client.CallOption) (*SaveResponse, error) {
|
||||||
req := c.c.NewRequest(c.name, "File.Save", in)
|
req := c.c.NewRequest(c.name, "File.Save", in)
|
||||||
out := new(SaveResponse)
|
out := new(SaveResponse)
|
||||||
@@ -79,9 +90,9 @@ func (c *fileService) Save(ctx context.Context, in *SaveRequest, opts ...client.
|
|||||||
return out, nil
|
return out, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *fileService) List(ctx context.Context, in *ListRequest, opts ...client.CallOption) (*ListResponse, error) {
|
func (c *fileService) BatchSave(ctx context.Context, in *BatchSaveRequest, opts ...client.CallOption) (*BatchSaveResponse, error) {
|
||||||
req := c.c.NewRequest(c.name, "File.List", in)
|
req := c.c.NewRequest(c.name, "File.BatchSave", in)
|
||||||
out := new(ListResponse)
|
out := new(BatchSaveResponse)
|
||||||
err := c.c.Call(ctx, req, out, opts...)
|
err := c.c.Call(ctx, req, out, opts...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@@ -93,15 +104,17 @@ func (c *fileService) List(ctx context.Context, in *ListRequest, opts ...client.
|
|||||||
|
|
||||||
type FileHandler interface {
|
type FileHandler interface {
|
||||||
Read(context.Context, *ReadRequest, *ReadResponse) error
|
Read(context.Context, *ReadRequest, *ReadResponse) error
|
||||||
Save(context.Context, *SaveRequest, *SaveResponse) error
|
|
||||||
List(context.Context, *ListRequest, *ListResponse) error
|
List(context.Context, *ListRequest, *ListResponse) error
|
||||||
|
Save(context.Context, *SaveRequest, *SaveResponse) error
|
||||||
|
BatchSave(context.Context, *BatchSaveRequest, *BatchSaveResponse) error
|
||||||
}
|
}
|
||||||
|
|
||||||
func RegisterFileHandler(s server.Server, hdlr FileHandler, opts ...server.HandlerOption) error {
|
func RegisterFileHandler(s server.Server, hdlr FileHandler, opts ...server.HandlerOption) error {
|
||||||
type file interface {
|
type file interface {
|
||||||
Read(ctx context.Context, in *ReadRequest, out *ReadResponse) error
|
Read(ctx context.Context, in *ReadRequest, out *ReadResponse) error
|
||||||
Save(ctx context.Context, in *SaveRequest, out *SaveResponse) error
|
|
||||||
List(ctx context.Context, in *ListRequest, out *ListResponse) error
|
List(ctx context.Context, in *ListRequest, out *ListResponse) error
|
||||||
|
Save(ctx context.Context, in *SaveRequest, out *SaveResponse) error
|
||||||
|
BatchSave(ctx context.Context, in *BatchSaveRequest, out *BatchSaveResponse) error
|
||||||
}
|
}
|
||||||
type File struct {
|
type File struct {
|
||||||
file
|
file
|
||||||
@@ -118,10 +131,14 @@ func (h *fileHandler) Read(ctx context.Context, in *ReadRequest, out *ReadRespon
|
|||||||
return h.FileHandler.Read(ctx, in, out)
|
return h.FileHandler.Read(ctx, in, out)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (h *fileHandler) List(ctx context.Context, in *ListRequest, out *ListResponse) error {
|
||||||
|
return h.FileHandler.List(ctx, in, out)
|
||||||
|
}
|
||||||
|
|
||||||
func (h *fileHandler) Save(ctx context.Context, in *SaveRequest, out *SaveResponse) error {
|
func (h *fileHandler) Save(ctx context.Context, in *SaveRequest, out *SaveResponse) error {
|
||||||
return h.FileHandler.Save(ctx, in, out)
|
return h.FileHandler.Save(ctx, in, out)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (h *fileHandler) List(ctx context.Context, in *ListRequest, out *ListResponse) error {
|
func (h *fileHandler) BatchSave(ctx context.Context, in *BatchSaveRequest, out *BatchSaveResponse) error {
|
||||||
return h.FileHandler.List(ctx, in, out)
|
return h.FileHandler.BatchSave(ctx, in, out)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,8 +6,9 @@ option go_package = "./proto;file";
|
|||||||
|
|
||||||
service File {
|
service File {
|
||||||
rpc Read(ReadRequest) returns (ReadResponse) {}
|
rpc Read(ReadRequest) returns (ReadResponse) {}
|
||||||
rpc Save(SaveRequest) returns (SaveResponse) {}
|
|
||||||
rpc List(ListRequest) returns (ListResponse) {}
|
rpc List(ListRequest) returns (ListResponse) {}
|
||||||
|
rpc Save(SaveRequest) returns (SaveResponse) {}
|
||||||
|
rpc BatchSave(BatchSaveRequest) returns (BatchSaveResponse) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
message Record {
|
message Record {
|
||||||
@@ -34,6 +35,14 @@ message Record {
|
|||||||
map<string,string> metadata = 10;
|
map<string,string> metadata = 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Batch save multiple files in one call
|
||||||
|
message BatchSaveRequest {
|
||||||
|
repeated Record files = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message BatchSaveResponse {
|
||||||
|
}
|
||||||
|
|
||||||
// Read a file by path
|
// Read a file by path
|
||||||
message ReadRequest {
|
message ReadRequest {
|
||||||
// project name
|
// project name
|
||||||
@@ -47,9 +56,9 @@ message ReadResponse {
|
|||||||
Record file = 1;
|
Record file = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// The save endpoint lets you batch save text file.
|
// Save a file
|
||||||
message SaveRequest {
|
message SaveRequest {
|
||||||
repeated Record files = 1;
|
Record file = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
message SaveResponse {
|
message SaveResponse {
|
||||||
|
|||||||
Reference in New Issue
Block a user