Documentation ¶
Index ¶
- Variables
- func RegisterGuploadServiceServer(s *grpc.Server, srv GuploadServiceServer)
- type Chunk
- func (*Chunk) Descriptor() ([]byte, []int)deprecated
- func (x *Chunk) GetContent() []byte
- func (m *Chunk) GetData() isChunk_Data
- func (x *Chunk) GetInfo() *UploadFileInfo
- func (*Chunk) ProtoMessage()
- func (x *Chunk) ProtoReflect() protoreflect.Message
- func (x *Chunk) Reset()
- func (x *Chunk) String() string
- type Chunk_Content
- type Chunk_Info
- type Client
- type ClientGRPC
- type ClientGRPCConfig
- type DiskStore
- type FileInfo
- type FileRequest
- type FileResponse
- type FileStore
- type GuploadServiceClient
- type GuploadServiceServer
- type GuploadService_DownloadClient
- type GuploadService_DownloadServer
- type GuploadService_UploadClient
- type GuploadService_UploadServer
- type Health
- type HealthCheckRequest
- func (*HealthCheckRequest) Descriptor() ([]byte, []int)deprecated
- func (x *HealthCheckRequest) GetCounter() string
- func (x *HealthCheckRequest) GetLabel() string
- func (x *HealthCheckRequest) GetPingAt() string
- func (x *HealthCheckRequest) GetService() string
- func (*HealthCheckRequest) ProtoMessage()
- func (x *HealthCheckRequest) ProtoReflect() protoreflect.Message
- func (x *HealthCheckRequest) Reset()
- func (x *HealthCheckRequest) String() string
- type HealthCheckResponse
- func (*HealthCheckResponse) Descriptor() ([]byte, []int)deprecated
- func (x *HealthCheckResponse) GetReceivedAt() string
- func (x *HealthCheckResponse) GetStatus() HealthCheckResponse_ServingStatus
- func (*HealthCheckResponse) ProtoMessage()
- func (x *HealthCheckResponse) ProtoReflect() protoreflect.Message
- func (x *HealthCheckResponse) Reset()
- func (x *HealthCheckResponse) String() string
- type HealthCheckResponse_ServingStatus
- func (HealthCheckResponse_ServingStatus) Descriptor() protoreflect.EnumDescriptor
- func (x HealthCheckResponse_ServingStatus) Enum() *HealthCheckResponse_ServingStatus
- func (HealthCheckResponse_ServingStatus) EnumDescriptor() ([]byte, []int)deprecated
- func (x HealthCheckResponse_ServingStatus) Number() protoreflect.EnumNumber
- func (x HealthCheckResponse_ServingStatus) String() string
- func (HealthCheckResponse_ServingStatus) Type() protoreflect.EnumType
- type PingStats
- type Server
- type ServerGRPC
- func (s *ServerGRPC) Check(ctx context.Context, in *HealthCheckRequest) (*HealthCheckResponse, error)
- func (s *ServerGRPC) Close()
- func (s *ServerGRPC) Download(request *FileRequest, stream GuploadService_DownloadServer) error
- func (s *ServerGRPC) Listen() (err error)
- func (s *ServerGRPC) Upload(stream GuploadService_UploadServer) (err error)
- type ServerGRPCConfig
- type Stats
- type StatusCode
- type UnimplementedGuploadServiceServer
- func (*UnimplementedGuploadServiceServer) Check(context.Context, *HealthCheckRequest) (*HealthCheckResponse, error)
- func (*UnimplementedGuploadServiceServer) Download(*FileRequest, GuploadService_DownloadServer) error
- func (*UnimplementedGuploadServiceServer) Upload(GuploadService_UploadServer) error
- type UploadFileInfo
- func (*UploadFileInfo) Descriptor() ([]byte, []int)deprecated
- func (x *UploadFileInfo) GetFileType() string
- func (x *UploadFileInfo) GetFilename() string
- func (*UploadFileInfo) ProtoMessage()
- func (x *UploadFileInfo) ProtoReflect() protoreflect.Message
- func (x *UploadFileInfo) Reset()
- func (x *UploadFileInfo) String() string
- type UploadStatus
- func (*UploadStatus) Descriptor() ([]byte, []int)deprecated
- func (x *UploadStatus) GetCode() StatusCode
- func (x *UploadStatus) GetMessage() string
- func (*UploadStatus) ProtoMessage()
- func (x *UploadStatus) ProtoReflect() protoreflect.Message
- func (x *UploadStatus) Reset()
- func (x *UploadStatus) String() string
Constants ¶
This section is empty.
Variables ¶
var ( StatusCode_name = map[int32]string{ 0: "Unknown", 1: "Ok", 2: "Failed", } StatusCode_value = map[string]int32{ "Unknown": 0, "Ok": 1, "Failed": 2, } )
Enum value maps for StatusCode.
var ( HealthCheckResponse_ServingStatus_name = map[int32]string{ 0: "UNKNOWN", 1: "SERVING", 2: "NOT_SERVING", } HealthCheckResponse_ServingStatus_value = map[string]int32{ "UNKNOWN": 0, "SERVING": 1, "NOT_SERVING": 2, } )
Enum value maps for HealthCheckResponse_ServingStatus.
var DownloadCommand = cli.Command{
Name: "download",
Usage: "download a file",
Action: downloadAction,
Flags: []cli.Flag{
&cli.StringFlag{
Name: "address",
Value: "localhost:1313",
Usage: "address of the server to connect to",
},
&cli.StringFlag{
Name: "file",
Usage: "filename to download",
},
&cli.StringFlag{
Name: "cacert",
Usage: "path of a certifcate to add to the root CAs",
},
&cli.StringFlag{
Name: "servername-override",
Usage: "use serverNameOverride for tls ca cert",
},
},
}
var File_service_proto protoreflect.FileDescriptor
var HealthCheckCommand = cli.Command{
Name: "ping",
Usage: "health check",
Action: healtCheckAction,
Flags: []cli.Flag{
&cli.StringFlag{
Name: "address",
Value: "localhost:1313",
Usage: "address of the server to connect to",
},
&cli.StringFlag{
Name: "label",
Value: "local",
Usage: "Default: local. receiving server used to identify ping-client",
},
&cli.StringFlag{
Name: "interval",
Value: "1s",
Usage: "Default 1s. e.g. 1s, 5s, 100ms, 1h",
},
&cli.StringFlag{
Name: "cacert",
Usage: "path of a certifcate to add to the root CAs",
},
&cli.StringFlag{
Name: "servername-override",
Usage: "use serverNameOverride for tls ca cert",
},
},
}
var ServeCommand = cli.Command{
Name: "serve",
Usage: "initiates a gRPC upload server (max 4MB per file)",
Action: serveAction,
Flags: []cli.Flag{
&cli.IntFlag{
Name: "port",
Usage: "port to bind to",
Value: 1313,
},
&cli.StringFlag{
Name: "key",
Usage: "path to TLS key",
},
&cli.StringFlag{
Name: "certificate",
Usage: "path to TLS certificate",
},
},
}
var UploadCommand = cli.Command{ Name: "upload", Usage: "upload a file (max 4MB per file)", Action: uploadAction, Flags: []cli.Flag{ &cli.StringFlag{ Name: "address", Value: "localhost:1313", Usage: "address of the server to connect to", }, &cli.StringFlag{ Name: "infile", Usage: "local filename to upload", }, &cli.StringFlag{ Name: "cacert", Usage: "path of a certifcate to add to the root CAs", }, &cli.StringFlag{ Name: "servername-override", Usage: "use serverNameOverride for tls ca cert", }, &cli.StringFlag{ Name: "outfile", Usage: "output filename after upload", }, &cli.BoolFlag{ Name: "public", Usage: "send to public download folder", Value: false, }, }, }
Functions ¶
func RegisterGuploadServiceServer ¶
func RegisterGuploadServiceServer(s *grpc.Server, srv GuploadServiceServer)
Types ¶
type Chunk ¶
type Chunk struct { // Types that are assignable to Data: // *Chunk_Content // *Chunk_Info Data isChunk_Data `protobuf_oneof:"data"` // contains filtered or unexported fields }
func (*Chunk) Descriptor
deprecated
func (*Chunk) GetContent ¶
func (*Chunk) GetInfo ¶
func (x *Chunk) GetInfo() *UploadFileInfo
func (*Chunk) ProtoMessage ¶
func (*Chunk) ProtoMessage()
func (*Chunk) ProtoReflect ¶
func (x *Chunk) ProtoReflect() protoreflect.Message
type Chunk_Content ¶
type Chunk_Content struct {
Content []byte `protobuf:"bytes,1,opt,name=Content,proto3,oneof"`
}
type Chunk_Info ¶
type Chunk_Info struct {
Info *UploadFileInfo `protobuf:"bytes,2,opt,name=info,proto3,oneof"`
}
type ClientGRPC ¶
type ClientGRPC struct {
// contains filtered or unexported fields
}
func NewClientGRPC ¶
func NewClientGRPC(cfg ClientGRPCConfig) (c ClientGRPC, err error)
func (*ClientGRPC) Close ¶
func (c *ClientGRPC) Close()
func (*ClientGRPC) DownloadFile ¶
func (c *ClientGRPC) DownloadFile(fileName string) (err error)
func (*ClientGRPC) UploadFile ¶
type ClientGRPCConfig ¶
type DiskStore ¶
type DiskStore struct {
// contains filtered or unexported fields
}
func NewDiskStore ¶
type FileRequest ¶
type FileRequest struct { Filename string `protobuf:"bytes,1,opt,name=filename,proto3" json:"filename,omitempty"` // contains filtered or unexported fields }
Download
func (*FileRequest) Descriptor
deprecated
func (*FileRequest) Descriptor() ([]byte, []int)
Deprecated: Use FileRequest.ProtoReflect.Descriptor instead.
func (*FileRequest) GetFilename ¶
func (x *FileRequest) GetFilename() string
func (*FileRequest) ProtoMessage ¶
func (*FileRequest) ProtoMessage()
func (*FileRequest) ProtoReflect ¶
func (x *FileRequest) ProtoReflect() protoreflect.Message
func (*FileRequest) Reset ¶
func (x *FileRequest) Reset()
func (*FileRequest) String ¶
func (x *FileRequest) String() string
type FileResponse ¶
type FileResponse struct { Shard []byte `protobuf:"bytes,1,opt,name=shard,proto3" json:"shard,omitempty"` // contains filtered or unexported fields }
func (*FileResponse) Descriptor
deprecated
func (*FileResponse) Descriptor() ([]byte, []int)
Deprecated: Use FileResponse.ProtoReflect.Descriptor instead.
func (*FileResponse) GetShard ¶
func (x *FileResponse) GetShard() []byte
func (*FileResponse) ProtoMessage ¶
func (*FileResponse) ProtoMessage()
func (*FileResponse) ProtoReflect ¶
func (x *FileResponse) ProtoReflect() protoreflect.Message
func (*FileResponse) Reset ¶
func (x *FileResponse) Reset()
func (*FileResponse) String ¶
func (x *FileResponse) String() string
type GuploadServiceClient ¶
type GuploadServiceClient interface { Upload(ctx context.Context, opts ...grpc.CallOption) (GuploadService_UploadClient, error) Download(ctx context.Context, in *FileRequest, opts ...grpc.CallOption) (GuploadService_DownloadClient, error) Check(ctx context.Context, in *HealthCheckRequest, opts ...grpc.CallOption) (*HealthCheckResponse, error) }
GuploadServiceClient is the client API for GuploadService service.
For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
func NewGuploadServiceClient ¶
func NewGuploadServiceClient(cc grpc.ClientConnInterface) GuploadServiceClient
type GuploadServiceServer ¶
type GuploadServiceServer interface { Upload(GuploadService_UploadServer) error Download(*FileRequest, GuploadService_DownloadServer) error Check(context.Context, *HealthCheckRequest) (*HealthCheckResponse, error) }
GuploadServiceServer is the server API for GuploadService service.
type GuploadService_DownloadClient ¶
type GuploadService_DownloadClient interface { Recv() (*FileResponse, error) grpc.ClientStream }
type GuploadService_DownloadServer ¶
type GuploadService_DownloadServer interface { Send(*FileResponse) error grpc.ServerStream }
type GuploadService_UploadClient ¶
type GuploadService_UploadClient interface { Send(*Chunk) error CloseAndRecv() (*UploadStatus, error) grpc.ClientStream }
type GuploadService_UploadServer ¶
type GuploadService_UploadServer interface { SendAndClose(*UploadStatus) error Recv() (*Chunk, error) grpc.ServerStream }
type Health ¶
type Health interface { // Check returns if server is healthy or not Check(c context.Context) (bool, error) }
Health defines a health-check connection.
type HealthCheckRequest ¶
type HealthCheckRequest struct { Service string `protobuf:"bytes,1,opt,name=service,proto3" json:"service,omitempty"` PingAt string `protobuf:"bytes,2,opt,name=pingAt,proto3" json:"pingAt,omitempty"` Label string `protobuf:"bytes,3,opt,name=label,proto3" json:"label,omitempty"` Counter string `protobuf:"bytes,4,opt,name=counter,proto3" json:"counter,omitempty"` // contains filtered or unexported fields }
func (*HealthCheckRequest) Descriptor
deprecated
func (*HealthCheckRequest) Descriptor() ([]byte, []int)
Deprecated: Use HealthCheckRequest.ProtoReflect.Descriptor instead.
func (*HealthCheckRequest) GetCounter ¶
func (x *HealthCheckRequest) GetCounter() string
func (*HealthCheckRequest) GetLabel ¶
func (x *HealthCheckRequest) GetLabel() string
func (*HealthCheckRequest) GetPingAt ¶
func (x *HealthCheckRequest) GetPingAt() string
func (*HealthCheckRequest) GetService ¶
func (x *HealthCheckRequest) GetService() string
func (*HealthCheckRequest) ProtoMessage ¶
func (*HealthCheckRequest) ProtoMessage()
func (*HealthCheckRequest) ProtoReflect ¶
func (x *HealthCheckRequest) ProtoReflect() protoreflect.Message
func (*HealthCheckRequest) Reset ¶
func (x *HealthCheckRequest) Reset()
func (*HealthCheckRequest) String ¶
func (x *HealthCheckRequest) String() string
type HealthCheckResponse ¶
type HealthCheckResponse struct { Status HealthCheckResponse_ServingStatus `protobuf:"varint,1,opt,name=status,proto3,enum=HealthCheckResponse_ServingStatus" json:"status,omitempty"` ReceivedAt string `protobuf:"bytes,2,opt,name=receivedAt,proto3" json:"receivedAt,omitempty"` // contains filtered or unexported fields }
func (*HealthCheckResponse) Descriptor
deprecated
func (*HealthCheckResponse) Descriptor() ([]byte, []int)
Deprecated: Use HealthCheckResponse.ProtoReflect.Descriptor instead.
func (*HealthCheckResponse) GetReceivedAt ¶
func (x *HealthCheckResponse) GetReceivedAt() string
func (*HealthCheckResponse) GetStatus ¶
func (x *HealthCheckResponse) GetStatus() HealthCheckResponse_ServingStatus
func (*HealthCheckResponse) ProtoMessage ¶
func (*HealthCheckResponse) ProtoMessage()
func (*HealthCheckResponse) ProtoReflect ¶
func (x *HealthCheckResponse) ProtoReflect() protoreflect.Message
func (*HealthCheckResponse) Reset ¶
func (x *HealthCheckResponse) Reset()
func (*HealthCheckResponse) String ¶
func (x *HealthCheckResponse) String() string
type HealthCheckResponse_ServingStatus ¶
type HealthCheckResponse_ServingStatus int32
const ( HealthCheckResponse_UNKNOWN HealthCheckResponse_ServingStatus = 0 HealthCheckResponse_SERVING HealthCheckResponse_ServingStatus = 1 HealthCheckResponse_NOT_SERVING HealthCheckResponse_ServingStatus = 2 )
func (HealthCheckResponse_ServingStatus) Descriptor ¶
func (HealthCheckResponse_ServingStatus) Descriptor() protoreflect.EnumDescriptor
func (HealthCheckResponse_ServingStatus) Enum ¶
func (x HealthCheckResponse_ServingStatus) Enum() *HealthCheckResponse_ServingStatus
func (HealthCheckResponse_ServingStatus) EnumDescriptor
deprecated
func (HealthCheckResponse_ServingStatus) EnumDescriptor() ([]byte, []int)
Deprecated: Use HealthCheckResponse_ServingStatus.Descriptor instead.
func (HealthCheckResponse_ServingStatus) Number ¶
func (x HealthCheckResponse_ServingStatus) Number() protoreflect.EnumNumber
func (HealthCheckResponse_ServingStatus) String ¶
func (x HealthCheckResponse_ServingStatus) String() string
func (HealthCheckResponse_ServingStatus) Type ¶
func (HealthCheckResponse_ServingStatus) Type() protoreflect.EnumType
type ServerGRPC ¶
type ServerGRPC struct {
// contains filtered or unexported fields
}
func NewServerGRPC ¶
func NewServerGRPC(cfg ServerGRPCConfig, fileStore FileStore) (s ServerGRPC, err error)
func (*ServerGRPC) Check ¶
func (s *ServerGRPC) Check(ctx context.Context, in *HealthCheckRequest) (*HealthCheckResponse, error)
func (*ServerGRPC) Close ¶
func (s *ServerGRPC) Close()
func (*ServerGRPC) Download ¶
func (s *ServerGRPC) Download(request *FileRequest, stream GuploadService_DownloadServer) error
func (*ServerGRPC) Listen ¶
func (s *ServerGRPC) Listen() (err error)
func (*ServerGRPC) Upload ¶
func (s *ServerGRPC) Upload(stream GuploadService_UploadServer) (err error)
type ServerGRPCConfig ¶
type StatusCode ¶
type StatusCode int32
const ( StatusCode_Unknown StatusCode = 0 StatusCode_Ok StatusCode = 1 StatusCode_Failed StatusCode = 2 )
func (StatusCode) Descriptor ¶
func (StatusCode) Descriptor() protoreflect.EnumDescriptor
func (StatusCode) Enum ¶
func (x StatusCode) Enum() *StatusCode
func (StatusCode) EnumDescriptor
deprecated
func (StatusCode) EnumDescriptor() ([]byte, []int)
Deprecated: Use StatusCode.Descriptor instead.
func (StatusCode) Number ¶
func (x StatusCode) Number() protoreflect.EnumNumber
func (StatusCode) String ¶
func (x StatusCode) String() string
func (StatusCode) Type ¶
func (StatusCode) Type() protoreflect.EnumType
type UnimplementedGuploadServiceServer ¶
type UnimplementedGuploadServiceServer struct { }
UnimplementedGuploadServiceServer can be embedded to have forward compatible implementations.
func (*UnimplementedGuploadServiceServer) Check ¶
func (*UnimplementedGuploadServiceServer) Check(context.Context, *HealthCheckRequest) (*HealthCheckResponse, error)
func (*UnimplementedGuploadServiceServer) Download ¶
func (*UnimplementedGuploadServiceServer) Download(*FileRequest, GuploadService_DownloadServer) error
func (*UnimplementedGuploadServiceServer) Upload ¶
func (*UnimplementedGuploadServiceServer) Upload(GuploadService_UploadServer) error
type UploadFileInfo ¶
type UploadFileInfo struct { Filename string `protobuf:"bytes,1,opt,name=filename,proto3" json:"filename,omitempty"` FileType string `protobuf:"bytes,2,opt,name=fileType,proto3" json:"fileType,omitempty"` // contains filtered or unexported fields }
Upload
func (*UploadFileInfo) Descriptor
deprecated
func (*UploadFileInfo) Descriptor() ([]byte, []int)
Deprecated: Use UploadFileInfo.ProtoReflect.Descriptor instead.
func (*UploadFileInfo) GetFileType ¶
func (x *UploadFileInfo) GetFileType() string
func (*UploadFileInfo) GetFilename ¶
func (x *UploadFileInfo) GetFilename() string
func (*UploadFileInfo) ProtoMessage ¶
func (*UploadFileInfo) ProtoMessage()
func (*UploadFileInfo) ProtoReflect ¶
func (x *UploadFileInfo) ProtoReflect() protoreflect.Message
func (*UploadFileInfo) Reset ¶
func (x *UploadFileInfo) Reset()
func (*UploadFileInfo) String ¶
func (x *UploadFileInfo) String() string
type UploadStatus ¶
type UploadStatus struct { Message string `protobuf:"bytes,1,opt,name=Message,proto3" json:"Message,omitempty"` Code StatusCode `protobuf:"varint,2,opt,name=Code,proto3,enum=StatusCode" json:"Code,omitempty"` // contains filtered or unexported fields }
func (*UploadStatus) Descriptor
deprecated
func (*UploadStatus) Descriptor() ([]byte, []int)
Deprecated: Use UploadStatus.ProtoReflect.Descriptor instead.
func (*UploadStatus) GetCode ¶
func (x *UploadStatus) GetCode() StatusCode
func (*UploadStatus) GetMessage ¶
func (x *UploadStatus) GetMessage() string
func (*UploadStatus) ProtoMessage ¶
func (*UploadStatus) ProtoMessage()
func (*UploadStatus) ProtoReflect ¶
func (x *UploadStatus) ProtoReflect() protoreflect.Message
func (*UploadStatus) Reset ¶
func (x *UploadStatus) Reset()
func (*UploadStatus) String ¶
func (x *UploadStatus) String() string