storage

package
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 26, 2021 License: MIT Imports: 17 Imported by: 2

Documentation

Overview

Package storage is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

This section is empty.

Variables

View Source
var File_api_storage_v1_message_proto protoreflect.FileDescriptor
View Source
var File_api_storage_v1_service_proto protoreflect.FileDescriptor
View Source
var StorageService_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "api.storage.v1.StorageService",
	HandlerType: (*StorageServiceServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "Download",
			Handler:    _StorageService_Download_Handler,
		},
		{
			MethodName: "Create",
			Handler:    _StorageService_Create_Handler,
		},
		{
			MethodName: "Delete",
			Handler:    _StorageService_Delete_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "api/storage/v1/service.proto",
}

StorageService_ServiceDesc is the grpc.ServiceDesc for StorageService service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)

Functions

func RegisterStorageServiceHandler

func RegisterStorageServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error

RegisterStorageServiceHandler registers the http handlers for service StorageService to "mux". The handlers forward requests to the grpc endpoint over "conn".

func RegisterStorageServiceHandlerClient

func RegisterStorageServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client StorageServiceClient) error

RegisterStorageServiceHandlerClient registers the http handlers for service StorageService to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "StorageServiceClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "StorageServiceClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "StorageServiceClient" to call the correct interceptors.

func RegisterStorageServiceHandlerFromEndpoint

func RegisterStorageServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)

RegisterStorageServiceHandlerFromEndpoint is same as RegisterStorageServiceHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.

func RegisterStorageServiceHandlerServer

func RegisterStorageServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server StorageServiceServer) error

RegisterStorageServiceHandlerServer registers the http handlers for service StorageService to "mux". UnaryRPC :call StorageServiceServer directly. StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterStorageServiceHandlerFromEndpoint instead.

func RegisterStorageServiceServer

func RegisterStorageServiceServer(s grpc.ServiceRegistrar, srv StorageServiceServer)

Types

type CreateRequest

type CreateRequest struct {
	Filename  string `protobuf:"bytes,1,opt,name=filename,proto3" json:"filename,omitempty"`
	MediaType string `protobuf:"bytes,2,opt,name=media_type,json=mediaType,proto3" json:"media_type,omitempty"`
	Bytes     []byte `protobuf:"bytes,3,opt,name=bytes,proto3" json:"bytes,omitempty"`
	// contains filtered or unexported fields
}

func (*CreateRequest) Descriptor deprecated

func (*CreateRequest) Descriptor() ([]byte, []int)

Deprecated: Use CreateRequest.ProtoReflect.Descriptor instead.

func (*CreateRequest) GetBytes

func (x *CreateRequest) GetBytes() []byte

func (*CreateRequest) GetFilename

func (x *CreateRequest) GetFilename() string

func (*CreateRequest) GetMediaType

func (x *CreateRequest) GetMediaType() string

func (*CreateRequest) ProtoMessage

func (*CreateRequest) ProtoMessage()

func (*CreateRequest) ProtoReflect

func (x *CreateRequest) ProtoReflect() protoreflect.Message

func (*CreateRequest) Reset

func (x *CreateRequest) Reset()

func (*CreateRequest) String

func (x *CreateRequest) String() string

type DeleteRequest

type DeleteRequest struct {
	Filename string `protobuf:"bytes,1,opt,name=filename,proto3" json:"filename,omitempty"`
	// contains filtered or unexported fields
}

func (*DeleteRequest) Descriptor deprecated

func (*DeleteRequest) Descriptor() ([]byte, []int)

Deprecated: Use DeleteRequest.ProtoReflect.Descriptor instead.

func (*DeleteRequest) GetFilename

func (x *DeleteRequest) GetFilename() string

func (*DeleteRequest) ProtoMessage

func (*DeleteRequest) ProtoMessage()

func (*DeleteRequest) ProtoReflect

func (x *DeleteRequest) ProtoReflect() protoreflect.Message

func (*DeleteRequest) Reset

func (x *DeleteRequest) Reset()

func (*DeleteRequest) String

func (x *DeleteRequest) String() string

type DownloadRequest

type DownloadRequest struct {
	Filename string `protobuf:"bytes,1,opt,name=filename,proto3" json:"filename,omitempty"`
	// contains filtered or unexported fields
}

func (*DownloadRequest) Descriptor deprecated

func (*DownloadRequest) Descriptor() ([]byte, []int)

Deprecated: Use DownloadRequest.ProtoReflect.Descriptor instead.

func (*DownloadRequest) GetFilename

func (x *DownloadRequest) GetFilename() string

func (*DownloadRequest) ProtoMessage

func (*DownloadRequest) ProtoMessage()

func (*DownloadRequest) ProtoReflect

func (x *DownloadRequest) ProtoReflect() protoreflect.Message

func (*DownloadRequest) Reset

func (x *DownloadRequest) Reset()

func (*DownloadRequest) String

func (x *DownloadRequest) String() string

type File

type File struct {
	Name      string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	MediaType string `protobuf:"bytes,2,opt,name=media_type,json=mediaType,proto3" json:"media_type,omitempty"`
	// Types that are assignable to Content:
	//	*File_Url
	//	*File_Bytes
	Content isFile_Content `protobuf_oneof:"content"`
	// contains filtered or unexported fields
}

func (*File) Descriptor deprecated

func (*File) Descriptor() ([]byte, []int)

Deprecated: Use File.ProtoReflect.Descriptor instead.

func (*File) GetBytes

func (x *File) GetBytes() []byte

func (*File) GetContent

func (m *File) GetContent() isFile_Content

func (*File) GetMediaType

func (x *File) GetMediaType() string

func (*File) GetName

func (x *File) GetName() string

func (*File) GetUrl

func (x *File) GetUrl() string

func (*File) ProtoMessage

func (*File) ProtoMessage()

func (*File) ProtoReflect

func (x *File) ProtoReflect() protoreflect.Message

func (*File) Reset

func (x *File) Reset()

func (*File) String

func (x *File) String() string

type File_Bytes

type File_Bytes struct {
	Bytes []byte `protobuf:"bytes,4,opt,name=bytes,proto3,oneof"`
}

type File_Url

type File_Url struct {
	Url string `protobuf:"bytes,3,opt,name=url,proto3,oneof"`
}

type StorageServiceClient

type StorageServiceClient interface {
	Download(ctx context.Context, in *DownloadRequest, opts ...grpc.CallOption) (*File, error)
	Create(ctx context.Context, in *CreateRequest, opts ...grpc.CallOption) (*File, error)
	Delete(ctx context.Context, in *DeleteRequest, opts ...grpc.CallOption) (*emptypb.Empty, error)
}

StorageServiceClient is the client API for StorageService service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.

type StorageServiceServer

type StorageServiceServer interface {
	Download(context.Context, *DownloadRequest) (*File, error)
	Create(context.Context, *CreateRequest) (*File, error)
	Delete(context.Context, *DeleteRequest) (*emptypb.Empty, error)
	// contains filtered or unexported methods
}

StorageServiceServer is the server API for StorageService service. All implementations must embed UnimplementedStorageServiceServer for forward compatibility

type UnimplementedStorageServiceServer

type UnimplementedStorageServiceServer struct {
}

UnimplementedStorageServiceServer must be embedded to have forward compatible implementations.

func (UnimplementedStorageServiceServer) Create

func (UnimplementedStorageServiceServer) Delete

func (UnimplementedStorageServiceServer) Download

type UnsafeStorageServiceServer

type UnsafeStorageServiceServer interface {
	// contains filtered or unexported methods
}

UnsafeStorageServiceServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to StorageServiceServer will result in compilation errors.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL