mirror of
https://github.com/kevin-DL/services.git
synced 2026-01-11 19:04:35 +00:00
Rename files service to file service (#115)
This commit is contained in:
2
file/.gitignore
vendored
Normal file
2
file/.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
|
||||||
|
file
|
||||||
3
file/Dockerfile
Normal file
3
file/Dockerfile
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
FROM alpine
|
||||||
|
ADD file /file
|
||||||
|
ENTRYPOINT [ "/file" ]
|
||||||
@@ -8,15 +8,15 @@ init:
|
|||||||
go get github.com/micro/micro/v3/cmd/protoc-gen-openapi
|
go get github.com/micro/micro/v3/cmd/protoc-gen-openapi
|
||||||
.PHONY: proto
|
.PHONY: proto
|
||||||
proto:
|
proto:
|
||||||
protoc --proto_path=. --micro_out=. --go_out=:. proto/files.proto
|
protoc --proto_path=. --micro_out=. --go_out=:. proto/file.proto
|
||||||
|
|
||||||
.PHONY: api
|
.PHONY: api
|
||||||
api:
|
api:
|
||||||
protoc --openapi_out=. --proto_path=. proto/files.proto
|
protoc --openapi_out=. --proto_path=. proto/file.proto
|
||||||
|
|
||||||
.PHONY: build
|
.PHONY: build
|
||||||
build:
|
build:
|
||||||
go build -o files *.go
|
go build -o file *.go
|
||||||
|
|
||||||
.PHONY: test
|
.PHONY: test
|
||||||
test:
|
test:
|
||||||
@@ -24,4 +24,4 @@ test:
|
|||||||
|
|
||||||
.PHONY: docker
|
.PHONY: docker
|
||||||
docker:
|
docker:
|
||||||
docker build . -t files:latest
|
docker build . -t file:latest
|
||||||
5
file/README.md
Normal file
5
file/README.md
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
Store, list and retrieve text file
|
||||||
|
|
||||||
|
# File Service
|
||||||
|
|
||||||
|
Save, list and retrieve text file by project and path.
|
||||||
@@ -8,41 +8,41 @@ import (
|
|||||||
"github.com/micro/micro/v3/service/auth"
|
"github.com/micro/micro/v3/service/auth"
|
||||||
log "github.com/micro/micro/v3/service/logger"
|
log "github.com/micro/micro/v3/service/logger"
|
||||||
"github.com/micro/micro/v3/service/model"
|
"github.com/micro/micro/v3/service/model"
|
||||||
files "github.com/micro/services/files/proto"
|
file "github.com/micro/services/file/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Files struct {
|
type File struct {
|
||||||
db model.Model
|
db model.Model
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewFiles() *Files {
|
func NewFile() *File {
|
||||||
i := model.ByEquality("project")
|
i := model.ByEquality("project")
|
||||||
i.Order.Type = model.OrderTypeUnordered
|
i.Order.Type = model.OrderTypeUnordered
|
||||||
|
|
||||||
db := model.New(
|
db := model.New(
|
||||||
files.File{},
|
file.Record{},
|
||||||
&model.Options{
|
&model.Options{
|
||||||
Key: "Id",
|
Key: "Id",
|
||||||
Indexes: []model.Index{i},
|
Indexes: []model.Index{i},
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
return &Files{
|
return &File{
|
||||||
db: db,
|
db: db,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (e *Files) Save(ctx context.Context, req *files.SaveRequest, rsp *files.SaveResponse) error {
|
func (e *File) Save(ctx context.Context, req *file.SaveRequest, rsp *file.SaveResponse) error {
|
||||||
// @todo return proper micro errors
|
// @todo return proper micro errors
|
||||||
acc, ok := auth.AccountFromContext(ctx)
|
acc, ok := auth.AccountFromContext(ctx)
|
||||||
if !ok {
|
if !ok {
|
||||||
return errors.New("Files.Save requires authentication")
|
return errors.New("File.Save requires authentication")
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Info("Received Files.Save request")
|
log.Info("Received File.Save request")
|
||||||
for _, file := range req.Files {
|
for _, reqFile := range req.Files {
|
||||||
f := files.File{}
|
f := file.Record{}
|
||||||
err := e.db.Read(model.QueryEquals("Id", file.Id), &f)
|
err := e.db.Read(model.QueryEquals("Id", reqFile.Id), &f)
|
||||||
if err != nil && err != model.ErrorNotFound {
|
if err != nil && err != model.ErrorNotFound {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@@ -50,7 +50,7 @@ func (e *Files) Save(ctx context.Context, req *files.SaveRequest, rsp *files.Sav
|
|||||||
if f.Id != "" && f.Owner != acc.ID {
|
if f.Id != "" && f.Owner != acc.ID {
|
||||||
return errors.New("Not authorized")
|
return errors.New("Not authorized")
|
||||||
}
|
}
|
||||||
err = e.db.Create(file)
|
err = e.db.Create(reqFile)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@@ -58,9 +58,9 @@ func (e *Files) Save(ctx context.Context, req *files.SaveRequest, rsp *files.Sav
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (e *Files) List(ctx context.Context, req *files.ListRequest, rsp *files.ListResponse) error {
|
func (e *File) List(ctx context.Context, req *file.ListRequest, rsp *file.ListResponse) error {
|
||||||
log.Info("Received Files.List request")
|
log.Info("Received File.List request")
|
||||||
rsp.Files = []*files.File{}
|
rsp.Files = []*file.Record{}
|
||||||
err := e.db.Read(model.QueryEquals("project", req.GetProject()), &rsp.Files)
|
err := e.db.Read(model.QueryEquals("project", req.GetProject()), &rsp.Files)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@@ -69,7 +69,7 @@ func (e *Files) List(ctx context.Context, req *files.ListRequest, rsp *files.Lis
|
|||||||
// query for the KV store interface, it's not supported by the model
|
// query for the KV store interface, it's not supported by the model
|
||||||
// so we do client side filtering here
|
// so we do client side filtering here
|
||||||
if req.Path != "" {
|
if req.Path != "" {
|
||||||
filtered := []*files.File{}
|
filtered := []*file.Record{}
|
||||||
for _, file := range rsp.Files {
|
for _, file := range rsp.Files {
|
||||||
if strings.HasPrefix(file.Path, req.Path) {
|
if strings.HasPrefix(file.Path, req.Path) {
|
||||||
filtered = append(filtered, file)
|
filtered = append(filtered, file)
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/micro/services/files/handler"
|
"github.com/micro/services/file/handler"
|
||||||
pb "github.com/micro/services/files/proto"
|
pb "github.com/micro/services/file/proto"
|
||||||
|
|
||||||
"github.com/micro/micro/v3/service"
|
"github.com/micro/micro/v3/service"
|
||||||
"github.com/micro/micro/v3/service/logger"
|
"github.com/micro/micro/v3/service/logger"
|
||||||
@@ -11,12 +11,12 @@ import (
|
|||||||
func main() {
|
func main() {
|
||||||
// Create service
|
// Create service
|
||||||
srv := service.New(
|
srv := service.New(
|
||||||
service.Name("files"),
|
service.Name("file"),
|
||||||
service.Version("latest"),
|
service.Version("latest"),
|
||||||
)
|
)
|
||||||
|
|
||||||
// Register handler
|
// Register handler
|
||||||
pb.RegisterFilesHandler(srv.Server(), handler.NewFiles())
|
pb.RegisterFileHandler(srv.Server(), handler.NewFile())
|
||||||
|
|
||||||
// Run service
|
// Run service
|
||||||
if err := srv.Run(); err != nil {
|
if err := srv.Run(); err != nil {
|
||||||
1
file/micro.mu
Normal file
1
file/micro.mu
Normal file
@@ -0,0 +1 @@
|
|||||||
|
service file
|
||||||
@@ -1,13 +1,12 @@
|
|||||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||||
// versions:
|
// versions:
|
||||||
// protoc-gen-go v1.25.0
|
// protoc-gen-go v1.26.0
|
||||||
// protoc v3.15.5
|
// protoc v3.6.1
|
||||||
// source: proto/files.proto
|
// source: proto/file.proto
|
||||||
|
|
||||||
package files
|
package file
|
||||||
|
|
||||||
import (
|
import (
|
||||||
proto "github.com/golang/protobuf/proto"
|
|
||||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||||
reflect "reflect"
|
reflect "reflect"
|
||||||
@@ -21,18 +20,14 @@ const (
|
|||||||
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
||||||
)
|
)
|
||||||
|
|
||||||
// This is a compile-time assertion that a sufficiently up-to-date version
|
type Record struct {
|
||||||
// of the legacy proto package is being used.
|
|
||||||
const _ = proto.ProtoPackageIsVersion4
|
|
||||||
|
|
||||||
type File struct {
|
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState
|
||||||
sizeCache protoimpl.SizeCache
|
sizeCache protoimpl.SizeCache
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
|
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
|
||||||
// A custom string for namespacing purposes
|
// A custom string for namespacing purposes
|
||||||
// eg. files-of-mywebsite.com
|
// eg. file-of-mywebsite.com
|
||||||
Project string `protobuf:"bytes,2,opt,name=project,proto3" json:"project,omitempty"`
|
Project string `protobuf:"bytes,2,opt,name=project,proto3" json:"project,omitempty"`
|
||||||
// Name of folder or file.
|
// Name of folder or file.
|
||||||
Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"`
|
Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"`
|
||||||
@@ -47,23 +42,23 @@ type File struct {
|
|||||||
Owner string `protobuf:"bytes,9,opt,name=owner,proto3" json:"owner,omitempty"`
|
Owner string `protobuf:"bytes,9,opt,name=owner,proto3" json:"owner,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *File) Reset() {
|
func (x *Record) Reset() {
|
||||||
*x = File{}
|
*x = Record{}
|
||||||
if protoimpl.UnsafeEnabled {
|
if protoimpl.UnsafeEnabled {
|
||||||
mi := &file_proto_files_proto_msgTypes[0]
|
mi := &file_proto_file_proto_msgTypes[0]
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
ms.StoreMessageInfo(mi)
|
ms.StoreMessageInfo(mi)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *File) String() string {
|
func (x *Record) String() string {
|
||||||
return protoimpl.X.MessageStringOf(x)
|
return protoimpl.X.MessageStringOf(x)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (*File) ProtoMessage() {}
|
func (*Record) ProtoMessage() {}
|
||||||
|
|
||||||
func (x *File) ProtoReflect() protoreflect.Message {
|
func (x *Record) ProtoReflect() protoreflect.Message {
|
||||||
mi := &file_proto_files_proto_msgTypes[0]
|
mi := &file_proto_file_proto_msgTypes[0]
|
||||||
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 {
|
||||||
@@ -74,87 +69,87 @@ func (x *File) ProtoReflect() protoreflect.Message {
|
|||||||
return mi.MessageOf(x)
|
return mi.MessageOf(x)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Deprecated: Use File.ProtoReflect.Descriptor instead.
|
// Deprecated: Use Record.ProtoReflect.Descriptor instead.
|
||||||
func (*File) Descriptor() ([]byte, []int) {
|
func (*Record) Descriptor() ([]byte, []int) {
|
||||||
return file_proto_files_proto_rawDescGZIP(), []int{0}
|
return file_proto_file_proto_rawDescGZIP(), []int{0}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *File) GetId() string {
|
func (x *Record) GetId() string {
|
||||||
if x != nil {
|
if x != nil {
|
||||||
return x.Id
|
return x.Id
|
||||||
}
|
}
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *File) GetProject() string {
|
func (x *Record) GetProject() string {
|
||||||
if x != nil {
|
if x != nil {
|
||||||
return x.Project
|
return x.Project
|
||||||
}
|
}
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *File) GetName() string {
|
func (x *Record) GetName() string {
|
||||||
if x != nil {
|
if x != nil {
|
||||||
return x.Name
|
return x.Name
|
||||||
}
|
}
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *File) GetPath() string {
|
func (x *Record) GetPath() string {
|
||||||
if x != nil {
|
if x != nil {
|
||||||
return x.Path
|
return x.Path
|
||||||
}
|
}
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *File) GetIsDirectory() bool {
|
func (x *Record) GetIsDirectory() bool {
|
||||||
if x != nil {
|
if x != nil {
|
||||||
return x.IsDirectory
|
return x.IsDirectory
|
||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *File) GetFileContents() string {
|
func (x *Record) GetFileContents() string {
|
||||||
if x != nil {
|
if x != nil {
|
||||||
return x.FileContents
|
return x.FileContents
|
||||||
}
|
}
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *File) GetCreated() int64 {
|
func (x *Record) GetCreated() int64 {
|
||||||
if x != nil {
|
if x != nil {
|
||||||
return x.Created
|
return x.Created
|
||||||
}
|
}
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *File) GetUpdated() int64 {
|
func (x *Record) GetUpdated() int64 {
|
||||||
if x != nil {
|
if x != nil {
|
||||||
return x.Updated
|
return x.Updated
|
||||||
}
|
}
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *File) GetOwner() string {
|
func (x *Record) GetOwner() string {
|
||||||
if x != nil {
|
if x != nil {
|
||||||
return x.Owner
|
return x.Owner
|
||||||
}
|
}
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
// The save endpoint lets you batch save text files.
|
// The save endpoint lets you batch save text 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 []*File `protobuf:"bytes,1,rep,name=files,proto3" json:"files,omitempty"`
|
Files []*Record `protobuf:"bytes,1,rep,name=files,proto3" json:"files,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *SaveRequest) Reset() {
|
func (x *SaveRequest) Reset() {
|
||||||
*x = SaveRequest{}
|
*x = SaveRequest{}
|
||||||
if protoimpl.UnsafeEnabled {
|
if protoimpl.UnsafeEnabled {
|
||||||
mi := &file_proto_files_proto_msgTypes[1]
|
mi := &file_proto_file_proto_msgTypes[1]
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
ms.StoreMessageInfo(mi)
|
ms.StoreMessageInfo(mi)
|
||||||
}
|
}
|
||||||
@@ -167,7 +162,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_files_proto_msgTypes[1]
|
mi := &file_proto_file_proto_msgTypes[1]
|
||||||
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 {
|
||||||
@@ -180,10 +175,10 @@ 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_files_proto_rawDescGZIP(), []int{1}
|
return file_proto_file_proto_rawDescGZIP(), []int{1}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *SaveRequest) GetFiles() []*File {
|
func (x *SaveRequest) GetFiles() []*Record {
|
||||||
if x != nil {
|
if x != nil {
|
||||||
return x.Files
|
return x.Files
|
||||||
}
|
}
|
||||||
@@ -199,7 +194,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_files_proto_msgTypes[2]
|
mi := &file_proto_file_proto_msgTypes[2]
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
ms.StoreMessageInfo(mi)
|
ms.StoreMessageInfo(mi)
|
||||||
}
|
}
|
||||||
@@ -212,7 +207,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_files_proto_msgTypes[2]
|
mi := &file_proto_file_proto_msgTypes[2]
|
||||||
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 {
|
||||||
@@ -225,10 +220,10 @@ 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_files_proto_rawDescGZIP(), []int{2}
|
return file_proto_file_proto_rawDescGZIP(), []int{2}
|
||||||
}
|
}
|
||||||
|
|
||||||
// List files by their project and optionally a path.
|
// List file by their project and optionally a path.
|
||||||
type ListRequest struct {
|
type ListRequest struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState
|
||||||
sizeCache protoimpl.SizeCache
|
sizeCache protoimpl.SizeCache
|
||||||
@@ -238,7 +233,7 @@ type ListRequest struct {
|
|||||||
Project string `protobuf:"bytes,1,opt,name=project,proto3" json:"project,omitempty"`
|
Project string `protobuf:"bytes,1,opt,name=project,proto3" json:"project,omitempty"`
|
||||||
// Defaults to '/', ie. lists all files in a project.
|
// Defaults to '/', ie. lists all files in a project.
|
||||||
// Supply path if of a folder if you want to list
|
// Supply path if of a folder if you want to list
|
||||||
// file inside that folder
|
// files inside that folder
|
||||||
// eg. '/docs'
|
// eg. '/docs'
|
||||||
Path string `protobuf:"bytes,2,opt,name=path,proto3" json:"path,omitempty"`
|
Path string `protobuf:"bytes,2,opt,name=path,proto3" json:"path,omitempty"`
|
||||||
}
|
}
|
||||||
@@ -246,7 +241,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_files_proto_msgTypes[3]
|
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)
|
||||||
}
|
}
|
||||||
@@ -259,7 +254,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_files_proto_msgTypes[3]
|
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 {
|
||||||
@@ -272,7 +267,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_files_proto_rawDescGZIP(), []int{3}
|
return file_proto_file_proto_rawDescGZIP(), []int{3}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *ListRequest) GetProject() string {
|
func (x *ListRequest) GetProject() string {
|
||||||
@@ -294,13 +289,13 @@ type ListResponse struct {
|
|||||||
sizeCache protoimpl.SizeCache
|
sizeCache protoimpl.SizeCache
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
Files []*File `protobuf:"bytes,1,rep,name=files,proto3" json:"files,omitempty"`
|
Files []*Record `protobuf:"bytes,1,rep,name=files,proto3" json:"files,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *ListResponse) Reset() {
|
func (x *ListResponse) Reset() {
|
||||||
*x = ListResponse{}
|
*x = ListResponse{}
|
||||||
if protoimpl.UnsafeEnabled {
|
if protoimpl.UnsafeEnabled {
|
||||||
mi := &file_proto_files_proto_msgTypes[4]
|
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)
|
||||||
}
|
}
|
||||||
@@ -313,7 +308,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_files_proto_msgTypes[4]
|
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 {
|
||||||
@@ -326,22 +321,22 @@ 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_files_proto_rawDescGZIP(), []int{4}
|
return file_proto_file_proto_rawDescGZIP(), []int{4}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *ListResponse) GetFiles() []*File {
|
func (x *ListResponse) GetFiles() []*Record {
|
||||||
if x != nil {
|
if x != nil {
|
||||||
return x.Files
|
return x.Files
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
var File_proto_files_proto protoreflect.FileDescriptor
|
var File_proto_file_proto protoreflect.FileDescriptor
|
||||||
|
|
||||||
var file_proto_files_proto_rawDesc = []byte{
|
var file_proto_file_proto_rawDesc = []byte{
|
||||||
0x0a, 0x11, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x2e, 0x70, 0x72,
|
0x0a, 0x10, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x66, 0x69, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f,
|
||||||
0x6f, 0x74, 0x6f, 0x12, 0x05, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x22, 0xea, 0x01, 0x0a, 0x04, 0x46,
|
0x74, 0x6f, 0x12, 0x04, 0x66, 0x69, 0x6c, 0x65, 0x22, 0xec, 0x01, 0x0a, 0x06, 0x52, 0x65, 0x63,
|
||||||
0x69, 0x6c, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52,
|
0x6f, 0x72, 0x64, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52,
|
||||||
0x02, 0x69, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x18, 0x02,
|
0x02, 0x69, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x18, 0x02,
|
||||||
0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x12, 0x12, 0x0a,
|
0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x12, 0x12, 0x0a,
|
||||||
0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d,
|
0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d,
|
||||||
@@ -355,55 +350,55 @@ var file_proto_files_proto_rawDesc = []byte{
|
|||||||
0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x75, 0x70, 0x64, 0x61, 0x74,
|
0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x75, 0x70, 0x64, 0x61, 0x74,
|
||||||
0x65, 0x64, 0x18, 0x08, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65,
|
0x65, 0x64, 0x18, 0x08, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65,
|
||||||
0x64, 0x12, 0x14, 0x0a, 0x05, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09,
|
0x64, 0x12, 0x14, 0x0a, 0x05, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09,
|
||||||
0x52, 0x05, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x22, 0x30, 0x0a, 0x0b, 0x53, 0x61, 0x76, 0x65, 0x52,
|
0x52, 0x05, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x22, 0x31, 0x0a, 0x0b, 0x53, 0x61, 0x76, 0x65, 0x52,
|
||||||
0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x21, 0x0a, 0x05, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x18,
|
0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x22, 0x0a, 0x05, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x18,
|
||||||
0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x2e, 0x46, 0x69,
|
0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x66, 0x69, 0x6c, 0x65, 0x2e, 0x52, 0x65, 0x63,
|
||||||
0x6c, 0x65, 0x52, 0x05, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x22, 0x0e, 0x0a, 0x0c, 0x53, 0x61, 0x76,
|
0x6f, 0x72, 0x64, 0x52, 0x05, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x22, 0x0e, 0x0a, 0x0c, 0x53, 0x61,
|
||||||
0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x3b, 0x0a, 0x0b, 0x4c, 0x69, 0x73,
|
0x76, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x3b, 0x0a, 0x0b, 0x4c, 0x69,
|
||||||
0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x70, 0x72, 0x6f, 0x6a,
|
0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x70, 0x72, 0x6f,
|
||||||
0x65, 0x63, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x70, 0x72, 0x6f, 0x6a, 0x65,
|
0x6a, 0x65, 0x63, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x70, 0x72, 0x6f, 0x6a,
|
||||||
0x63, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x61, 0x74, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09,
|
0x65, 0x63, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x61, 0x74, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28,
|
||||||
0x52, 0x04, 0x70, 0x61, 0x74, 0x68, 0x22, 0x31, 0x0a, 0x0c, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65,
|
0x09, 0x52, 0x04, 0x70, 0x61, 0x74, 0x68, 0x22, 0x32, 0x0a, 0x0c, 0x4c, 0x69, 0x73, 0x74, 0x52,
|
||||||
0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x21, 0x0a, 0x05, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x18,
|
0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x22, 0x0a, 0x05, 0x66, 0x69, 0x6c, 0x65, 0x73,
|
||||||
0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x2e, 0x46, 0x69,
|
0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x66, 0x69, 0x6c, 0x65, 0x2e, 0x52, 0x65,
|
||||||
0x6c, 0x65, 0x52, 0x05, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x32, 0x6d, 0x0a, 0x05, 0x46, 0x69, 0x6c,
|
0x63, 0x6f, 0x72, 0x64, 0x52, 0x05, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x32, 0x68, 0x0a, 0x04, 0x46,
|
||||||
0x65, 0x73, 0x12, 0x31, 0x0a, 0x04, 0x53, 0x61, 0x76, 0x65, 0x12, 0x12, 0x2e, 0x66, 0x69, 0x6c,
|
0x69, 0x6c, 0x65, 0x12, 0x2f, 0x0a, 0x04, 0x53, 0x61, 0x76, 0x65, 0x12, 0x11, 0x2e, 0x66, 0x69,
|
||||||
0x65, 0x73, 0x2e, 0x53, 0x61, 0x76, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x13,
|
0x6c, 0x65, 0x2e, 0x53, 0x61, 0x76, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x12,
|
||||||
0x2e, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x2e, 0x53, 0x61, 0x76, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f,
|
0x2e, 0x66, 0x69, 0x6c, 0x65, 0x2e, 0x53, 0x61, 0x76, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e,
|
||||||
0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x31, 0x0a, 0x04, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x12, 0x2e,
|
0x73, 0x65, 0x22, 0x00, 0x12, 0x2f, 0x0a, 0x04, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x11, 0x2e, 0x66,
|
||||||
0x66, 0x69, 0x6c, 0x65, 0x73, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
|
0x69, 0x6c, 0x65, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a,
|
||||||
0x74, 0x1a, 0x13, 0x2e, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65,
|
0x12, 0x2e, 0x66, 0x69, 0x6c, 0x65, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f,
|
||||||
0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0x0d, 0x5a, 0x0b, 0x70, 0x72, 0x6f, 0x74,
|
0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0x0e, 0x5a, 0x0c, 0x2e, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f,
|
||||||
0x6f, 0x3b, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
0x3b, 0x66, 0x69, 0x6c, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
file_proto_files_proto_rawDescOnce sync.Once
|
file_proto_file_proto_rawDescOnce sync.Once
|
||||||
file_proto_files_proto_rawDescData = file_proto_files_proto_rawDesc
|
file_proto_file_proto_rawDescData = file_proto_file_proto_rawDesc
|
||||||
)
|
)
|
||||||
|
|
||||||
func file_proto_files_proto_rawDescGZIP() []byte {
|
func file_proto_file_proto_rawDescGZIP() []byte {
|
||||||
file_proto_files_proto_rawDescOnce.Do(func() {
|
file_proto_file_proto_rawDescOnce.Do(func() {
|
||||||
file_proto_files_proto_rawDescData = protoimpl.X.CompressGZIP(file_proto_files_proto_rawDescData)
|
file_proto_file_proto_rawDescData = protoimpl.X.CompressGZIP(file_proto_file_proto_rawDescData)
|
||||||
})
|
})
|
||||||
return file_proto_files_proto_rawDescData
|
return file_proto_file_proto_rawDescData
|
||||||
}
|
}
|
||||||
|
|
||||||
var file_proto_files_proto_msgTypes = make([]protoimpl.MessageInfo, 5)
|
var file_proto_file_proto_msgTypes = make([]protoimpl.MessageInfo, 5)
|
||||||
var file_proto_files_proto_goTypes = []interface{}{
|
var file_proto_file_proto_goTypes = []interface{}{
|
||||||
(*File)(nil), // 0: files.File
|
(*Record)(nil), // 0: file.Record
|
||||||
(*SaveRequest)(nil), // 1: files.SaveRequest
|
(*SaveRequest)(nil), // 1: file.SaveRequest
|
||||||
(*SaveResponse)(nil), // 2: files.SaveResponse
|
(*SaveResponse)(nil), // 2: file.SaveResponse
|
||||||
(*ListRequest)(nil), // 3: files.ListRequest
|
(*ListRequest)(nil), // 3: file.ListRequest
|
||||||
(*ListResponse)(nil), // 4: files.ListResponse
|
(*ListResponse)(nil), // 4: file.ListResponse
|
||||||
}
|
}
|
||||||
var file_proto_files_proto_depIdxs = []int32{
|
var file_proto_file_proto_depIdxs = []int32{
|
||||||
0, // 0: files.SaveRequest.files:type_name -> files.File
|
0, // 0: file.SaveRequest.files:type_name -> file.Record
|
||||||
0, // 1: files.ListResponse.files:type_name -> files.File
|
0, // 1: file.ListResponse.files:type_name -> file.Record
|
||||||
1, // 2: files.Files.Save:input_type -> files.SaveRequest
|
1, // 2: file.File.Save:input_type -> file.SaveRequest
|
||||||
3, // 3: files.Files.List:input_type -> files.ListRequest
|
3, // 3: file.File.List:input_type -> file.ListRequest
|
||||||
2, // 4: files.Files.Save:output_type -> files.SaveResponse
|
2, // 4: file.File.Save:output_type -> file.SaveResponse
|
||||||
4, // 5: files.Files.List:output_type -> files.ListResponse
|
4, // 5: file.File.List:output_type -> file.ListResponse
|
||||||
4, // [4:6] is the sub-list for method output_type
|
4, // [4:6] is the sub-list for method output_type
|
||||||
2, // [2:4] is the sub-list for method input_type
|
2, // [2:4] is the sub-list for method input_type
|
||||||
2, // [2:2] is the sub-list for extension type_name
|
2, // [2:2] is the sub-list for extension type_name
|
||||||
@@ -411,14 +406,14 @@ var file_proto_files_proto_depIdxs = []int32{
|
|||||||
0, // [0:2] is the sub-list for field type_name
|
0, // [0:2] is the sub-list for field type_name
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() { file_proto_files_proto_init() }
|
func init() { file_proto_file_proto_init() }
|
||||||
func file_proto_files_proto_init() {
|
func file_proto_file_proto_init() {
|
||||||
if File_proto_files_proto != nil {
|
if File_proto_file_proto != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if !protoimpl.UnsafeEnabled {
|
if !protoimpl.UnsafeEnabled {
|
||||||
file_proto_files_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
|
file_proto_file_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
|
||||||
switch v := v.(*File); i {
|
switch v := v.(*Record); i {
|
||||||
case 0:
|
case 0:
|
||||||
return &v.state
|
return &v.state
|
||||||
case 1:
|
case 1:
|
||||||
@@ -429,7 +424,7 @@ func file_proto_files_proto_init() {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
file_proto_files_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.(*SaveRequest); i {
|
switch v := v.(*SaveRequest); i {
|
||||||
case 0:
|
case 0:
|
||||||
return &v.state
|
return &v.state
|
||||||
@@ -441,7 +436,7 @@ func file_proto_files_proto_init() {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
file_proto_files_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.(*SaveResponse); i {
|
switch v := v.(*SaveResponse); i {
|
||||||
case 0:
|
case 0:
|
||||||
return &v.state
|
return &v.state
|
||||||
@@ -453,7 +448,7 @@ func file_proto_files_proto_init() {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
file_proto_files_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.(*ListRequest); i {
|
switch v := v.(*ListRequest); i {
|
||||||
case 0:
|
case 0:
|
||||||
return &v.state
|
return &v.state
|
||||||
@@ -465,7 +460,7 @@ func file_proto_files_proto_init() {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
file_proto_files_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.(*ListResponse); i {
|
switch v := v.(*ListResponse); i {
|
||||||
case 0:
|
case 0:
|
||||||
return &v.state
|
return &v.state
|
||||||
@@ -482,18 +477,18 @@ func file_proto_files_proto_init() {
|
|||||||
out := protoimpl.TypeBuilder{
|
out := protoimpl.TypeBuilder{
|
||||||
File: protoimpl.DescBuilder{
|
File: protoimpl.DescBuilder{
|
||||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||||
RawDescriptor: file_proto_files_proto_rawDesc,
|
RawDescriptor: file_proto_file_proto_rawDesc,
|
||||||
NumEnums: 0,
|
NumEnums: 0,
|
||||||
NumMessages: 5,
|
NumMessages: 5,
|
||||||
NumExtensions: 0,
|
NumExtensions: 0,
|
||||||
NumServices: 1,
|
NumServices: 1,
|
||||||
},
|
},
|
||||||
GoTypes: file_proto_files_proto_goTypes,
|
GoTypes: file_proto_file_proto_goTypes,
|
||||||
DependencyIndexes: file_proto_files_proto_depIdxs,
|
DependencyIndexes: file_proto_file_proto_depIdxs,
|
||||||
MessageInfos: file_proto_files_proto_msgTypes,
|
MessageInfos: file_proto_file_proto_msgTypes,
|
||||||
}.Build()
|
}.Build()
|
||||||
File_proto_files_proto = out.File
|
File_proto_file_proto = out.File
|
||||||
file_proto_files_proto_rawDesc = nil
|
file_proto_file_proto_rawDesc = nil
|
||||||
file_proto_files_proto_goTypes = nil
|
file_proto_file_proto_goTypes = nil
|
||||||
file_proto_files_proto_depIdxs = nil
|
file_proto_file_proto_depIdxs = nil
|
||||||
}
|
}
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
// Code generated by protoc-gen-micro. DO NOT EDIT.
|
// Code generated by protoc-gen-micro. DO NOT EDIT.
|
||||||
// source: proto/files.proto
|
// source: proto/file.proto
|
||||||
|
|
||||||
package files
|
package file
|
||||||
|
|
||||||
import (
|
import (
|
||||||
fmt "fmt"
|
fmt "fmt"
|
||||||
@@ -33,33 +33,33 @@ var _ context.Context
|
|||||||
var _ client.Option
|
var _ client.Option
|
||||||
var _ server.Option
|
var _ server.Option
|
||||||
|
|
||||||
// Api Endpoints for Files service
|
// Api Endpoints for File service
|
||||||
|
|
||||||
func NewFilesEndpoints() []*api.Endpoint {
|
func NewFileEndpoints() []*api.Endpoint {
|
||||||
return []*api.Endpoint{}
|
return []*api.Endpoint{}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Client API for Files service
|
// Client API for File service
|
||||||
|
|
||||||
type FilesService interface {
|
type FileService interface {
|
||||||
Save(ctx context.Context, in *SaveRequest, opts ...client.CallOption) (*SaveResponse, 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)
|
||||||
}
|
}
|
||||||
|
|
||||||
type filesService struct {
|
type fileService struct {
|
||||||
c client.Client
|
c client.Client
|
||||||
name string
|
name string
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewFilesService(name string, c client.Client) FilesService {
|
func NewFileService(name string, c client.Client) FileService {
|
||||||
return &filesService{
|
return &fileService{
|
||||||
c: c,
|
c: c,
|
||||||
name: name,
|
name: name,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *filesService) 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, "Files.Save", in)
|
req := c.c.NewRequest(c.name, "File.Save", in)
|
||||||
out := new(SaveResponse)
|
out := new(SaveResponse)
|
||||||
err := c.c.Call(ctx, req, out, opts...)
|
err := c.c.Call(ctx, req, out, opts...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -68,8 +68,8 @@ func (c *filesService) Save(ctx context.Context, in *SaveRequest, opts ...client
|
|||||||
return out, nil
|
return out, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *filesService) List(ctx context.Context, in *ListRequest, opts ...client.CallOption) (*ListResponse, error) {
|
func (c *fileService) List(ctx context.Context, in *ListRequest, opts ...client.CallOption) (*ListResponse, error) {
|
||||||
req := c.c.NewRequest(c.name, "Files.List", in)
|
req := c.c.NewRequest(c.name, "File.List", in)
|
||||||
out := new(ListResponse)
|
out := new(ListResponse)
|
||||||
err := c.c.Call(ctx, req, out, opts...)
|
err := c.c.Call(ctx, req, out, opts...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -78,33 +78,33 @@ func (c *filesService) List(ctx context.Context, in *ListRequest, opts ...client
|
|||||||
return out, nil
|
return out, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Server API for Files service
|
// Server API for File service
|
||||||
|
|
||||||
type FilesHandler interface {
|
type FileHandler interface {
|
||||||
Save(context.Context, *SaveRequest, *SaveResponse) error
|
Save(context.Context, *SaveRequest, *SaveResponse) error
|
||||||
List(context.Context, *ListRequest, *ListResponse) error
|
List(context.Context, *ListRequest, *ListResponse) error
|
||||||
}
|
}
|
||||||
|
|
||||||
func RegisterFilesHandler(s server.Server, hdlr FilesHandler, opts ...server.HandlerOption) error {
|
func RegisterFileHandler(s server.Server, hdlr FileHandler, opts ...server.HandlerOption) error {
|
||||||
type files interface {
|
type file interface {
|
||||||
Save(ctx context.Context, in *SaveRequest, out *SaveResponse) 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
|
||||||
}
|
}
|
||||||
type Files struct {
|
type File struct {
|
||||||
files
|
file
|
||||||
}
|
}
|
||||||
h := &filesHandler{hdlr}
|
h := &fileHandler{hdlr}
|
||||||
return s.Handle(s.NewHandler(&Files{h}, opts...))
|
return s.Handle(s.NewHandler(&File{h}, opts...))
|
||||||
}
|
}
|
||||||
|
|
||||||
type filesHandler struct {
|
type fileHandler struct {
|
||||||
FilesHandler
|
FileHandler
|
||||||
}
|
}
|
||||||
|
|
||||||
func (h *filesHandler) Save(ctx context.Context, in *SaveRequest, out *SaveResponse) error {
|
func (h *fileHandler) Save(ctx context.Context, in *SaveRequest, out *SaveResponse) error {
|
||||||
return h.FilesHandler.Save(ctx, in, out)
|
return h.FileHandler.Save(ctx, in, out)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (h *filesHandler) List(ctx context.Context, in *ListRequest, out *ListResponse) error {
|
func (h *fileHandler) List(ctx context.Context, in *ListRequest, out *ListResponse) error {
|
||||||
return h.FilesHandler.List(ctx, in, out)
|
return h.FileHandler.List(ctx, in, out)
|
||||||
}
|
}
|
||||||
@@ -1,18 +1,18 @@
|
|||||||
syntax = "proto3";
|
syntax = "proto3";
|
||||||
|
|
||||||
package files;
|
package file;
|
||||||
|
|
||||||
option go_package = "./proto;files";
|
option go_package = "./proto;file";
|
||||||
|
|
||||||
service Files {
|
service File {
|
||||||
rpc Save(SaveRequest) returns (SaveResponse) {}
|
rpc Save(SaveRequest) returns (SaveResponse) {}
|
||||||
rpc List(ListRequest) returns (ListResponse) {}
|
rpc List(ListRequest) returns (ListResponse) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
message File {
|
message Record {
|
||||||
string id = 1;
|
string id = 1;
|
||||||
// A custom string for namespacing purposes
|
// A custom string for namespacing purposes
|
||||||
// eg. files-of-mywebsite.com
|
// eg. file-of-mywebsite.com
|
||||||
string project = 2;
|
string project = 2;
|
||||||
// Name of folder or file.
|
// Name of folder or file.
|
||||||
string name = 3;
|
string name = 3;
|
||||||
@@ -27,25 +27,25 @@ message File {
|
|||||||
string owner = 9;
|
string owner = 9;
|
||||||
}
|
}
|
||||||
|
|
||||||
// The save endpoint lets you batch save text files.
|
// The save endpoint lets you batch save text file.
|
||||||
message SaveRequest {
|
message SaveRequest {
|
||||||
repeated File files = 1;
|
repeated Record files = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
message SaveResponse {
|
message SaveResponse {
|
||||||
}
|
}
|
||||||
|
|
||||||
// List files by their project and optionally a path.
|
// List file by their project and optionally a path.
|
||||||
message ListRequest {
|
message ListRequest {
|
||||||
// Project, required for listing.
|
// Project, required for listing.
|
||||||
string project = 1;
|
string project = 1;
|
||||||
// Defaults to '/', ie. lists all files in a project.
|
// Defaults to '/', ie. lists all files in a project.
|
||||||
// Supply path if of a folder if you want to list
|
// Supply path if of a folder if you want to list
|
||||||
// file inside that folder
|
// files inside that folder
|
||||||
// eg. '/docs'
|
// eg. '/docs'
|
||||||
string path = 2;
|
string path = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
message ListResponse {
|
message ListResponse {
|
||||||
repeated File files = 1;
|
repeated Record files = 1;
|
||||||
}
|
}
|
||||||
2
files/.gitignore
vendored
2
files/.gitignore
vendored
@@ -1,2 +0,0 @@
|
|||||||
|
|
||||||
files
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
FROM alpine
|
|
||||||
ADD files /files
|
|
||||||
ENTRYPOINT [ "/files" ]
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
Store, list and retrieve text files
|
|
||||||
|
|
||||||
# Files Service
|
|
||||||
|
|
||||||
Save, list and retrieve text files by project and path.
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
service files
|
|
||||||
Reference in New Issue
Block a user